定制 odannyc/laravel-alertify 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

odannyc/laravel-alertify

最新稳定版本:1.0.0

Composer 安装命令:

composer require odannyc/laravel-alertify

包简介

An alertify package for Laravel

README 文档

README

An alerts library for Laravel using alertify

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

laravel-alertify

Installation

This package uses composer, so require it like so:

composer require odannyc/laravel-alertify

You'll also need to pull in the alertify.js project. This is located here: https://alertifyjs.org/

You can use NPM:

npm install --save alertify.js

Or include the CDN version of it in your app.blade.php template. (File may vary on your Laravel installation):

<script src="https://cdn.rawgit.com/alertifyjs/alertify.js/v1.0.10/dist/js/alertify.js"></script>

Include the service provider in config/app.php:

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

Also, include the Alias in config/app.php

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

Then, in the template of your Laravel installation, include the view anywhere in the body of your HTML:

@include('alertify::alertify')

Usage

Make sure you include alertify.js prior to using this package. (See installation instructions above)

You can call the alertify() helper function before returning/redirecting to a view:

/**
 * 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();
}

You can either use the alertify() helper or use the static Facade:

Alertify::standard('I like alerts')

There are 3 types of alerts:

laravel-alertify

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)');

You can also show multiple alerts by calling that function multiple times:

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

You can save the alert and edit it based on logic:

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

There's many options you can add per alert:

// 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')

You can also daisy chain options:

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

统计信息

  • 总下载量: 6.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-07-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固