[WIP] Refactor project
This commit is contained in:
@@ -15,51 +15,52 @@ use App\Exports\Botanic\GenresExport;
|
||||
class Genres
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Genre::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Genre::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Genre::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
public static function getOptions()
|
||||
{
|
||||
return Genre::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Genre::orderBy('name','asc')->get();
|
||||
}
|
||||
public static function getAll()
|
||||
{
|
||||
return Genre::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Genre::find($id);
|
||||
}
|
||||
public static function get($id)
|
||||
{
|
||||
return Genre::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, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Genre::create($data);
|
||||
}
|
||||
public static function create($data)
|
||||
{
|
||||
return Genre::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Genre::find($id)->update($data);
|
||||
}
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Genre::destroy($id);
|
||||
}
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Genre::destroy($id);
|
||||
}
|
||||
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||
}
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user