Minor fixes, coding standards

This commit is contained in:
Ludovic CANDELLIER
2021-11-01 00:50:10 +01:00
parent 0d0e4deb16
commit e97f54f126
47 changed files with 133 additions and 114 deletions

View File

@@ -5,7 +5,7 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Kirschbaum\PowerJoins\PowerJoins;
use Kirschbaum\PowerJoins\PowerJoins;
use App\Traits\HasComments;
@@ -31,6 +31,13 @@ class Tariff extends Model
return $this->hasMany(PriceList::class);
}
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}%");
}
public function scopeBySaleChanel($query, $id)
{
return $query->where($this->table . '.sale_channel_id', $id);