“Rute Laravel” Kode Jawaban

Laravel Route Namespace dan awalan

Route::prefix('admin')->group(function () {
    Route::get('/users', function () {
        // Matches The "/admin/users" URL
    });
});
Perfect Plover

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

Laravel Route Return View di Web.php

Route::get("/page", function(){
   return View::make("dir.page");
});
Perfect Petrel

bernama rute dengan parameter laravel

Route::get('/menu/{category}/{product}/{item}', ['as' => 'named.route' , 'uses' => 'MenuController@listItem']);

// to get the actual linke
route('named.route', ['category' => $category->id, 'product' => $product->id, 'item' => $item->id]);
Xanthous Xenomorph

Laravel Route Namespace dan awalan

Route::name('admin.')->group(function () {
    Route::get('/users', function () {
        // Route assigned name "admin.users"...
    })->name('users');
});
Perfect Plover

Rute Laravel

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

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

// /user/1/profile?photos=yes
Distinct Dragonfly

Jawaban yang mirip dengan “Rute Laravel”

Pertanyaan yang mirip dengan “Rute Laravel”

Lebih banyak jawaban terkait untuk “Rute Laravel” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya