delete table laravel code example

Example 1: how delete the table in laravel in the commend

php artisan migrate:reset

Example 2: php artisan drop table

php artisan make:migration drop_name_table

Example 3: laravel make model with migration 5.8

php artisan make:model Settings --migration

Example 4: php artisan make :migration with model

php artisan make:model ModelName -a

Example 5: by default null eloquent user data in relationship in laravel 8

# simple handle in blade file 
{{ $post->author->name or 'No author' }}

# Model action 
public function author()
{
    return $this->belongsTo('App\Author')->withDefault();
}

public function author()
{
    return $this->belongsTo('App\Author')->withDefault([
        'name' => 'Guest Author',
    ]);
}