9
9

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 5 years have passed since last update.

Laravel5.2で認証機能を最速で作成

Last updated at Posted at 2016-02-25

プロジェクト作成

$ laravel new new_project

プロジェクトを作成したら、プロジェクトに移動

$ cd new_project

DB設定

.envとconfig/database.phpでデータベースを設定する。

.env
DB_HOST=localhost
DB_DATABASE={データベース名}
DB_USERNAME={ユーザーネーム}
DB_PASSWORD={パスワード}
config/database.php
        'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'forge'),
            'username'  => env('DB_USERNAME', 'forge'),
            'password'  => env('DB_PASSWORD', ''),
            'unix_socket'  => '/Applications/MAMP/tmp/mysql/mysql.sock',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
            'engine'    => null,
        ],

MAMPで作成するときは'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',を忘れずに。

管理画面を作成

$ php artisan make:auth

これでいろいろ作成される

マイグレーション

$ php artisan migrate

サーバー起動

$ php artisan serve

http://localhost:8000/homeにアクセスするとログイン画面に遷移するので、最初はユーザー登録から始める。

9
9
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
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?