【Laravel】View Componentsを使い方

今回はView Componentsの紹介です。 コンポーネントとは? Laravelのビューコンポーネント(View Components)は、再利用可能なUI要素を作成し、それをBladeテンプレート内で使用できるようにする仕組みです。これにより、コードの再利用性が高まり、テ ...
【Laravel入門】PHPのsessionについて

今回はPHPのsessionについてです。 sessionとは セッションとは、ユーザーがウェブサイトを訪れてから離れるまでの一連のアクションを追跡・管理するための仕組みです。具体的には、セッションはユーザーごとに一意のIDを割り当て、このIDを使ってユーザーの状態やデータをサー ...
【Laravel】middleware(‘auth:api’)とmiddleware(‘auth’)の違い

今回はmiddleware('auth:api')とmiddleware('auth')の違いの紹介です。 middleware(ミドルウェア)とは? middlewareとは、HTTPリクエストが送られたタイミングで、受信されてからレスポンスが返されるまでの間に実行される処理を ...
【Laravel入門】Laravelのappディレクトリについて構造を理解する【完全保存版】

今回は【Laravel入門】Laravelのappディレクトリについて構造を理解する【完全保存版】です。 Laravelのディレクトリ構造 Console Laravelのアプリでは、オリジナルでコマンドで作ることができます。設定を「Console/Kernel.php」に記述し ...
【Laravel】ログの出力方法とconfig/logging.phpについて理解する

今回はログの出力方法とconfig/logging.phpについて理解の紹介です。 ログの表示のさせ方 Logを表示させる方法です use Illuminate\Support\Facades\Log; Log::info('Laravelアプリ内で表示させたい内容 ...
【Laravel入門】データベースに接続する方法と解説

今回はデータベースに接続する方法と解説の紹介です。 データベースに接続する方法 Laravelでデータベースへ接続するには以下のことを行います。 DBの接続情報の入力 config/database.phpの確認 Modelの作成 マイグレーションの記述 Servic ...
【Laravel入門】interfaceとimplementsについて理解と実装を行う

今回はinterfaceとimplementsについて理解と実装の紹介です。 Interfaceとは? Interface(Interface)とは、クラスが実装すべきメソッドの宣言だけを含む型です。具体的な実装は含まれておらず、メソッドのシグネチャ(名前、引数、返り値の型)だけ ...
【Laravel入門】Modelの作成と書き方

今回はLaravelのModelの作成と書き方の紹介です。 Modelとは? Model(モデル)は、MVC(Model-View-Controller)アーキテクチャの一部であり、アプリケーションのデータを扱う部分を指します。モデルは、データの取得、変更、保存、削除などのデータ ...
【Laravel入門】MVC + S Serviceクラスの書き方!

今回は【Laravel入門】サービスモデルの書き方!MVC + S 居ついての紹介です。 MVC + Sとは? LaravelのMVC(Model-View-Controller) + Serviceの構成のアーキテクチャです。 各項目について説明していきますね。 M:Model ...
【Laravel入門】Laravelのディレクトリ構造を理解する【完全保存版】

application -app -bootstrap -config -database -public -resources -routes -storage -tests -vendor -.env app Laravelアプリケーションの中核部分が含まれるディレクトリです ...