mercredi 1 août 2018

(2/2) QueryException Laravel 5.4

please i need help, i am trying to create notifications, while saving into the notifications table i got an error:

(2/2) QueryException

Array to string conversion (SQL: insert into notifications (id, type, data, read_at, notifiable_id, updated_at, created_at) values (73249480-4789-4cdf-b6d7-7bfa64638ef9, App\Notifications\NotifyNewMessage, 28, , 1, 2018-08-02 03:46:38, 2018-08-02 03:46:38))

my code is as below:

namespace App;

use Illuminate\Database\Eloquent\Model;

class Notification extends Model
{
    protected $fillable = ['id', 'type', 'notifiable_id', 'notifiable_type', 'data', 'read_at', 'created_at', 'updated_at'];

    public function user(){
        return $this->belongsTo('App\User');
    }
}

then my message controller looks like this:

foreach($users as $user){
     $user->notify(new NotifyNewMessage($message));
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire