PHP code example of odannyc / laravel-alertify

1. Go to this page and download the library: Download odannyc/laravel-alertify 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/ */

    

odannyc / laravel-alertify example snippets


alertify()->success("The laravel-alertify package is awesome!");

'providers' => [
    odannyc\Alertify\AlertifyServiceProvider::class,
];

'aliases' => [
    'Alertify' => odannyc\Alertify\Alertify::class,
];

@

/**
 * Update the specified resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function update(Request $request)
{
    alertify()->success('Updated record successfully');
    
    // You can also add multiple alerts!
    alertify('You are awesome!');
    
    return redirect()->back();
}

Alertify::standard('I like alerts')

alertify('this is a standard alert (shows black)');
alertify()->success('this is a success alert (shows green)');
alertify()->error('this is an error alert (shows red)');

alertify('alert 1');
alertify('alert 2');

$alert = alertify('i am an alert');
if ($error) {
    $alert->error();
} else {
    $alert->success();
}

// Show the alert for 5000 milliseconds and then dismisses itself (default: 4000)
alertify('delayed 5 seconds')->delay(5000);

// Alert stays displayed with no timeout
alertify('i stay displayed on the screen')->persistent();

// Alert can be clicked to be dismissed
alertify('i can be clicked to be dismissed')->clickToClose();

// You can position alerts (default: 'top right')
alertify('i am on the bottom left')->position('bottom left');

// You can attach the alert to some other HTML element (default: 'document.body')
alertify('i am displayed on a different parent')->attach('.some-html-accessor')

alertify()->success('i am daisychained')->delay(10000)->clickToClose()->position('bottom right');