我正在开发 Laravel 5,并且已经为所有页面设置了路由。我有一个仪表板,其中包含某些图标,单击这些图标会重定向到不同的页面。现在,这个特定的图标“Total Applications”在单击时不会重定向到与其关联的页面,即total.blade.php,而是重定向到另一个页面candidate.blade.php。
我是 Laravel 的新手。我希望当我单击“应用程序总数”页面时,它应该重定向到为其指定的页面。
我分享以下代码:
仪表板.blade.php 文件:
<div class="col-md-4">
<div class="single-dashboard-link card card-default p-3 text-center" onclick="location.href='{{route('employers.total')}}'">
<i class="fa fa-file-text font30"></i>
<h6>
{{ $user->employerJobApplications()->count() }} Total
</h6>
<p>
Applications
</p>
</div>
</div>
包含两个页面的路由的路由文件:-
Route::get('/total-applications', 'Frontend\EmployersController@totalApplications')->name('employers.total');
Route::get('/{status}', 'Frontend\EmployersController@candidatesDisplay')->name('employers.candidate');
我的控制器包含“总应用程序”页面的逻辑:-
public function totalApplications() {
if (!Auth::check()) {
session()->flash('error', 'Sorry !! You are not an authenticated Employer !!');
return back();
}
$user = Auth::user();
$user_id = $user->id;
$applicant = JobActivity::where('user_id',$user_id)->get();
return view('frontend.pages.employers.total', compact('user', 'applicant'));
}
一只萌萌小番薯