Файл: app/Models/Coupon.php
Строк: 23
<?php
namespace AppModels;
use IlluminateDatabaseEloquentBuilder;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentSoftDeletes;
class Coupon extends Model
{
use SoftDeletes;
/**
* @param Builder $query
* @param $value
* @return Builder
*/
public function scopeSearchName(Builder $query, $value)
{
return $query->where('name', 'like', '%' . $value . '%');
}
/**
* @param Builder $query
* @param $value
* @return Builder
*/
public function scopeSearchCode(Builder $query, $value)
{
return $query->where('code', 'like', '%' . $value . '%');
}
/**
* @param Builder $query
* @param $value
* @return Builder
*/
public function scopeOfType(Builder $query, $value)
{
return $query->where('type', '=', $value);
}
}