2017-02-03 1 views
0

вызова к задержке функции члена() на нуле

Я получаю выше, когда Я вызываю метод уведомления с делом.

Класс нотификации Я получаю данные таблицы заданий в хранилище, но я получаю ошибку при вызове функции задержки элемента на нулевом уровне. можете мне помочь в этом.

use Illuminate\Database\Eloquent\Model; 
use Illuminate\Notifications\Notifiable; 

class User extends Model 
{ 
    // 
    use Notifiable; 
    /** 
    * The database table used by the model. 
    * 
    * @var string 
    */ 
    protected $table = 'user'; 
    /** 
    ..... 
} 

класс уведомления

namespace App\Notifications; 

    use App\Channels\PushChannel; 
    use App\Channels\SmsChannel; 
    use App\Libraries\Helper; 
    use App\Waitlists; 

    use Illuminate\Bus\Queueable; 
    use Illuminate\Notifications\Notification; 
    use Illuminate\Contracts\Queue\ShouldQueue; 
    use Illuminate\Contracts\Broadcasting\ShouldBroadcast; 

    use Illuminate\Queue\SerializesModels; 
    use Illuminate\Queue\InteractsWithQueue; 

    class WaitingPrecall extends Notification implements ShouldBroadcast 
    { 

    use Queueable; 

    /** 
    * Create a new notification instance. 
    * 
    * @return void 
    */ 
    public $message; 
    public $phone; 


    public $deviceGuests; 

    public function _construct() 
    { 

    } 

    /** 
    * Get the notification's delivery channels. 
    * 
    * @param mixed $notifiable 
    * @return array 
    */ 
    public function via($notifiable) 
    { 
     return $this->sendtype==1?[PushChannel::class]: [PushChannel::class,SmsChannel::class]; 
    } 

    /** 
    * Get the mail representation of the notification. 
    * 
    * @param mixed $notifiable 
    * @return \Illuminate\Notifications\Messages\MailMessage 
    */ 

    public function toSms($notifiable) 
    { 
     $data=Helper::send_message($this->smstext,$this->phone); 

     return $data; 
    } 
} 

вызов функции для

$waitPreCall=new WaitingPrecall(); 

.... 
.... 

$guest=User::find($waitDataNew->user->gust_id); 

$guest->notify($waitPreCall)->delay($when);//here i am getting error 

ответ

0

$guest->notify($waitPreCall) возвращается нуль, поэтому вы получаете сообщение об ошибке. Проверьте определение notify(), чтобы узнать, что происходит.

+0

Но функция –

+0

Laravel Конечно, это, и у вас есть исходный код, а также подсказку где искать –

+0

https://laravel.com/docs/5.3/notifications –

Смежные вопросы