This commit is contained in:
Ludovic CANDELLIER
2021-09-09 00:03:24 +02:00
parent a1a3ccb227
commit 290602057a
22 changed files with 183 additions and 38 deletions

View File

@@ -16,7 +16,7 @@ use Kirschbaum\PowerJoins\PowerJoins;
use Wildside\Userstamps\Userstamps;
class Variety extends Model implements HasMedia
{
use InteractsWithMedia, PowerJoins, Taggable, SoftDeletes, UserStamps;
use InteractsWithMedia, PowerJoins, SoftDeletes, Taggable, UserStamps;
protected $guarded = ['id'];
protected $table = 'botanic_varieties';

View File

@@ -6,9 +6,11 @@ use Illuminate\Database\Eloquent\Model;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use BeyondCode\Comments\Traits\HasComments;
use Kirschbaum\PowerJoins\PowerJoins;
class Tariff extends Model
{
use HasComments, HasRelationships;
use HasComments, HasRelationships, PowerJoins;
protected $guarded = ['id'];
protected $table = 'shop_tariffs';
@@ -27,4 +29,14 @@ class Tariff extends Model
{
return $this->hasMany('App\Models\Shop\PriceList');
}
public function scopeBySaleChanel($query, $id)
{
return $query->where($this->table . '.sale_channel_id', $id);
}
public function scopeByStatus($query, $id)
{
return $query->where($this->table . '.status_id', $id);
}
}