'required', 'business_id' => 'required', 'project_id' => 'required', 'original_name' => 'required', 'name' => 'required', 'extension' => 'required', 'size' => 'required', 'description' => 'nullable', ]; } public function user() { return $this->belongsTo(User::class, 'user_id','id','id',__FUNCTION__); } public function business() { return $this->belongsTo(Business::class, 'business_id', 'id', 'id', __FUNCTION__); } public function project() { return $this->belongsTo(Project::class, 'project_id', 'id', 'id', __FUNCTION__); } public function updateRelations() { } public function reportActivity() { } public function getPath() { return $this->business->id . \DIRECTORY_SEPARATOR . $this->project->id . DIRECTORY_SEPARATOR . $this->name; } public function getTemporaryLink() { return Storage::disk('s3')->temporaryUrl( $this->getPath(), \Carbon\Carbon::now()->addMinutes(15), [ 'Content-Type' => $this->mime, 'Content-Disposition' => $this->original_name, ] ); } }