Today I was working on a new daily log application and I needed to install Media Library, but wanted to start fresh with the React Front End and a new install of Laravel 10. My previous tutorials had too much informatin and I needed something very simple and basic, so I took these 7 steps to make it work:
Source: /g/xampp8/htdocs/DailyLog/DailyLogV3
1. Start by creating a new application$ laravel new DailyLogV3
$ cd DailyLogV3
$ code .
2. Update .env file
changed in .env:
#STARTING A NEW DB
DB_DATABASE=laravel_dailylogv3
#THE :8000 IS NEEDED FOR MEDIA LIBRARY PUBLIC URL
APP_URL=http://localhost:8000
3. Optional
#CLEAR FOR FRONTEND LOGIN AUTHENTICATION IF NEEDED
cleared Storage >> Local Storage from Console
4. Api Routes$ code routes/api.php
ADD:
use App\Http\Controllers\Api\AuthController;
....
Route::middleware('auth:sanctum')->group(function () {
Route::post('/logout', [AuthController::class, 'logout']);
Route::get('/user', function (Request $request) {
return $request->user();
});
});
Route::post('/signup', [AuthController::class, 'signup']);
Route::post('/login', [AuthController::class, 'login']);
5. Download Zip files containing needed files - Copy paste:
1. App\Http\Controllers\Api (folder)
2. App\Http\Requests\ (folder)
(if folder already exists, you only need: LoginRequest.php & SignupRequest.php);
6. MIGRATE:$ php artisan migrate
Would you like to create it? (yes/no) [no] yes
7. RUN SERVER:$ php artisan serve
8. Try to register and login with Front End Application:
Example: /g/xampp8/htdocs/DailyLog/REACT/react-dailylogv1
SHOULD WORK!
NOTE: at this point, i did not change cors.php