create view from route laravel 1

create view from route laravel

Route::get('/', function () {
    return view('greeting', ['name' => 'James']);

Here is what the above code is Doing:
1. We’re defining a route that responds to a GET request to the / URL.
2. We’re telling Laravel to return the view named greeting.
3. We’re passing the view a variable named name with a value of James.

The view is located in resources/views/greeting.blade.php.

Similar Posts