$improvements * @property-read int|null $improvements_count * @property-read \App\Models\Client|null $originClient * @property-read \App\Models\Provider|null $originProvider * @property-read \Illuminate\Database\Eloquent\Collection $reviewMedia * @property-read int|null $review_media_count * @property-read \Illuminate\Database\Eloquent\Collection $reviewsImprovements * @property-read int|null $reviews_improvements_count * @property-read \App\Models\Schedule $schedule * @method static \Illuminate\Database\Eloquent\Builder|Review newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Review newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Review onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder|Review query() * @method static \Illuminate\Database\Eloquent\Builder|Review whereComment($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereDeletedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereOrigin($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereOriginId($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereScheduleId($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereStars($value) * @method static \Illuminate\Database\Eloquent\Builder|Review whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Review withTrashed(bool $withTrashed = true) * @method static \Illuminate\Database\Eloquent\Builder|Review withoutTrashed() * @mixin \Eloquent */ class Review extends Model { use HasFactory, SoftDeletes; protected $fillable = [ 'schedule_id', 'origin', 'origin_id', 'stars', 'comment', ]; protected $casts = [ 'stars' => 'decimal:1', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; public function schedule(): BelongsTo { return $this->belongsTo(Schedule::class); } public function originProvider(): BelongsTo { return $this->belongsTo(Provider::class, 'origin_id'); } public function originClient(): BelongsTo { return $this->belongsTo(Client::class, 'origin_id'); } public function reviewsImprovements(): HasMany { return $this->hasMany(ReviewImprovement::class); } public function reviewMedia(): HasMany { return $this->hasMany(ReviewMedia::class); } public function improvements(): BelongsToMany { return $this->belongsToMany( ImprovementType::class, 'reviews_improvements', 'review_id', 'improvement_type_id' )->withTimestamps(); } }