PHP code example of mhmiton / laravel-flashify

1. Go to this page and download the library: Download mhmiton/laravel-flashify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mhmiton / laravel-flashify example snippets


flashify('Created', 'Data has been created successfully.');

flashify('Created', 'Data has been created successfully.', 'success', []);

flashify()
    ->plugin('swal')
    ->title('Created')
    ->text('Data has been created successfully.')
    ->type('success')
    ->fire();

flashify([
    'plugin' => 'izi-toast',
    'title' => 'Updated',
    'text' => 'Data has been updated successfully.',
    'type' => 'success',
]);

redirect()
    ->route('name')
    ->flashify('Created', 'Data has been created successfully.');

flashify()
    ->plugin('swal')
    ->title('Created')
    ->text('Data has been created successfully.')
    ->type('success')
    ->livewire($this)
    ->fire();

flashify([
    'plugin' => 'izi-toast',
    'title' => 'Updated',
    'text' => 'Data has been updated successfully.',
    'type' => 'success',
    'livewire' => $this,
]);

'presets' => [
    'created' => [
        'plugin'  => 'swal',
        'title'   => 'Created',
        'text'    => 'Data has been created successfully.',
        'type'    => 'success',
        'options' => [],
    ],
],

flashify('created');

flashify()->fire('created');

flashify([
    'preset' => 'created',
]);

redirect()
    ->route('name')
    ->flashify('created');

flashify()->livewire($this)->fire('created');

flashify([
    'preset' => 'created',
    'livewire' => $this,
]);

/*
|--------------------------------------------------------------------------
| Plugin Configurations
|--------------------------------------------------------------------------
|
| Sweetalert2 plugin is used by default.
|
| Supported Plugin: 'swal', 'izi-toast'
|
*/

'plugin' => 'swal',

/*
|--------------------------------------------------------------------------
| Auto-inject Plugin Assets
|--------------------------------------------------------------------------
|
| This configuration option controls whether or not to auto-inject plugin assets.
|
| By default, auto-inject is enabled.
|
| When auto-inject is enabled, the package will automatically inject the necessary
| JavaScript and CSS for plugins.
|
*/

'inject_plugins' => true,

/*
|--------------------------------------------------------------------------
| Auto Translation For The Title and Text
|--------------------------------------------------------------------------
|
| Auto Translation is enabled by default.
|
| If the trans value is true, it will be use laravel lang helper __()
| for the title and text.
|
*/

'trans' => true,

/*
|--------------------------------------------------------------------------
| Preset Messages
|--------------------------------------------------------------------------
|
| Define preset messages that will be reused.
|   ---> plugin => 'plugin'
|   ---> title => 'Message Title'
|   ---> text => 'Message Text'
|   ---> type => 'success|info|warning|error' (as per plugin)
|   ---> options => {Plugin Options}
|
*/

'presets' => [
    'created' => [
        'plugin'  => 'swal',
        'title'   => 'Created',
        'text'    => 'Data has been created successfully.',
        'type'    => 'success',
        'options' => [],
    ],

    .....
]

php artisan vendor:publish --tag=flashify-config

php artisan vendor:publish --tag=flashify-views