fix some problems

This commit is contained in:
mahdi purHosseini
2024-03-17 10:49:50 +03:30
parent 3e3735098c
commit 156e30a595
8 changed files with 226 additions and 144 deletions
+9 -9
View File
@@ -7,45 +7,45 @@ use Illuminate\Database\Eloquent\Model;
class Package extends Model
{
public $fillable = [ 'name' , 'user_id' , 'note' , 'status' , 'creator_id' ];
public $fillable = ['name', 'user_id', 'note', 'status', 'creator_id'];
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 items()
{
return $this->hasMany( 'App\Item' );
return $this->hasMany('App\Item');
}
public function labels()
{
return $this->hasMany( 'App\Label' );
return $this->hasMany('App\Label');
}
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");
}
}