Skip to main content

Creating a Laravel project

  • Install compose
  • Create project
composer create-project --prefer-dist laravel/laravel <project-name>
  • Edit .env with database details
  • Install composer dependencies
composer install
  • Run db migrations
php artisan migrate
  • Add breeze (for authentication)
composer require laravel/breeze
  • Install blade (for views)
php artisan breeze:install blade
  • Create a model
php artisan make:model <Model-name> -m
  • Edit the migration
  • Run the migration
php artisan migrate
  • Update the app/Models/<Model> with the fields
class Bookmark extends Model
{
    protected $fillable = ['author', 'url', 'content', 'posted_timestamp'];
}
  • Create a controller
php artisan make:controller Api/<Model-name>Controller --resource --api --model=<Model-name>
  • Create API resource
php artisan make:resource <Model-name>Resource