为什么在laravel中的相同控制器功能中不能使用一个控制器功能路由

时间:2017-12-25 13:07:24

标签: php laravel-5

我在My laravel应用程序中有三个这样的TaskController函数方法,

  public function show($project_id,$task_id)

     {
        $project = Project::find($project_id);
        $task = Task::find($task_id);
    view('tasks.show')->withProject($project)->withFiles($files)->withTask($task);
 return view('tasks.show', ['task' => $task, 'project' => $project]);
     }
    public function show1($project_id,$task_id)
      {
        $project = Project::find($project_id);
        $task = Task::find($task_id);
view('tasks.show')->withProject($project)->withFiles($files)->withTask($task);
       return view('tasks.show1', ['task' => $task, 'project' => $project]);
     }
    public function show2($project_id,$task_id)
     {
        $project = Project::find($project_id);
        $task = Task::find($task_id);
view('tasks.show')->withProject($project)->withFiles($files)->withTask($task);
   return view('tasks.show2', ['task' => $task, 'project' => $project]);
     }

我的路线是这样的,

Route::get('projects/{projects}/tasks/{tasks}',[
'uses' => '\App\Http\Controllers\TasksController@show',
    ]);
Route::get('collaborators/projects/{projects}/tasks/{tasks}', [
    'uses' => '\App\Http\Controllers\TasksController@show1',
   ]);

Route::get('collaborators/projects/{projects}/tasks/{tasks}', [
    'uses' => '\App\Http\Controllers\TasksController@show2',
  ]);

但在以上三条路线中 show1 路线无效。但如果我删除 show2 路由,那么show1正在运行。我该如何解决这个问题?

0 个答案:

没有答案