[WIP] Add some features, categories, articles

This commit is contained in:
Ludovic CANDELLIER
2020-04-27 00:37:20 +02:00
parent 516ec2232e
commit 07eccc337b
43 changed files with 1045 additions and 77 deletions

View File

@@ -22,7 +22,7 @@ class Species
public static function getOptions()
{
return Specie::get()->SortBy('name')->pluck('name','id')->toArray();
}
}
public static function getAll()
{

View File

@@ -19,6 +19,22 @@ class Varieties
return Datatables::of($model)->make(true);
}
public static function getOptions()
{
return Variety::orderBy('name')->get()->pluck('name','id')->toArray();
}
public static function getOptionsWithSpecie()
{
$varieties = Variety::with('specie')->get();
$data = [];
foreach ($varieties as $variety)
{
$data[] = ['id' => $variety->id, 'text' => (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name];
}
return collect($data)->sortBy('text')->values()->all();
}
public static function getAll()
{
return Variety::orderBy('name','asc')->get();