0
ErrorException在ProjectController.php 41行:試圖讓非對象
我打電話delete_project的 財產()內我的控制器,但它似乎Laravel也呼籲get_project($ variable_here)方法
ProjectsController
public function get_project($slug_name){
$project = Project::where('slug_name', $slug_name)->first();
if ($project->user_id == Auth::user()->id) {
return view('project', ['project' => $project]);
}else {
return redirect('console');
}
}
public function delete_project(){
}
網絡路由
Route::get('/console', 'H[email protected]');
Route::get('project/{slug_name}', '[email protected]_project');
Route::get('get_projects', '[email protected]_projects');
Route::post('create_new_project', '[email protected]_new_project');
Route::post('/delete_project', '[email protected]_project');
請顯示'get_project'路線。 –
哎呀對不起,我忘了那條線。 Route :: get('get_projects','UserController @ get_projects'); – mariozawa
路線看起來不錯。嘗試使用'php artisan route:clear'命令清除路由緩存。 –