Published on September 10, 2020

Bagaimana cara pakek Laravel UI dengan Laravel 8

Lakukan dulu semua ini.

$ laravel --version (4.0.3)
$ laravel new l8-auth
$ cd l8-auth
$ l8-auth > composer require laravel/ui
$ l8-auth > artisan ui react --auth
$ l8-auth > npm install && npm run dev

Buat database baru dengan nama l8auth dan buka file .env ganti nama databasenya jadi DB_DATABASE=l8auth Kemudian silahkan Migrate

l8-auth > migrate

Setelah itu, buka web.php

<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;

Route::view('/','welcome');

Auth::routes();

Route::get('/home', [HomeController::class, 'index'])->name('home');

Belum selesai ? Belum dong, buka RegisterController yang ada di l8-auth/app/Http/Controllers/Auth/RegisterController.php dan import User model dengan benar, karena default nya pasti use App\User; dan ganti jadi use App\Models\User.

// before
// use App\User

// After
use App\Models\User

You're done.

Login to make a comments. Don't worry, it's free.
© 2020 Irsyad Notes