当我的用户注册时,我正在尝试发送一封电子邮件给他们,我创建了一个可邮寄的类: <?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class WelcomeMail extends Mailable
我已经在通知中使通知class.when用户日志显示为Welcome.when,我们将通知鞋错误调用发送到字符串 SurveyNotification代码上的成员函数routeNotificationFor()
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\
你可以用Laravel这样的电子邮件发送通知.
<?php
public function toMail($notifiable)
{
$url = url('/invoice/' . $this->invoice->id);
return (new MailMessage)
->greeting('Hello!')
->line('One of your invoices has been paid!')
->action('View
从中的文档中,有两种方法可以接收推送通知。但正如评论所言,只有当用户点击通知时,应用程序才会被触发。
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps
我正在构建一个简单的通知系统。我可以通过Auth::user()->notifications获得登录的用户通知,但我的最终目标是也获取通知所来自的用户信息。
我希望最终的结果是
foreach( Auth::user()->notifications AS $n)
{
echo $n->from->username;
}
目前,这抛出了一个“尝试获取非对象的属性”错误。
通知表;
id
user_id - notification for this user
from_user_id - notification from this user
User.php
我的Laravel认证非常有效。我包括了密码更改功能。更改密码后,除了第一个用户(uid=“1”)外,所有用户都可以正常登录。只有默认的密码哈希才能很好地适用于此用户。对于其他密码哈希,登录尝试失败。我的代码如下:
用户控制器登录
public function postSignin() {
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
return