LoginSignup
0
1

More than 3 years have passed since last update.

PHP Laravel 6 おすすめ映画投稿サイト作成過程 1:準備編

Last updated at Posted at 2020-09-23

備忘録としての制作過程を記録

Laravel を実装(バージョン6)

composer create-project --prefer-dist laravel/laravel recommend "6.*"

一部内容の修正

.env

DBはsqliteを使用する。

recommend/.env
DB_CONNECTION=sqlite

app.php

ロケーション等の変更。

recommend/config/app.php
'timezone' => 'Asia/Tokyo',
'locale' => 'ja',
'faker_locale' => 'ja_JP',

DB作成

touch database/database.sqlite

DB関連の資料作成

必要なファイルを一括生成

$ php artisan make:model Models/Recommend -a

テーブル内容を設定

今回は、以下の6項目

カラム
ID
映画タイトル
映画の画像
映画イメージの名前
映画URL
映画概要(空投稿可)
感想(空投稿可) 
recommend/database/migrations/2020_09_23_105017_create_recommends_table.php
public function up()
    {
        Schema::create('recommends', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title');
            $table->string('image_file_name', 100)->nullable();
            $table->string('image_title',100)->nullable();
            $table->string('url');
            $table->string('description')->nullable();
            $table->string('Impressions')->nullable();
            $table->timestamps();
        });
    }

マイグレーション

マイグレーションファイルがデータベースに反映されます。

$ php artisan migrate

autuの実装

以下の作業で、認証に必要なすべてのビューがresources/views/authディレクトリに生成されます。

ルート定義

composer require laravel/ui "^1.0" --dev
php artisan ui vue --auth
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