for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace UniSharp\Uploadable;
use Illuminate\Support\Facades\URL;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Eloquent\Relations\MorphTo;
class File extends Model
{
protected $fillable = ['name', 'mime', 'size', 'path', 'extra'];
public static function boot(): void
parent::boot();
static::deleted(function ($model) {
Storage::delete($model->attributes['path']);
});
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:
someFunctionCall( $firstArgument, $secondArgument, $thirdArgument ); // Closing parenthesis on a new line.
}
public function uploadable(): MorphTo
return $this->morphTo();
public function getPathAttribute(): ?string
if (!array_key_exists('path', $this->attributes)) {
return null;
TRUE
FALSE
NULL
null
return URL::to($this->attributes['path']);
This check marks files that end in a newline character, i.e. an empy line.