fix some problems

This commit is contained in:
mahdi purHosseini
2023-12-07 10:00:19 +03:30
parent dc019fec75
commit 1ad766d699
62 changed files with 2160 additions and 1244 deletions
+29 -29
View File
@@ -1,35 +1,35 @@
<?php
namespace App;
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Model;
class Package extends Model
class Package extends Model
{
public $fillable = [ 'name' , 'user_id' , 'note' , 'verified' , 'creator_id' ];
public function user()
{
public $fillable = [ 'name' , 'user_id' , 'note' , 'verified' ];
public function user()
{
return $this->belongsTo( 'App\User' );
}
public function items()
{
return $this->belongsToMany( 'App\Item' , 'item_package' )->withPivot( 'count' );
}
public function labels()
{
return $this->hasMany( 'App\Label' );
}
public function transfers()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" ,"approved" );
}
public function transferActive()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" ,"approved" )->whereNull( "to_date" );
}
return $this->belongsTo( 'App\User' );
}
public function items()
{
return $this->hasMany( 'App\Item' );
}
public function labels()
{
return $this->hasMany( 'App\Label' );
}
public function transfers()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" );
}
public function transferActive()
{
return $this->morphMany( 'App\Transfer' , "transferable" )->where( "status" , "approved" )->whereNull( "to_date" );
}
}