fix devops error
This commit is contained in:
@@ -4,53 +4,20 @@ namespace App\Repositories\Botanic;
|
||||
|
||||
use App\Exports\Botanic\GenresExport;
|
||||
use App\Models\Botanic\Genre;
|
||||
use App\Traits\Model\Basic;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class Genres
|
||||
{
|
||||
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 get($id)
|
||||
{
|
||||
return Genre::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Genre::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$model = self::get($id);
|
||||
$model->update($data);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Genre::destroy($id);
|
||||
}
|
||||
use Basic;
|
||||
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||
return Excel::download(new GenresExport(), 'genres.xlsx');
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return Genre::query();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user