错误 - 未在视图中定义路由 - > Laravel(英语:Laravel



我给出了一个视图网址

<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' => 'studentStudentBatchController@getView']);

显示错误

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

你的路由操作是这样的

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

您的路线应如下所示。

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

如果你想把它称为URL,那么。

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

不要让自己复杂化,尝试编写排序代码并清理代码。你可以试试这个 更改此内容

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

对此

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

在您看来,只需调用它

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

最新更新