В Laravel -5.8 проекте, С этого контроллера:
public function manager_employee_goal($id)
{
$userCompany = Auth::user()->company_id;
$userEmployee = Auth::user()->employee_id;
$identities = DB::table('appraisal_identity')->select('id')->where('company_id', $userCompany)->where('is_current', 1)->first();
$linemanager = DB::table('hr_employees')->select('line_manager_id')->where('id', $userEmployee)->first();
$linemanageremployee = DB::table('hr_employees')->select('id')->where('line_manager_id', $linemanager->line_manager_id)->pluck('id');
$appraisedemployees = HrEmployee::select('id', 'employee_code', 'first_name', 'last_name')->where('id', $id)->get();
$goals = AppraisalGoal::where('employee_id', $id)->where('appraisal_identity_id', $identities->id)->where('is_published', 1)->where('id', '!=', $linemanager->line_manager_id)->get();
return view('appraisal.appraisal_goals.manager_employee_goal')->with('goals', $goals)->with('appraisedemployees', $appraisedemployees);
}
Я перешел к:
public function manager_employee_goal_list($id)
{
$goal = AppraisalGoal::findOrFail($id);
$goaldetails = AppraisalGoalDetail::where('appraisal_goal_id', $id)->get();
$goalcomments = AppraisalGoalComment::where('appraisal_goal_id', $id)->get();
return view('appraisal.appraisal_goals.manager_employee_goal_list')
->with('goal', $goal)
->with('goaldetails', $goaldetails)
->with('goalcomments', $goalcomments);
}
используя:
<a class="btn btn-xs btn-primary" href="{{ route('appraisal.appraisal_goals.manager_employee_goal_list', ['id'=>$goal->id]) }}">
{{ trans('global.view') }}
</a>
Когда я хотел вернуться к:
publi c function manager_employee_goal ($ id)
Я использовал:
<div class="panel-heading clearfix">
<div class="container-fluid">
<div class="float-right">
<div class="btn-group btn-group-sm" role="group">
<a href="{{ route("appraisal.appraisal_goals.manager_employee_goal/{id?}") }}" class="btn bg-navy margin" title=" Back">
<span> Back to List</span>
</a>
</div>
</div>
</div>
</div>
Но я получил эту ошибку:
Маршрут [appraisal.appraisal_goals.manager_employee_goal / {id?}] Не определен
Это мой маршрут / сеть. php:
Route::get('appraisal_goals/manager_employee_goal/{id?}', 'Appraisal\AppraisalGoalsController@manager_employee_goal')->name('appraisal.appraisal_goals.manager_employee_goal');
Route::get('appraisal_goals/manager_employee_goal_list/{id?}', 'Appraisal\AppraisalGoalsController@manager_employee_goal_list')->name('appraisal.appraisal_goals.manager_employee_goal_list');
Как мне это решить?
Спасибо