[laravel] Steps of create api of model

 php artisan make:model Blog -mcr


edit migration file


php artisan migrate


edit "routes/api.php" Route::resource('blogs', BlogController::class);


edit Models/Blog.php

protected $fillable = [

        'title',

        'body',

    ];


edit Controller (index,store,show,update,destroy)

留言

此網誌的熱門文章

《Clean Code 2: Vue 3 檔案/資料夾結構》

[Laravel][ATOMIC] DB::transaction, DB::beginTransaction

[laravel 9] rename project