fix status

This commit is contained in:
mahdi purHosseini
2024-01-30 14:35:33 +03:30
parent 761aec8b69
commit 1d6d81a461
15 changed files with 147 additions and 33 deletions
+3 -2
View File
@@ -2,6 +2,7 @@
namespace App;
use App\Constants\StatusTypeEnum;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use App\Services\Media\HasMediaTrait;
@@ -30,12 +31,12 @@ class Item extends Model implements HasMedia
public function transfers()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" );
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED );
}
public function transferActive()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" )->whereNull( "to_date" );
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , StatusTypeEnum::APPROVED )->whereNull( "to_date" );
}
public function registerMediaCollections(): void