laravel notify() неопределенный метод. как решить....помогите..
Ошибка: - Вызов неопределенного метода stdClass::notify()
Мой код контроллера здесь:
use Illuminate\Http\Request;
use \App\Notifications\ResetLink;
use Auth;
use App\User;
use DB;
use App\Password;
public function forgot(){
return view('forgot');
}
public function forgotPw(Request $request){
if ($user = User::where('email',$request->email)->first()){
DB::table('password_resets')->insert([
'token' => $this->token(),
'email' => $user->email
]);
$pr = DB::table('password_resets')->where('email',$user->email)- >first();
$pr->notify(new ResetLink($pr));
request()->session()->flash('success', "Forgot Link Successfully Sent...");
return redirect('login');
} else {
request()->session()->flash('error', "Forgot Link Not Sent...");
return redirect('forgot');
}
}
Мой код уведомления здесь:
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
класс ResetLink расширяет уведомление { использовать очередь;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
public $pr;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('Click the Button and Reset Password!')
->action('Password Reset', url('/reset'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
Я пытался продержаться 2 часа, но не отправил почту в почтовую ловушку....
Спасибо заранее за помощь мне ..
модель не используется в этой ошибке..@ArtisticPhoenix
хорошо.. @ArtisticPhoenix
$pr->notify(новый ResetLink($pr)); @ArtisticPhoenix
$pr->notify(new ResetLink($pr));$pr является результатом БД, которая представляет собой класс с именем stdClass это действительно базовый базовый класс PHP для случайных массивов, таких как данные. И не имеет этого метода.
Конечно, я просто указал на то, что я видел там, но это выглядело неправильно... Удачи!






вы не можете вызвать метод
notifyнаstdClass, так как у него нет такого метода, отсюда и ошибка.