laravel controllers
mvc -> c-> controler
controler is directing traffic between model and view
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
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
Which is correct URI for edit method of resource controller?
Marked Answer : photos/{photo}
Correct Answer : photos/{photo}/edit
Which method is used to assign middleware to the controller action within controller?
Marked Answer : __construct
Correct Answer : middleware
No comments:
Post a Comment