add shipping rules
This commit is contained in:
@@ -2,25 +2,24 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Kirschbaum\PowerJoins\PowerJoins;
|
||||
|
||||
use App\Traits\Model\HasComments;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kirschbaum\PowerJoins\PowerJoins;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Tariff extends Model
|
||||
{
|
||||
use HasComments, HasRelationships, PowerJoins;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $table = 'shop_tariffs';
|
||||
|
||||
public function offers()
|
||||
{
|
||||
return $this->hasMany(Offer::class);
|
||||
}
|
||||
|
||||
|
||||
public function sale_channel()
|
||||
{
|
||||
return $this->belongsTo(SaleChannel::class);
|
||||
@@ -48,9 +47,9 @@ class Tariff extends Model
|
||||
|
||||
public function scopeByAutocomplete($query, $str)
|
||||
{
|
||||
return $query->where($this->table . '.name', 'LIKE', "%${str}%")
|
||||
->orWhere($this->table . '.ref', 'LIKE', "${str}%")
|
||||
->orWhere($this->table . '.code', 'LIKE', "${str}%");
|
||||
return $query->where($this->table.'.name', 'LIKE', "%${str}%")
|
||||
->orWhere($this->table.'.ref', 'LIKE', "${str}%")
|
||||
->orWhere($this->table.'.code', 'LIKE', "${str}%");
|
||||
}
|
||||
|
||||
public function scopeBySaleChannel($query, $id)
|
||||
@@ -62,12 +61,12 @@ class Tariff extends Model
|
||||
|
||||
public function scopeBySaleChannelDefault($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.sale_channel_id', $id);
|
||||
return $query->where($this->table.'.sale_channel_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByStatus($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.status_id', $id);
|
||||
return $query->where($this->table.'.status_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByOffer($query, $id)
|
||||
|
||||
Reference in New Issue
Block a user