Extension for the Livewire
package.
Adds finder for components and extend with:
composer required bfg/livewire
@extends('livewire::document')
@section('head')
<title>Main</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
@endsection
@section('body')
@yield('content')
@endsection
@section('footer')
@endsection
- @turbolinks(false) - Disabling Turbolinks on Specific Links
- @turbolinksEval - Working with Script Elements
- @turbolinksPermanent - Persisting Elements Across Page Loads
- @turbolinksTrackReload - Reloading When Assets Change
- @turbolinksActionReplace - Application Visits
Access:
window.Turbolinks.visit("/edit", { action: "replace" })
Access:
window.Swal.fire('Any fool can use a computer')
Access:
window.Toastr.info('Are you the 6 fingered man?')
Simple Swal access:
class MyComponent extends \Livewire\Component
{
...
public function submit() {
$this->emit('swal', [
'icon' => 'error',
'title' => 'Oops...',
'text' => 'Something went wrong!',
'footer' => '<a href="">Why do I have this issue?</a>'
]);
}
...
}
Swal confirm access:
...
$this->emit('swal:confirm', [
'title' => 'Do you want to save the changes?',
'text' => 'Save changes',
'confirmEvent' => 'livewireEvent', // You livewire event
'confirmParams' => ['user_id' => 1], // You livewire event parameters
]);
...
Swal message access:
...
$this->emit('swal:success', [
'title' => 'Changes saved!',
'text' => 'All you changes is saved'
]);
// Or
$this->emit('swal:success', [ // Can be: success, error, warning, info
'Changes saved!',
'All you changes is saved'
]);
...
Toastr message access:
...
$this->emit('toastr:success', 'Changes saved!');
$this->emit('toastr:success', [ // Can be: success, error, warning, info
'Changes saved!',
'All you changes is saved',
['timeOut' => 5000]
]);
...
Turbolinks visit access:
...
$this->emit('visit', '/edit');
// Or
$this->emit('visit', [
'/edit', ['action' => 'replace']
]);
...
For inject folder you can do this:
Bfg\Livewire\LivewireComponentsFinder::directory('Admin\\Pages', __DIR__.'/../Pages');
LivewireComponentsFinder::directory(string $namespace, string $path);