Commit 4415365f230d6cdb5cb5a979bb086600eba7f5a8

Authored by Андрей Ларионов
1 parent 5725a36363
Exists in master

Провайдеры

Showing 2 changed files with 7 additions and 2 deletions Side-by-side Diff

app/Http/Controllers/WorkerController.php
... ... @@ -546,6 +546,7 @@ class WorkerController extends Controller
546 546  
547 547 $Query = $Query->OrderBy('updated_at')->paginate(3);
548 548  
  549 +
549 550 return view('workers.favorite', compact('Query',
550 551 'Query_count',
551 552 'Job_title'));
app/Providers/MyServiceProvider.php
... ... @@ -93,7 +93,7 @@ class MyServiceProvider extends ServiceProvider
93 93 $user = Auth::user();
94 94 $id = $user->id;
95 95 $employer = Employer::query()->where('user_id', $id)->get();
96   - $id_employer = $employer[0]->id;
  96 + $id_employer = $employer[0]->id;
97 97 $view->with(['id_employer' => $id_employer, 'Employer' => $employer]);
98 98 }
99 99 );
... ... @@ -104,7 +104,11 @@ class MyServiceProvider extends ServiceProvider
104 104 $user = Auth::user();
105 105 $id = $user->id;
106 106 $Worker = Worker::query()->where('user_id', $id)->get();
107   - $id_worker = $Worker[0]->id;
  107 + if (isset($Worker[0]->id)) {
  108 + $id_worker = $Worker[0]->id;
  109 + } else {
  110 + $id_worker = 0;
  111 + }
108 112 $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]);
109 113 }
110 114 );