Answer the question
In order to leave comments, you need to log in
How to pass parameters to Laravel template?
In general, there was a problem with passing GET parameters to the template. And to be more precise, the address is: /room/{id}/{meth?}
routes.php
Route::get('/room/{id}/{meth?}', array('as' => 'index', 'uses' => '[email protected]', function ($id, $meth = null) {
if ( $meth=='delete' ) return 'delete';
}))->where('id', '[0-9a-zA-Z]+');
public function Room(){
return View('room');
}
@extends('layouts.default')
{{ $id }}
ErrorException in 8403e2e5d69462dce318c46b68c17f94 line 1:
Undefined variable: id (View: C:\OpenServer\domains\laravel\resources\views\room.blade.php)
return View::make('room');
FatalErrorException in HomeController.php line 16:
Class 'App\Http\Controllers\View' not found
Answer the question
In order to leave comments, you need to log in
And where is the passing of the id parameter to the view? Maybe you should read the documentation about templates ?
But first, read the PHP documentation about namespaces.
The View facade is in the global namespace, so it must be referred to as \View.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question