diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index d265918..980e7e3 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -546,6 +546,7 @@ class WorkerController extends Controller $Query = $Query->OrderBy('updated_at')->paginate(3); + return view('workers.favorite', compact('Query', 'Query_count', 'Job_title')); diff --git a/app/Providers/MyServiceProvider.php b/app/Providers/MyServiceProvider.php index a8f1474..2dc9745 100644 --- a/app/Providers/MyServiceProvider.php +++ b/app/Providers/MyServiceProvider.php @@ -93,7 +93,7 @@ class MyServiceProvider extends ServiceProvider $user = Auth::user(); $id = $user->id; $employer = Employer::query()->where('user_id', $id)->get(); - $id_employer = $employer[0]->id; + $id_employer = $employer[0]->id; $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); } ); @@ -104,7 +104,11 @@ class MyServiceProvider extends ServiceProvider $user = Auth::user(); $id = $user->id; $Worker = Worker::query()->where('user_id', $id)->get(); - $id_worker = $Worker[0]->id; + if (isset($Worker[0]->id)) { + $id_worker = $Worker[0]->id; + } else { + $id_worker = 0; + } $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); } );