Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel route resources

// Implicit Model Binding Routes can be created with one line using either:
Route::resource('photos', PhotoController::class);
// OR
Route::resources([
	'photos' => PhotoController::class,
    'posts' => PostController::class,
]);

php artisan make:controller PhotoController --resource --model=Photo
  // makes a controller with stubouts for methods:
  // index
  // create
  // store
  // show
  // edit
  // update
  // destroy 
Comment

route resource laravel

Verb          Path                        Action  Route Name
GET           /users                      index   users.index
GET           /users/create               create  users.create
POST          /users                      store   users.store
GET           /users/{user}               show    users.show
GET           /users/{user}/edit          edit    users.edit
PUT|PATCH     /users/{user}               update  users.update
DELETE        /users/{user}               destroy users.destroy
Comment

how to named route resource laravel

Route::resource('faq', 'ProductFaqController', [
    'names' => [
        'index' => 'faq',
        'store' => 'faq.new',
        // etc...
    ]
]);
Comment

how naming resource routes laravel

By default, all resource controller actions have a route name;
however, you can override these names by passing a names array
with your desired route names:

use AppHttpControllersPhotoController;

Route::resource('photos', PhotoController::class)->names([
    'create' => 'photos.build'
]);
Comment

all resource routes laravel 8

use AppHttpControllersBlogController;



Route::get('blogs', '[BlogController::class, 'index']');

Route::get('blogs/create', '[BlogController::class, 'create']');

Route::post('blogs', '[BlogController::class, 'store']');

Route::get('blogs/{blog}/edit', '[BlogController::class, 'edit']');

Route::put('blogs/{blog}', '[BlogController::class, 'update']');

Route::get('blogs/{blog}', '[BlogController::class, 'show']');

Route::delete('blogs/{blog}', '[BlogController::class, 'destroy']');
Comment

create laravel 8 resource route

php artisan make:controller PhotoController --model=Photo --resource
Comment

resource route laravel 8

use AppHttpControllersBlogController;
Route::resource('blogs', BlogController::class);
Comment

resource route controller laravel 8

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

class BlogController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return IlluminateHttpResponse
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return IlluminateHttpResponse
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @return IlluminateHttpResponse
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return IlluminateHttpResponse
     */
    public function destroy($id)
    {
        //
    }
}
Comment

Rename route resource in laravel

Route::resource('product', 
    AppHttpControllersAPIAdminProductController::class, [
    'names' => [
        'index' => 'admin.product.index', 
        'store' => 'admin.product.store', 
        'update' => 'admin.product.update', 
        'destroy' => 'admin.product.delete'
    ]
])->except(['edit', 'create']);
Comment

resource route laravel

<?php

use IlluminateSupportFacadesRoute;
use AppHttpControllersProductController;

Route::get('/', function () {
    return view('welcome');
});

Route::resource('product',ProductController::class);
Comment

PREVIOUS NEXT
Code Example
Php :: how to get ip address of client in php 
Php :: file could not be downloaded: Unable to find the wrap per "https" - did you forget to enable it when you configured PHP? failed to open stream: No such file or directory 
Php :: How to disable Gutenberg / block editor for certain post types 
Php :: laravel Service Unavailable 
Php :: in_array php 
Php :: laravel migration alter column unique 
Php :: stdclass not found laravel 
Php :: get_categories not__in 
Php :: redirect back laravel 
Php :: DateTime and Timestamps 
Php :: time function in php 
Php :: concatener 2 variables php 
Php :: wpdb get last query 
Php :: add shortcode in wordpress 
Php :: filter collection (laravel) 
Php :: get previous url symfony 4 in formpage 
Php :: laravel wheredate 
Php :: how to get yearly chart in laravel 
Php :: where in laravel 
Php :: withdefault laravel 
Php :: laravel make model along with its controller and migration file 
Php :: redirect stderr from echo 
Php :: woocommerce change add to cart button text 
Php :: explode example in php 
Php :: laravel blade check if request url matches 
Php :: if acf exists 
Php :: test post request laravel 
Php :: comment php 
Php :: get file size in php 
Php :: php lowercase assoc array 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =