Laravel 项目使用 flashy 消息通知
打赏作者

John Howard

如何在右上角显示呢?

JellyBool 回复 John Howard

修改一下 flashy 的 css 样式就应该可以了:

 .flashy {
        font-family: "Source Sans Pro", Arial, sans-serif;
        padding: 11px 30px;
        border-radius: 4px;
        font-weight: 400;
        position: fixed;
        bottom: 20px;// 比如说,这个改成 top: 20px;
        right: 20px;
        font-size: 16px;
        color: #fff;
    }
John Howard 回复 JellyBool

谢谢Jelly,可以了!

chenxin

laracasts/flash
这个也不错哦

chenxin

我有个疑问,你这个是刷新的!那么收藏按钮点击下去是不刷新的,那么后台是以什么形式传到前台显示flash?

jayin 回复 chenxin

同问@JellyBool

JellyBool 回复 jayin

这个的话,你就需要一个 js 的提示库了

假如_丶

有个小疑问,后面消息提示 带 icon图标,怎么才能自定义这个图标么.
比如error想叹号,success想用对号,这个怎么实现呀~~~

JellyBool 回复 假如_丶

在 template 中加入一个 icon 就好了吧:

 <div class="flashy flashy--{ Session::get('flashy_notification.type') }">
        <i class="material-icons { Session::get('flashy_notification.type') }">speaker_notes</i>
        <a href="#" class="flashy__body" target="_blank"></a>
    </div>

根据 { Session::get('flashy_notification.type') } 这个写 css 样式就好了啊。

824286145
   protected function sendLockoutResponse(Request $request)
{
    $seconds = $this->limiter()->availableIn(
        $this->throttleKey($request)
    );

    Flashy::message('Welcome Aboard!', 'http://your-awesome-link.com');

    $message = Lang::get('auth.throttle', ['seconds' => $seconds]);

    return redirect()->back()
        ->withInput($request->only($this->username(), 'remember'))
        ->withErrors([$this->username() => $message]);
}

Route::get(’/’, function () {
return view(‘welcome’);
});

Auth::routes();

Route::get(’/home’, ‘HomeController@index’);
//Route::get(’/captcha/{random}’,‘CaptchaController@captcha’);

//Route::get(’/logout’,‘LoginController@logout’);

Route::get(’/captcha/{config?}’,function(Mews\Captcha\Captcha captcha,captcha,config=‘default’){
return captcha>create(captcha->create(config);
});

<script src="/js/app.js"></script>
@include('flashy::message')
824286145

不显示 消息

824286145

,

测试
,

824286145


       protected function sendLockoutResponse(Request $request)
    {
        $seconds = $this->limiter()->availableIn(
            $this->throttleKey($request)
        );

        Flashy::message('Welcome Aboard!', 'http://your-awesome-link.com');

        $message = Lang::get('auth.throttle', ['seconds' => $seconds]);

        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors([$this->username() => $message]);
    }


Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index');
//Route::get('/captcha/{random}','CaptchaController@captcha');

//Route::get('/logout','LoginController@logout');

Route::get('/captcha/{config?}',function(Mews\Captcha\Captcha $captcha,$config='default'){
    return $captcha->create($config);
});


    <script src="/js/app.js"></script>
    @include('flashy::message')


不显示消息

JellyBool 回复 824286145

保证代码正确的话,看看session 有没有对应的数据吧

824286145 回复 JellyBool

用什么方法看

JellyBool 回复 824286145

return session::all() 试试这样

ouhao

🍋

JellyBool 回复 ouhao

啊哈,这个 emoji 我后期支持一波

jayin

@JellyBool我ajax返回数据,然后loaction.href 这个packagist怎么没用

jayin

关于异步重定向不显示解决方法,重写
##一 自定义赋值

            Session::put('flashy_notification',[
                "message" => "Successful return",
                'url' => '',
                "type" => "success",
            ]);

##二模板里面

  @include('flashy::message')
    <?php
            Session::forget('flashy_notification');
            Session::save();
    ?>

就好了 记得 ## use Session;

RoseEnd

ssdsdsdsd

JellyBool 回复 RoseEnd

这种评论以后就不要发了撒

RoseEnd 回复 JellyBool

不好意思,我发错了,本来想删掉的,结果没删除按钮,下次不会!

wdgwgz

这个 扩展有点老,都 2年了。

JoouA

好厉害的工具,get到了 哈哈

xiaoshen

个人觉得这种通知类型,一般放在前端做会比较好,前端请求,后端返回API数据,然后进一步操作~~;
后端主要数据安全,多级缓存,数据架构;

JellyBool 回复 xiaoshen

可以的,看你的追求和实现呗

xiaoshen 回复 JellyBool

我错了,后面才反应过来,有些场景不是事件驱动,而是服务主动推送的。。。偏向推送类

ZhangqiwuAhri

happy hacking