Today i gonna discuss about mvc model and some about database migration.
i already discussed about mvc in the last lesson. For details about mvc please see Lesson#3.
Link of Lesson#3 [ Ссылка ]
Link of Lesson#2 [ Ссылка ]
Link of Lesson#1 [ Ссылка ]
what is model?
Model: Model represents the data. It could interact with the database. It is considered that the central
component of the mvc pattern is model.
we generally do migration by the command
php artisan make:migration
But we will not use above migration command to migrate today. We will use --migration
or -m flag to create migration at the same time we create model.
php artisan make:model MyModel -m
we create a model named MyModel.
and we create a file in the database/migration folder.
migration file name contains a timestamp, which allows Laravel to determine the order of the migrations.
add this two lines in the migration file
$table-string('name');
$table-string('address');
now pls run the command
php artisan migrate
it will run all of your outstanding migrations. And create necessary table in to mysql database.
Pls see table structure in mysql database
To roll back or undo the latest migration operation, you may use the rollback command.
php artisan migrate:rollback
You can find this video in :
laravel model,
laravel model and migration, laravel migration, laravel create model,
laravel 8 model, laravel tutorial for beginners step by step,
laravel migration mysql, laravel database migration tutorial,
laravel migration tutorial bangla, php artisan make model command,
how to create table in laravel using migration,
laravel model bangla ,laravel tutorial bangla
Lesson#4 - Laravel MVC - Model and Migration
Теги
laravel model banglalaravel tutorial banglalaravel modellaravel model and migrationlaravel migrationlaravel create modellaravel 8 modellaravel tutorial for beginners step by steplaravel migration mysqllaravel database migration tutoriallaravel migration tutorial banglaphp artisan make model commandhow to create table in laravel using migrationlaravel model tutoriallaravel migration tutorialhow to create model in laravellaravel mvcmvcmodel