小编Ach*_*dja的帖子

Laravel 中的 Eloquent 和数据库身份验证驱动程序有什么区别

在 Laravel 中,在 config/auth.php

我们默认有这个

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],
    // 'users' => [
    //     'driver' => 'database',
    //     'table' => 'users',
    // ],
],
Run Code Online (Sandbox Code Playgroud)

我的问题是这两个驱动程序之间什么区别?如果我将驱动程序更改为database是否意味着我不能再使用 eloquent 了?

php database authentication laravel

3
推荐指数
1
解决办法
2390
查看次数

队列通知laravel 5.3问题

我正在测试这个在laravel 5.3中实现的新通知内容及其优秀,

我有这个通知类,它发送邮件给经过身份验证的用户(当他点击特定路由时),这是默认代码.

通知

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class notifyme extends Notification  implements ShouldQueue
{
    use Queueable;

    public function __construct()
    {
        //
    }
    public function via($notifiable)
    {
        return ['mail'];
    }
    public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->line('The introduction to the notification.')
                    ->action('Notification Action', 'https://laravel.com')
                    ->line('Thank you for using our application!');
    }
Run Code Online (Sandbox Code Playgroud)

这是实例化通知类的控制器函数

public function notifyme()
    {
        $user = Auth::user()

        $user->notify(new notifyme($user));
        //$user->notify((new notifyme($user))->delay(Carbon::now()->addMinutes(10)));

         return redirect('/home');
    }
Run Code Online (Sandbox Code Playgroud)

现在使用ubuntu操作系统,并将我的队列驱动程序设置为同步,这应该在localhost上正常工作 QUEUE_DRIVER="sync"

我开始做一名工人 php artisan queue:work

但终端窗口上没有任何显示页面仍然有点慢(队列不工作) …

php queue ubuntu laravel laravel-5.3

2
推荐指数
1
解决办法
2418
查看次数

标签 统计

laravel ×2

php ×2

authentication ×1

database ×1

laravel-5.3 ×1

queue ×1

ubuntu ×1