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 join two tables in laravel 
Php :: insertgetid laravel 8 
Php :: laravel post request search query 
Php :: codeigniter 4 redirect with data 
Php :: laravel search query 
Php :: store fetched data into array php 
Php :: find substring in string php 
Php :: array_key_exists 
Php :: get post by name wordpress 
Php :: laravel query builder get data as array of array 
Php :: laravel checking if a record exists 
Php :: php take picture with mobile camera 
Php :: if browser url is having domain name in it check using php 
Php :: laravel relationship order by 
Php :: php implode keys 
Php :: laravel price database 
Php :: how to get correct file or content mime type using/in php 
Php :: php value to javascript variable laravel blade 
Php :: laravel routing techniques 
Php :: bycrypt password php 
Php :: laravel retry specific failed job 
Php :: create a new project from cli laravel 
Php :: make full laravel model ( with migration, controller and resource ) 
Php :: name of today php 
Php :: laravel: get last id 
Php :: upload multiple files in codeigniter 
Php :: call function in php 
Php :: how to send html table in email body in php 
Php :: ERROR: Could not enable dependency mpm_prefork for php7.4, aborting 
Php :: laravel return response view 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =