Why i want to know what is the user for each profile, am i gonna search for profile?

|
skys215 2019-06-10 19:40:44
or https://packalyst.com/ ?

Packalyst :: Packages for LaravelPackalyst
Simple and social packages registry for Laravel a PHP Framework. Discover packages, ask for packages and learn how to create your own packages for Laravel
skys215 2019-06-10 19:41:32
Nope ~
skys215 2019-06-10 19:43:29
I think that would be a javascript plugin, not laravel
skys215 2019-06-10 19:46:07
for a plugin?
2019-06-10 19:53:29
Please what is the purpose of redux since react is a front end framework
oxbir 2019-06-10 23:46:40
How to save checkboxes in laravel?
oxbir 2019-06-10 23:48:28
Mahmoud Khosravi:
public function store(Request $request)
{
if (auth()->check()) {
if (auth()->user()->verification_code == 1) {
$order = new Order($request->all());
$order->category_id = $request->category_id;
$order->user_id = auth()->user()->id;
$order->status = 0;
$loop = $request->get(‘computers’);
foreach ($loop as $value){
$checked = new Order;
$checked->computer_id = $request->get(‘id’);
$checked->save();
}
$order->save();
alert()->success(‘عملایات مورد نظر با موفقیت انجام شد.’, ‘تایید شد’);
return redirect()->back();
} else {
alert()->warning(‘شما باید کد تاییدیه را وارد کنید.’, ‘هشدار’);
return redirect()->back();
}
} else {
alert()->warning(‘شما برای تایید ابتدا ثبت نام کنید’, ‘متوجه شدم’)->persistent(“بسیار خوب”);
return redirect()->back();
}
}
oxbir 2019-06-10 23:48:54
But I get this error
oxbir 2019-06-10 23:49:21
Mahmoud Khosravi:
SQLSTATE[HY000]: General error: 1364 Field ‘category_id’ doesn’t have a default value (SQL: insert into orders (computer_id, updated_at, created_at) values (?, 2019-06-10 18:02:17, 2019-06-10 18:02:17))
DesolatorMagno 2019-06-10 23:58:06
Check you $request to see if all the values are send well.
Omid_On11 2019-06-11 07:34:56
skys215 2019-06-10 16:23:33
Do you mean scheduled job? Use php artisan queue:work?

Yep.
Thanks for your reply

But it seams that doesn’t work on live server
(Maybe I don’t know how to set it’s cron)

skys215 2019-06-11 07:38:18
crontab -e
skys215 2019-06-11 07:38:52
Check for user. Maybe you need -u or something else to specify the crontab you are going to edit
2019-06-11 08:44:00
Anybody help me! global search in datatable in laravel.
(This is not a laravel package)
2019-06-11 08:44:09
Please help me Thanks
skys215 2019-06-11 08:47:12
Write your on query builder
2019-06-11 08:49:13
ya. I don’t have an idea.Please share some code @skys215
2019-06-11 08:49:24
ThankYou
skys215 2019-06-11 09:00:52
function index($request){
$posts = Post::query();
if($request->input(‘keyword’)){
$keyword = $request->input(‘keyword’);
$posts->whereLike(‘title’, $keyword)->orWhereLike(‘description’, $keyword);
}
if($request->input(‘start_date’)){
$posts->orWhere(‘create_time’, ‘>’, $request->input(‘start_date’));
}
}
skys215 2019-06-11 09:01:18
something like this
I typed it on my phone, so it took time
2019-06-11 09:01:49
@skys215 Thank you bro
2019-06-11 09:03:25
you did not understand my question!. I briefly explain you
skys215 2019-06-11 09:04:17
Just add all searchable filed in the query builder
skys215 2019-06-11 09:04:34
Or use elastic search instaed
2019-06-11 09:07:45
I am using Datatable in Master page. Master page contain data more than 1000 records.so I decide to use server-side rendering from Ajax and I also need global search.I need to Know about how to using Datatable global search in server-side.@Skys
skys215 2019-06-11 09:08:38
What do you mean by global search? search all field?
2019-06-11 09:10:10
skys215 2019-06-11 09:08:38
What do you mean by global search? search all field?

search all records from the server side and depending on display fields

skys215 2019-06-11 09:10:58
I didn’t get you. I don’t know where’s the problem
skys215 2019-06-11 09:11:15
Just search and return the result
2019-06-11 09:11:42
oh k fine Thank you@skys215
skys215 2019-06-11 09:17:01
Not at all
oxbir 2019-06-11 10:06:23
I use laravel 5.8 but IlluminateDatabaseEloquentModelNotFoundException not found
oxbir 2019-06-11 10:06:34
laravel_discuss-7115.jpg

oxbir 2019-06-11 10:07:15
What should i do?
2019-06-11 14:34:53
i use hasMany without defintion of belongTo in relation , that works fine i dont know what is usage of belogsTo , why should define reverse relation ?
DesolatorMagno 2019-06-11 15:51:18
You just declare what you need.
DesolatorMagno 2019-06-11 15:54:04
Example, in a School each kid could have 1 person that take care of them and each person can have many kids under their care, it would be necessary to know in both cases, but for user and profile maybe not that much.
luismaringuitar 2019-06-11 16:48:39
G’day, one question, how to know if a session is active through ajax? buh i use a 2 microservice on my app with laravel
skys215 2019-06-11 16:51:01
What kind of authentication are you using?
luismaringuitar 2019-06-11 17:08:25
the standard of laravel
2019-06-11 19:31:18
DesolatorMagno 2019-06-11 15:51:18
You just declare what you need.

defining belongsTo should be for a reason , hasMany works with or without it , so what is belongsTo rule ?

DesolatorMagno 2019-06-11 19:41:24
2019-06-11 19:31:18
defining belongsTo should be for a reason , hasMany works with or without it , so what is belongsTo rule ?

(Very easy and direct example) Kids are in classroom, classrom have kids.
How do i know how many or what kids are in what classroom?

User have a profile, a profile is own by a User
Why i want to know what is the user for each profile, am i gonna search for profile?

Those are the kind of question you should ask yourself when you are Desingning the DB and relationship.

Marvixino 2019-06-12 08:06:41
Is there a well done spa app template with admin dashboard in GitHub ?
oxbir 2019-06-12 08:15:36
I want to after registered a user name, age, mobile and … get the session of mobile because in next page, I want to get mobile in input hidden.

> Attention: I did not do session at all.

I think it’s like this:

RegisterController.php

public function register(Request $request, User $user)
{
$code = rand(10000,99999);
session->get(‘mobile’)
$user = AppUser::create([
‘first_name’ => $request->first_name,
‘last_name’ => $request->last_name,
‘gender’ => $request->gender,
‘mobile’ => $request->mobile,
‘code’ => $code,
.
.
.
return redirect()->route(‘code’)->with(‘mobile’, $request->mobile);
}

It redirect to this page.

code.blade.php

<form action=”{{ route(‘send’) }}” method=”post”>
{{ csrf_field() }}
<input type=”hidden” class=”form-control” value=”{{ session->mobile }}” name=”mobile” id=”mobile”>
<div class=”form-group”>
<label for=”code”>کد</label>
<input type=”text” class=”form-control” name=”code” id=”code”>
</div>
<div class=”form-group”>
<button type=”submit” class=”btn btn-danger” id=”btn-ok”>OK</button>
</div>
</form>
[1]: https://i.stack.imgur.com/jIOUp.jpg

oxbir 2019-06-12 08:16:58
oxbir 2019-06-12 08:15:36
I want to after registered a user name, age, mobile and … get the session of mobile because in next page, I want to get mobile in input hidden.

> Attention: I did not do session at all.

I think it’s like this:

RegisterController.php

public function register(Request $request, User $user)
{
$code = rand(10000,99999);
session->get(‘mobile’)
$user = AppUser::create([
‘first_name’ => $request->first_name,
‘last_name’ => $request->last_name,
‘gender’ => $request->gender,
‘mobile’ => $request->mobile,
‘code’ => $code,
.
.
.
return redirect()->route(‘code’)->with(‘mobile’, $request->mobile);
}

It redirect to this page.

code.blade.php

<form action=”{{ route(‘send’) }}” method=”post”>
{{ csrf_field() }}
<input type=”hidden” class=”form-control” value=”{{ session->mobile }}” name=”mobile” id=”mobile”>
<div class=”form-group”>
<label for=”code”>کد</label>
<input type=”text” class=”form-control” name=”code” id=”code”>
</div>
<div class=”form-group”>
<button type=”submit” class=”btn btn-danger” id=”btn-ok”>OK</button>
</div>
</form>
[1]: https://i.stack.imgur.com/jIOUp.jpg

How to get session mobile in laravel?

loveycom 2019-06-12 09:08:55
One of the ways to pass parameters from controller to route blade is what you have implemented above.

However, you are not seeing it because you did not display it. From your code the mobile is available already in your blade. Display it and you shall see it.

loveycom 2019-06-12 09:10:23
Note: using *with* does not requires session while retrieving.
StanleyMasinde 2019-06-12 09:11:46
oxbir 2019-06-12 08:16:58
How to get session mobile in laravel?

Using the api token?

oxbir 2019-06-12 09:13:21
StanleyMasinde 2019-06-12 09:11:46
Using the api token?

Can you send complete code for me?

StanleyMasinde 2019-06-12 09:15:30
oxbir 2019-06-12 09:13:21
Can you send complete code for me?

Just append the api token in your requests.

yoursite.com/posts?api-token=token

Laravel will automatically lookup the user making tge request.

|