0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel私的まとめ

Last updated at Posted at 2021-04-04

Laravel

Laravel 8

概要

テストすることで学習定着すると言ってたので

目的

きわめる

routing

ルーティングとは、URLと、コントローラーなどの対応を指す。
具体的な記述は routes/*.php に記述されている。

nginx設定

きれいなURL を採用するためのnginx設定
 └example.com/a で、aControllerを見に行くための設定

location / {
    index index.php index.htm index.html;
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\/php)(/.+)$;
    fastcgi_pass php-fpm:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
}

.env

環境設定ファイル。DB, memcache, redisなどの設定。
app自体、ログ、AWS、mail、session、pusher も // TODO

migrationファイル作成

artisanでファイルを作成する。 (Flightはサンプルクラス名)

./artisan make:migration Flight [-mfsc]  # -mfsc means migration, factory, seeder, controller

ファイルを編集して、好きなテーブルレイアウトにする

        Schema::create('テーブル', function (Blueprint $table) {
            $table->id();
            $table->string('name', 50);  // 追加
            $table->timestamps();
        });

migration実行

./artisan migrate

migration全戻し

./artisan migrate:reset

model作成

./artisan make:model ${モデル名}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?