2017-01-22 7 views
1

私は以下のようなURL構造を実現しようとしています。 LaravelルートURL - クエリ文字列 - マルチレベル

にエラーが発生しました[ルートのために必要なパラメータが含まれていません

  • example.com/clients/{client_id}{project_id} //問題をやっ

    • example.com/clients/{client_id} // :clients.show_project] [URI:clients/{client}/{project_id}]。ビュー

      <a href="{{ route('clients.show_project', $task->client_id, $task->project_id)}}">{{ $task->title }}</a> 
      

      Route::group(['prefix' => 'clients', 'as' => 'clients.'], function() { 
      
           Route::get('/', [ 
            'uses' => '[email protected]', 
            'as' => 'index', 
           ]); 
      
           Route::get('/create', [ 
            'uses' => '[email protected]', 
            'as' => 'create', 
           ]); 
      
           Route::post('/store', [ 
            'uses' => '[email protected]', 
            'as' => 'store', 
           ]); 
      
           Route::group(['prefix' => '{client}', '__rp' => ['menu' => 'clients']], function() { 
      
            Route::get('/', [ 
             'uses' => '[email protected]_client', 
             'as' => 'show', 
            ]); 
      
           }); 
      
           Route::group(['prefix' => '{client}/{project_id}'], function() { 
      
            Route::get('/', [ 
             'uses' => 'Cl[email protected]_project', 
             'as' => 'show_project', 
            ]); 
      
           }); 
      
           }); 
      

      コントローラ

      public function show_project($client, $project_id) 
          { 
          $project_threads = Project_Threads::where('project_id', $project_id)->get(); 
          return $project_threads; 
      } 
      
  • +0

    は、あなたが私のコード更新 –

    +0

    show_project' 'ClientsController @のコードを入れることができます@ Bara'ayyash。 – Zack

    答えて

    1

    問題は、あなたのビューです。配列内のパラメーターをroute()に渡す必要があります。これを試してみてください:

    <a href="{{ route('clients.show_project', [$task->client_id, $task->project_id])}}">{{ $task->title }}</a> 
    
    関連する問題