“Routing Laraval” Kode Jawaban

Routing Laraval

use App\Http\Controllers\UserController;
use App\Models\User;

// Route definition...
Route::get('/users/{user}', [UserController::class, 'show']);

// Controller method definition...
public function show(User $user)
{
    return view('user.profile', ['user' => $user]);
}
Takesha kalauarachchci

Rute Laravel

Route::get('user/{id}', function ($id) {
    return 'User '.$id;
});
Enthusiastic Elephant

rute () dan dengan () di Laravel

Route::get('user/{id}/profile', function ($id) {
    //
})->name('profile');

$url = route('profile', ['id' => 1, 'photos' => 'yes']);

// /user/1/profile?photos=yes
Lucky Loris

Jawaban yang mirip dengan “Routing Laraval”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya