Content messages

Notifications

Call the following method on the page, which will call the toastr component and add a floating notification in the top right corner of the page.

admin_toastr('Message...', 'success');

admin_toastr('Message...', 'info');

admin_toastr('Message...', 'warning');

admin_toastr('Message...', 'error');

You can also pass the third parameter and add the options to toastr. For more parameters, refer to toastr

admin_toastr('Message...', 'success', ['timeOut' => 5000]);

Alerts

since v1.5.19

wx20180822-200500

Modified and optimized the the Alert message on the page in the version v1.5.19.


<?php

namespace App\Admin\Controllers;

use Encore\Admin\Layout\Content;
use App\Http\Controllers\Controller;

class PostController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->withError('Title', 'messages..');
    }
}

Add several other types of messages

$content->withWarning('Title', 'messages..');

$content->withInfo('Title', 'messages..');

$content->withSuccess('Title', 'messages..');

You can also use the following functions, the effect is the same

admin_success($title, $message);

admin_warning($title, $message);

admin_error($title, $message);

admin_info($title, $message);