Source: https://github.com/makhweb/blade-x-loader-demo
You can install the package via Composer:
composer require makhweb/blade-x-loader
Assets should be published by this command:
php artisan vendor:publish --provider="Makhweb\BladeXLoader\BladeXLoaderServiceProvider" --tag="publishable"
You should use pjaxLayout([layout]) function when your blade component is extending from other layout.
@extends(fromLayout('main'))
Also you need to include the package's assets. Example (layout.blade.php):
@include('blade-x-loader::assets')
You must create an element with identified id attribute where the package can put html from the request:
<div id="app">
// HTML
</div>
In the finish, you need to add the attribute:
<a href="{{ route('home') }}" ajaxable>Home</a>
Optionally the config file can be published with:
php artisan vendor:publish --provider="Makhweb\BladeXLoader\BladeXLoaderServiceProvider" --tag="config"
You just need to add the cache-for="[seconds]"
attribute to the tag:
<a href="{{ route('home) }}" ajaxable cache-for="60">Home</a>
All data will be stored in localStorage.
Shows when request is pjax
@pjax
<p>This is a pjax request<p>
@endpjax
When you need to check that the request is not ajax, you can use the @notAjax blade directive.
In next releases, we will write tests π
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email eldorbekmakhkamov@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.