Laravel Model - Controller And Migration Command
php artisan make:model Flight --m
# Generate a model and a FlightFactory class...
php artisan make:model Flight --factory
php artisan make:model Flight -f
# Generate a model and a FlightSeeder class...
php artisan make:model Flight --seed
php artisan make:model Flight -s
# Generate a model and a FlightController class...
php artisan make:model Flight --controller
php artisan make:model Flight -c
# Generate a model and a migration, factory, seeder, and controller...
php artisan make:model Flight -mfsc
# Generate a model , migration and Controller class...
php artisan make:model Contact -cm
Create controller
php artisan make:controller PhotoController --resource
php artisan make:controller PhotoController --resource --model=Photo
use App\Http\Controllers\PhotoController;
Route::resource('photos', PhotoController::class);
Route::resources([
'photos' => PhotoController::class,
'posts' => PostController::class,
]);
Verb URI Action Route Name
GET /photos index photos.index
GET /photos/create create photos.create
POST /photos store photos.store
GET /photos/{photo} show photos.show
GET /photos/{photo}/edit edit photos.edit
PUT/PATCH /photos/{photo} update photos.update
DELETE /photos/{photo} destroy photos.destroy
migration
php artisan make:migration add_votes_to_users_table --table=users
php artisan make:migration add_additional_coloums_to_product-details_table --table=product-details
$table->dropColumn('votes');
$table->dropColumn(['votes', 'avatar', 'location']);
php artisan make:migration create_product_attributes_table --create=product_attributes
php artisan make:migration create_product-details_table --create=product-details
Comments
Post a Comment