Edit File: FriendReport.php
<?php namespace App\Models; use App\Jobs\SendAdminNotification; use App\Notifications\FriendReportNotification; use Illuminate\Database\Eloquent\Relations\{BelongsTo, MorphTo}; use App\Traits\ModelTrait; class FriendReport extends BaseModel { use ModelTrait; const IMAGEPATH = 'friend_reports'; protected $fillable = [ 'image', 'user_id', 'reportable_id', 'reportable_type', 'reason', ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function reportable(): MorphTo { return $this->morphTo(); } public static function boot() { parent::boot(); static::created(function ($model) { $user = $model->user; SendAdminNotification::dispatchAfterResponse( $model, FriendReportNotification::class, 'بلاغ جديد من قبل ' . $user->full_name, 'A New Report Message From ' . $user->full_name, $model->reason, $model->reason, 'new_report', ); }); } }
Back to File Manager