【问题标题】:Error -Route not defined in view-> Laravel错误-视图中未定义路由-> Laravel
【发布时间】:2020-05-22 02:39:31
【问题描述】:

我给出了一个视图 URL

<input type="hidden" id="urlview" urlview="{{ URL::route('Batch-InnerView/'.$batch->batch_id) }}" /> in view and my web route is 
Route::get('/Batch-InnerView/{id}',['as' => 'BatchInnerView', 'uses' => 'student\StudentBatchController@getView']);

显示错误

错误异常 (E_ERROR) 路线 [/Batch-InnerView/1] 未定义。 (查看:D:\vjcetcrm\resources\views\settings\student\Batch-InnerView.blade.php)

【问题讨论】:

    标签: laravel view routes


    【解决方案1】:

    您的路线操作是这样放置的

    urlview="{{ route('BatchInnerView',$batch->batch_id) }}" 
    

    【讨论】:

      【解决方案2】:

      您的路线应如下所示。

      {{ route('BatchInnerView',$batch->batch_id) }}
      

      如果你想把它称为 URL 的话。

      {{ url('Batch-InnerView/'.$batch->batch_id) }}
      

      【讨论】:

        【解决方案3】:

        不要把自己复杂化,试着写一个排序代码和干净的代码。你可以试试这个 改变这个

        Route::get('/Batch-InnerView/{id}',['as' => 'BatchInnerView', 'uses' => 'student\StudentBatchController@getView']);
        

        到这里

        Route::get('/Batch-InnerView/{id}','student\StudentBatchController@getView')->name('BatchInnerView');
        

        在您看来,只需调用它

        {{route('BatchInnerView',['id'=>$batch->batch_id])}}
        

        【讨论】:

          猜你喜欢
          • 2017-11-23
          • 2018-06-27
          • 2019-01-15
          • 2021-05-01
          • 2017-05-02
          • 2016-01-30
          • 1970-01-01
          • 2019-01-15
          • 2017-05-15
          相关资源
          最近更新 更多