This commit is contained in:
mahdi purHosseini
2024-02-13 11:56:49 +03:30
parent 74f9052df6
commit b7d2c0b920
+8 -3
View File
@@ -31,16 +31,21 @@ class Package extends Model
public function transfersAll()
{
return $this->morphMany( 'App\Transfer' , "transferable" );
return $this->morphMany( 'App\Transfer' , "transferable" )->orderBy("id" , "desc");
}
public function transfers()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED );
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();
}
public function transferActive()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->whereNull( "to_date" );
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->whereNull( "to_date" )->orderBy("id" , "desc");
}
}