Skip to content

laravel練習用

License

Notifications You must be signed in to change notification settings

yasu-s/laravel-example

Repository files navigation

laravel-example

概要

  • laravel練習用

開発環境について

環境構築

envファイルをコピー

cp .env.example .env

Remote Containers起動

VSCodeのRemote Containersをインストールして、Remote Containersを通常通り起動してください。

初期設定

# パッケージインストール
composer install

# アプリケーションキー生成
php artisan key:generate

# DBマイグレーション
php artisan migrate

# DB初期データ登録
php artisan db:seed

動作確認

サーバー起動

php artisan serve

アクセストークン取得

curl --location --request POST 'localhost:8000/api/login' \
--form 'email="hoge@hoge.com"' \
--form 'password="password"'

ログイン済みユーザーデータ取得

curl --location --request GET 'localhost:8000/api/user' \
--header 'Authorization: Bearer <取得したアクセストークン>

参考URL

メモ

動かない場合、以下の手順を試す。

  • docker/mysql/dataフォルダ内のファイルを削除する。
  • Remote-Containers: Rebuild Container を使用してコンテナをリビルドする。