Hello,
I just want to be able to modify my overlay method ? No one has a solution ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I can display my alerts but I would like to be able to configure them. I managed to trigger an alert when I clicked a button but in my case what I would like is to use animate css with an overlay () alert. It shows up well what I would like is just to make it move according to the options.
Here is what I do :
HomeController
(In the controller I just show the alert because the rest is not used it is just the creation of a graph and I return well the value to the view no worries of that side.) :
public function index()
{
if ($sommePoidsC >= 400){
Alert()->overlay('Warning !', 'The amount is exceeded'! ','warning');
}
}
flash.php :
class Flash
{
public function create($title, $message, $type, $key = 'flash_message')
{
return session()->flash($key, [
'title' => $title,
'message' => $message,
'type' => $type
]);
}
public function overlay($title, $message, $type = 'warning')
{
return $this->create($title, $message, $type, 'flash_message_overlay');
}
}
flash.blade.php (That I created) :
{
@if (session()->has('flash_message_overlay'))
<script type="text/javascript">
swal({
title: "session('flash_message_overlay.title')",
text: "session('flash_message_overlay.message')",
type: "session('flash_message_overlay.type')",
confirmButtonText: 'Ok',
animation: 'false',
customClass: 'animated tada'
});
</script>
@endif
}
And in my view home I do @include ('flash').
Ah yes I forgot to specify that I used laravel 5.3 and that for alerts I use the packet infinety / alerts.
I am inspired by this discussion : https://laracasts.com/discuss/channels/laravel/confirm-delete-using-sweetalert?page=1
Could you help me please ?
Please or to participate in this conversation.