belongsTo( 'App\Package' ); } public function user() { return $this->belongsTo( 'App\User' ); } public function creator() { return $this->belongsTo( 'App\User' , "creator_id" ); } public function transfers() { return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" ); } public function transferActive() { return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" )->whereNull( "to_date" ); } public function registerMediaCollections() { $this->addMediaCollection( 'main_images' ) ->useFallbackUrl( '/images/default_pastry.jpg' ) ->useFallbackPath( public_path( '/images/default_pastry.jpg' ) ); } public function registerMediaConversions( Media $media = null ): void { $this->addMediaConversion( 'thumbnail' ) ->width( 480 ) ->height( 640 ) ->nonQueued() ->performOnCollections( 'main_images' ); } }