I have a file called all.blade.php
which goes like this:
@component('admin.layouts.content' , ['title' => 'example file'])
@slot('breadcrumb')
<li class="breadcrumb-item active">Example File</li>
@endslot
...
@endcomponent
@push('scripts')
<script>
Swal.fire({
title: 'Do you want to save the changes?',
showDenyButton: true,
showCancelButton: true,
confirmButtonText: 'Save',
denyButtonText: `Don't save`,
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
Swal.fire('Saved!', '', 'success')
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
})
</script>
@endpush
And here is content.blade.php
:
@extends('admin.master')
@section('content')
{{ $slot }}
@endsection
And this is master.blade.php
:
<!DOCTYPE html>
<html>
<head>
...
@stack('scripts')
</head>
<body>
@yield('content')
</body>
</html>
Now the problem is @push('scripts') ... @endpush
does not work out and not showing the sweet alert message.
So what's going wrong here? How can I solve this issue and call the @component and @push together at a blade?