以下の内容はhttps://px-wing.hatenablog.com/entry/2020/10/04/121006より取得しました。


Laravelでモデルを作成して動作確認する

はじめに

モデル

  • Eloquent(エロクエント)とはデータベースとモデルを対応づける機能。
  • ORM/ORマッパー(Object-Relational Mapping)である

モデルファイルの作成

php artisan make:model Category
php artisan make:model Article
php artisan make:model ArticleCategory

tinkerでモデルが動作するか確認する

$ php artisan tinker
Psy Shell v0.10.4 (PHP 7.4.9 — cli) by Justin Hileman
>>> $category = new App\Models\Category;
=> App\Models\Category {#3319}
>>> $category->name = "PHP";
=> "PHP"
>>> $category->save();
=> true
>>> App\Models\Category::all();
=> Illuminate\Database\Eloquent\Collection {#4042
     all: [
       App\Models\Category {#4041
         id: 1,
         name: "PHP",
         created_at: "2020-10-02 23:26:34",
         updated_at: "2020-10-02 23:26:34",
       },
     ],
   }



以上の内容はhttps://px-wing.hatenablog.com/entry/2020/10/04/121006より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14