Fixes on unities, remove old code
This commit is contained in:
@@ -25,7 +25,7 @@ class Packages
|
||||
|
||||
public static function getSelectByFamily($family_id)
|
||||
{
|
||||
return Package::orderBy('value','asc')->byFamily($family_id)->pluck('value','id')->toArray();
|
||||
return Package::orderBy('value','asc')->byArticleFamily($family_id)->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
|
||||
@@ -2,68 +2,51 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Unity;
|
||||
|
||||
class Unities
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
public static function getOptions()
|
||||
{
|
||||
return Unity::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Unity::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
public static function getOptionsByPackage($package_id)
|
||||
{
|
||||
return Unity::byPackage($package_id)->orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getSelectByPackage($package_id)
|
||||
{
|
||||
$values = Unity::byPackage($package_id)->get();
|
||||
$data = [];
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$data[] = ['id' => $value->id, 'text' => $value->value];
|
||||
}
|
||||
return collect($data)->sortBy('text')->values()->all();
|
||||
}
|
||||
public static function getAll()
|
||||
{
|
||||
return Unity::orderBy('value','asc')->get();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Unity::orderBy('value','asc')->get();
|
||||
}
|
||||
public static function get($id)
|
||||
{
|
||||
return Unity::find($id);
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Unity::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 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 Unity::create($data);
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Unity::create($data);
|
||||
}
|
||||
public static function update($data)
|
||||
{
|
||||
return Unity::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Unity::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Unity::destroy($id);
|
||||
}
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Unity::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user