fix devops error
This commit is contained in:
@@ -3,59 +3,25 @@
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Price;
|
||||
use Yajra\DataTables\DataTables;
|
||||
use App\Traits\Model\Basic;
|
||||
|
||||
class Prices
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function getByArticle($id)
|
||||
{
|
||||
$data['prices'] = Price::byArticle($id)->notGeneric()->get()->toArray();
|
||||
$data['generics'] = Price::byArticle($id)->generic()->with(['generic.prices', 'generic.category'])->get()->toArray();
|
||||
|
||||
return $data;
|
||||
return [
|
||||
'prices' => Price::byArticle($id)->notGeneric()->get()->toArray(),
|
||||
'generics' => Price::byArticle($id)->generic()->with([
|
||||
'generic.prices',
|
||||
'generic.category',
|
||||
])->get()->toArray(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getDatatable()
|
||||
public static function getModel()
|
||||
{
|
||||
$model = Price::orderBy('name');
|
||||
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Price::orderBy('name', 'asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Price::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Price::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
$item->update($data);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Price::destroy($id);
|
||||
return Price::query();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user