Laravel 2022-05-23 18:41

|
faissaloux 2022-05-23 18:41:59
Ah it’s an interface? Have u bind it to a class!
nanribet 2022-05-23 18:42:09
Please how can I convert my templates into laravel
lilbreezyy 2022-05-23 18:42:30
faissaloux 2022-05-23 18:41:59
Ah it’s an interface? Have u bind it to a class!

I will try it

lilbreezyy 2022-05-23 18:43:30
laravel_discuss-122057.jpg

faissaloux 2022-05-23 18:44:24
lilbreezyy 2022-05-23 18:43:30

So u turn it into class okay

faissaloux 2022-05-23 18:44:38
Now u need to create the class functions
lilbreezyy 2022-05-23 18:45:05
I’ll give it try
Amit Sharma 2022-05-23 18:57:26
anyone pls help me i have a query
anujrock1 2022-05-23 18:58:02
Amit Sharma 2022-05-23 18:57:26
anyone pls help me i have a query

Ask

Amit Sharma 2022-05-23 18:58:09
i have a table of users and another table app_status
Amit Sharma 2022-05-23 18:58:35
in app_status i have user_id and stage cloumn
Amit Sharma 2022-05-23 18:59:37
and i have update the app_status of user_id = 1 with stage = 1a
Amit Sharma 2022-05-23 19:00:38
as same there are mutiple records
Amit Sharma 2022-05-23 19:00:49
in app_status
Amit Sharma 2022-05-23 19:01:22
now i want to fetch these users
Amit Sharma 2022-05-23 19:01:48
by eloquent
anujrock1 2022-05-23 19:02:51
Amit Sharma 2022-05-23 19:01:22
now i want to fetch these users

What’s problem?

You can fetch easily, you only app_status tables

Or user tabel record with app_status record?

anujrock1 2022-05-23 19:03:12
Amit Sharma 2022-05-23 19:01:48
by eloquent

Only app_status table data?

Amit Sharma 2022-05-23 19:03:25
i want that users having stage 1a
anujrock1 2022-05-23 19:03:56
Amit Sharma 2022-05-23 18:59:37
and i have update the app_status of user_id = 1 with stage = 1a

According to this, there will be only one user, so how you expecting to get users

Amit Sharma 2022-05-23 19:04:33
yes i want only that if it is one user
anujrock1 2022-05-23 19:04:51
Amit Sharma 2022-05-23 19:03:25
i want that users having stage 1a

No got it

You want all users listing whose stage value is 1a in app_status table

Right?

Amit Sharma 2022-05-23 19:05:38
yes it may be more users or may be one
Amit Sharma 2022-05-23 19:06:20
i tried like
Amit Sharma 2022-05-23 19:06:37
laravel_discuss-122079.jpg

anujrock1 2022-05-23 19:06:44
Amit Sharma 2022-05-23 19:05:38
yes it may be more users or may be one

Correct me if I am wrong

You want all users record whose stage is 1a

Amit Sharma 2022-05-23 19:06:59
yes
Amit Sharma 2022-05-23 19:07:10
right
anujrock1 2022-05-23 19:07:31
Amit Sharma 2022-05-23 19:00:38
as same there are mutiple records

What’s the relationship hasOne?

Amit Sharma 2022-05-23 19:07:44
laravel_discuss-122084.jpg

anujrock1 2022-05-23 19:09:15
Amit Sharma 2022-05-23 19:07:10
right

You have two options to do this one query from user tabel and other one is query from app_status table

Amit Sharma 2022-05-23 19:09:31
ok
anujrock1 2022-05-23 19:12:44
$status = 1a // your dynamic status

$users = User::with(‘applicationStatus’)->whereHas(‘applicationStatus’, function ($query) use($status) {
return $query->where(‘stage’, $status) ;
})->get() ;

Amit Sharma 2022-05-23 19:14:51
can u pls explain it a little
anujrock1 2022-05-23 19:15:07
Another method is

$status = your status

$application_status_with_user = ApplicationStatus::with(‘user’)->where(‘stage’, $stage)->get();

|