Вот мои маршруты:
Route::get('/admin/job-seeker/search/employer/{employerId}', 'AdminJobSeekerSearchController@show')->name('admin.job-seeker.search.employer.show')->middleware('verified');
Route::get('/admin/job-seeker/search/employer/{employerId}/post-a-job/{jobPostId}', 'AdminEmployerJobPostsController@show')->name('admin.employer.post-a-job.show')->middleware('verified');
Контроллер для первого маршрута:
public function show($employerId)
{
$user = Auth::user();
$jobSeekerProfile = JobSeekerProfile::all()->where('user_id', $user->id)->first();
$employerProfiles = EmployerProfile::limit(1)->where('id', $employerId)->get();
$jobPosts = JobPosts::all();
return view('admin.job-seeker.search.employer.show', compact('employerProfiles', 'id', 'jobSeekerProfile', 'jobPosts'));
}
Контроллер для второго маршрута:
public function show($employerId, $jobPostId)
{
$user = Auth::user();
$jobSeekerProfile = JobSeekerProfile::all()->where('user_id', $user->id)->first();
$employerProfiles = EmployerProfile::limit(1)->where('id', $employerId)->get();
$jobPosts = JobPosts::all();
$jobPost = JobPosts::findOrFail($jobPostId);
return view('admin.employer.post-a-job.show', compact('jobSeekerProfile', 'employerProfiles', 'jobPosts', 'jobPost'));
}
У меня есть две таблицы employer_profiles
и job_posts
. После того, как работодатель зарегистрируется и создаст профиль, он может создавать вакансии с 2 полями job_title
и job_description
. Например, это может быть Project Manager, а затем описание этой роли.
Я получаю эту ошибку:
Отсутствуют обязательные параметры для [Route: admin.employer.post- a-job.show] [URI: администратор / соискатель / поиск / работодатель / {EmployerId} / post-a-job / {jobPostId}]. (Представление: C: \ xampp \ htdocs \ highrjobs \ resources \ views \ includes \ job_seeker_search_employers.blade. php) (Представление: C: \ xampp \ htdocs \ highrjobs \ resources \ views \ includes \ job_seeker_search_employers. лезвие. php)
job_seeker_search_employees.blade :
@if($employerProfiles)
@foreach($employerProfiles as $employerProfile)
<br><br>
<div class="col-md-6 offset-md-3">
<div class="card" style="width: 28rem;">
<img class="card-img-top" src="https://via.placeholder.com/400" alt="Card image cap" style="max-height:400px;">
<div class="card-body">
<h1 class="card-title text-uppercase" style="color: #5dad07;"><strong>{{ $employerProfile['immediate_contact'] }}</strong></h1>
<h3><strong>Positions Available:</strong><br>
@if($jobPosts->where('user_id', $employerProfile->user_id)->count() > 0)
@foreach($jobPosts->where('user_id', $employerProfile->user_id) as $jobPost)
<h5><a href="{{route('admin.employer.post-a-job.show', $employerProfile->user_id, $jobPost->id)}}" type="button">{{ $jobPost['job_title'] }}</a></h5>
@endforeach
@else
<h5>No Positions Available</h5>
@endif
</h3>
<h3><strong>Contact Details:</strong></h3>
<p>
<strong>Company Name:</strong> {{ $employerProfile['company_name'] }}<br>
<strong>Contact Email:</strong> {{ $employerProfile['email'] }}<br>
<strong>Phone:</strong> {{ $employerProfile['company_phone'] }}
</p>
<strong>Address:</strong>
<address>{{ $employerProfile['company_address'] }}</address>
</div>
</div>
</div>
<br><br><br>
@endforeach
@endif