39 lines
842 B
PHP
39 lines
842 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Shop;
|
|
|
|
use App\Models\Shop\Delivery;
|
|
use App\Traits\Model\Basic;
|
|
|
|
class Deliveries
|
|
{
|
|
use Basic;
|
|
|
|
public static function getOptions()
|
|
{
|
|
return Delivery::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
|
}
|
|
|
|
public static function getAll($relations = false)
|
|
{
|
|
$model = $relations ? Delivery::with($relations) : Delivery::query();
|
|
|
|
return $model->orderBy('name', 'asc')->get();
|
|
}
|
|
|
|
public static function getAllWithSaleChannel()
|
|
{
|
|
return Delivery::orderBy('name', 'asc')->active()->public()->with('sale_channel')->get();
|
|
}
|
|
|
|
public static function toggle_active($id, $active)
|
|
{
|
|
return self::update(['active' => $active], $id);
|
|
}
|
|
|
|
public static function getModel()
|
|
{
|
|
return Delivery::query();
|
|
}
|
|
}
|