Skip to content

Files

Latest commit

 

History

History
102 lines (95 loc) · 2.22 KB

eloquent.md

File metadata and controls

102 lines (95 loc) · 2.22 KB

Eloquent

Install Dependency

  • Install Eloquent
php laragram install:eloquent
  • Remove Eloquent
php laragram remove:eloquent

Query

  • learn to work with Eloquent and Laravel query builder Use the following links:

Eloquent -- Queries


Model

php laragram make:model {model_name}
php laragram make:model User

Migration

  • Create new table
php laragram make:migration {migration_name} --create={table_name}
php laragram make:migration create_users_table --create=users
  • Edit table
php laragram make:migration {migration_name} --table={table_name}
php laragram make:migration edit_users_table --table=users

Note:

  • Note that the names of the migrations should be similar to the example above > create_{table_name}_table > edit_{table_name}_table
  • The table_name must be plural (users, addresses)
  1. Build a migration
  2. Open the created file ( path: Database/Mysql/Migrations/ )
  3. Start writing ( An example has been created for you )
  • It is better to learn to work with Eloquent and Laravel query builder Use the following links:

Eloquent -- Queries


Migrate

php laragram migrate

Factory

php laragram make:factory {factory_name}
php laragram make:factory User
  • It is better to learn to work with Factory Use the following links:

Eloquent Factory


Seeder

php laragram make:seeder {seeder_name}
php laragram make:seeder User
  • It is better to learn to work with Seeder Use the following links:

Database Seeding


Start seeding

php laragram db:seed --seeder={seeder_name}
php laragram db:seed --seeder=User