почему такой код не добавляет в конечный notification поле parsed_created_at ? .
Ретурнится все что получено с БД кроме моих изменений (добавления поля parsed_created_at)
namespace App\Events;
use App\Notification;
use Jenssegers\Date\Date;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class NewNotification implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $user_id;
public $notification;
public function __construct($user_id, $notification_id)
{
$this->user_id = $user_id;
$notification = Notification::find($notification_id);
$notification->parsed_created_at = Date::parse($notification['created_at'])->format('d F в H:i');
$this->notification = $notification;
}
public function broadcastOn()
{
return new PrivateChannel('notification.' . $this->user_id);
}
public function broadcastWith()
{
return [
'success' => true,
'notification' => $this->notification
];
}
}