laravel new trying-splade
cd trying-splade
composer require protonemedia/laravel-splade
php artisan splade:install
npm install
Run dev servers:
npm run dev
php artisan serv
composer require elaborate-code/laravel-algerian-provinces
// routes\web.php
use ElaborateCode\AlgerianProvinces\Models\Wilaya;
use Illuminate\Support\Facades\Route;
use ProtoneMedia\Splade\SpladeTable;
Route::get('/', function () {
$wilayas = Wilaya::paginate(10);
return view('home')
->with(
'wilayas',
SpladeTable::for($wilayas)
->column('id')
->column('fr_name')
->column('ar_name')
);
})
->middleware(['splade'])
->name('home');
<!-- resources\views\home.blade.php -->
<x-layout>
<x-slot name="header"> {{ __('Home') }} </x-slot>
<x-panel class="flex flex-col items-center pt-16 pb-16">
<x-application-logo class="block h-12 w-auto" />
<div class="mt-8 text-2xl">
<x-splade-table :for="$wilayas" />
</div>
</x-panel>
</x-layout>
On http://127.0.0.1:8000/?page=4