laravel5.3开发知乎-第17章-已读通知 laravel5.3开发知乎-第17章-已读通知

2023-07-24

一、修改样式

修改 resources/assets/css/style.css

.notifications {
   position: relative;
   padding: 8px 15px 8px 25px;
   color: #666;
   border: none;
   border-top: 1px dotted #eee;
   background: transparent;
}

.notifications.unread {
   background: #fff9ea !important;
}

执行 gulp

gulp

二、修改视图

修改 resources/views/notifications/new_message_notification.blade.php

https://file.lulublog.cn/images/3/2023/07/Q90Fs1XdF7YO09O1rY7b7780x77o2I.jpg

三、注册路由

修改 routes/web.php

Route::get('notifications/{notification}', 'NotificationsController@show');

修改 app/Http/Controllers/NotificationsController.php

use Illuminate\Notifications\DatabaseNotification;

public function show(DatabaseNotification $notification)
{
   $notification->markAsRead();
   return redirect(request()->get('redirect_url'));
}

访问:http://127.0.0.1:8000/notifications 进行测试。

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开微信扫一扫,即可进行扫码打赏哦

阅读 238