mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-12 00:31:06 +03:30
feat: install phpstan and resolving reported errors in PHPStan
This commit is contained in:
+17
-13
@@ -3,55 +3,56 @@
|
||||
namespace App;
|
||||
|
||||
use App\Constants\StatusTypeEnum;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use App\Services\Media\HasMediaTrait;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Image\Exceptions\InvalidManipulation;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
class Item extends Model implements HasMedia
|
||||
{
|
||||
use HasMediaTrait;
|
||||
|
||||
public $fillable = [ 'name' , 'size' , 'unique_id' , 'specific' , 'note' , 'user_id' , 'udi' , 'status' , 'repair' , 'package_id' , 'creator_id' ];
|
||||
public $fillable = ['name', 'size', 'unique_id', 'specific', 'note', 'user_id', 'udi', 'status', 'repair', 'package_id', 'creator_id'];
|
||||
|
||||
public function scopeIsNotRepaired($query)
|
||||
{
|
||||
return $query->where( 'repair' , 0 );
|
||||
return $query->where('repair', 0);
|
||||
}
|
||||
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo( 'App\Package' );
|
||||
return $this->belongsTo('App\Package');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo( 'App\User' );
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo( 'App\User' , "creator_id" );
|
||||
return $this->belongsTo('App\User', "creator_id");
|
||||
}
|
||||
|
||||
public function transfersAll()
|
||||
{
|
||||
return $this->morphMany( 'App\Transfer' , "transferable" )->orderBy("id" , "desc");
|
||||
return $this->morphMany('App\Transfer', "transferable")->orderBy("id", "desc");
|
||||
}
|
||||
|
||||
public function transfers()
|
||||
{
|
||||
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->orderBy("id" , "desc");
|
||||
return $this->morphMany('App\Transfer', "transferable")->where("status", StatusTypeEnum::APPROVED)->orderBy("id", "desc");
|
||||
}
|
||||
|
||||
public function latestTransfer()
|
||||
{
|
||||
return $this->morphOne( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->orderBy("id" , "desc")->latest();
|
||||
return $this->morphOne('App\Transfer', "transferable")->where("status", StatusTypeEnum::APPROVED)->orderBy("id", "desc")->latest();
|
||||
}
|
||||
|
||||
public function transferActive()
|
||||
{
|
||||
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->whereNull( "to_date" )->orderBy("id" , "desc");
|
||||
return $this->morphMany('App\Transfer', "transferable")->where("status", StatusTypeEnum::APPROVED)->whereNull("to_date")->orderBy("id", "desc");
|
||||
}
|
||||
|
||||
public function registerMediaCollections(): void
|
||||
@@ -61,7 +62,10 @@ class Item extends Model implements HasMedia
|
||||
->useFallbackPath(public_path('/files/default_pastry.jpg'));
|
||||
}
|
||||
|
||||
public function registerMediaConversions( Media $media = null )
|
||||
/**
|
||||
* @throws InvalidManipulation
|
||||
*/
|
||||
public function registerMediaConversions(Media $media = null): void
|
||||
{
|
||||
$this->addMediaConversion('thumbnail')
|
||||
->width(480)
|
||||
|
||||
Reference in New Issue
Block a user