PHP Classes

File: routes/web.php

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Vue.js PHP CRUD Example Using Laravel Vite   routes/web.php   Download  
File: routes/web.php
Role: Example script
Content type: text/plain
Description: Application routing script
Class: Vue.js PHP CRUD Example Using Laravel Vite
Example application to manage users and blog posts
Author: By
Last change:
Date: 5 months ago
Size: 1,348 bytes
 

Contents

Class file image Download
<?php

use App\Http\Controllers\ProfileController;
use
Illuminate\Foundation\Application;
use
Illuminate\Support\Facades\Route;
use
Inertia\Inertia;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return
Inertia::render('Welcome', [
       
'canLogin' => Route::has('login'),
       
'canRegister' => Route::has('register'),
       
'laravelVersion' => Application::VERSION,
       
'phpVersion' => PHP_VERSION,
    ]);
});

Route::get('/dashboard', function () {
    return
Inertia::render('Dashboard');
})->
middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
   
Route::get('/posts', [PostController::class,'index']);
   
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
   
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
   
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

require
__DIR__.'/auth.php';