Laravel 8 Tailwind Landing Page with Laragon
— Laragon, Laravel, Tailwind, Guide — 1 min read
You can read the release notes for Laravel 8 here
Let's get started,
- Download the latest laragon from this link and install, my edition is laragon full version 4
- Check the composer version from terminal with this command
composer -V
if the version is not version 2, you need to upgrade it, tutorial is here
- Check the php version, because the minimum PHP version for Laravel 8 is 7.3.0, if you need to add another version, follow this tutorial
- Open "Laragon Menu > Quick App > Laravel"
- Type your project name, and the terminal will be open and install the laravel to laragon directory
- Download tailwind landing page from here and extract to project public folder
- Rename "index.html" to "main.html"
- Go to "project folder > resources > views"
- Create a folder with name "frontend"
- Copy "main.html" from public folder and paste to frontend folder above
- Rename "main.html" to "index.blade.php"
- Go to "project folder > routes" and open "web.php" to your editor
- There is few way to change the routes
- First, change this code below
Route::get('/', function () { return view('welcome');});
to
Route::get('/', function () { return view('frontend/index');});
- And done, you can check the web via pretty url
- Or you can create a controller with this command below, go to project directory and type to the terminal from laragon
php artisan make:controller LandingController
- Go to "project folder > app > Http > Controller" and open "LandingController.php"
- Add this code below
public function index(Request $request) { return view('frontend/index'); }
- After that change this code below
Route::get('/', function () { return view('welcome');});
to
use App\Http\Controllers\LandingController;
Route::get('/',[LandingController::class, 'index']);