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
+4 -3
View File
@@ -2,11 +2,12 @@
namespace App;
use App\Constants\StatusTypeEnum;
use Illuminate\Database\Eloquent\Model;
class Package extends Model
{
public $fillable = [ 'name' , 'user_id' , 'note' , 'verified' , 'creator_id' ];
public $fillable = [ 'name' , 'user_id' , 'note' , 'status' , 'creator_id' ];
public function user()
{
@@ -30,11 +31,11 @@ class Package extends Model
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" );
}
}