laravel controllers

 laravel controllers

mvc -> c-> controler



controler is directing traffic between model and view




namespace-> it alowws is u to reuse function names and classes accross multiple portions of ana application

if we wwanna use this namespace in any other controller, we use this name space

use -> import the clas of current file-> import libraries
php artisan make:controller controller_name --resource



index, create,edit,store,update,delete




Route::resource('payment', PaymentController::class,['names' => 'payment']);

Route::get('/user-membership', [PackageController::class, 'user_membership'])->name('user-membership');
Route::view('/index', 'admin.dashboard')->name('dashboard');

Route::match(['put', 'patch'], '/profile/update/{id}',[UiController::class, 'profile_update'])->name('profile_update');


url/resuource/123


php artisan route::list

Route::resource('wishlist', WishlistController::class)->only('index',;show','store');

Route::resource('wishlist', WishlistController::class)->except('index');

function means return some thing

oute::resource('wishlist', WishlistController::class)->name(['index'=>'resource.listing']);


laravel controller assignment

get the parameter value into controller

By default, controllers are stored in _____ directory.

Marked Answer : app/Http/Controllers


Which option is used to generate resource controller with artisan command?

Marked Answer : "--resource"


How many methods are generate in resource controller?

Marked Answer : 7

  1. Which is correct URI for edit method of resource controller?

    Marked Answer : photos/{photo}

    Correct Answer : photos/{photo}/edit


  1. Which method is used to assign middleware to the controller action within controller?

    Marked Answer : __construct

    Correct Answer : middleware


No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...