add shipping rules
This commit is contained in:
@@ -2,21 +2,17 @@
|
||||
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
use App\Models\Botanic\Family;
|
||||
use App\Exports\Botanic\FamiliesExport;
|
||||
use App\Models\Botanic\Family;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class Families
|
||||
{
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Family::orderBy('name');
|
||||
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
@@ -39,6 +35,7 @@ class Families
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
@@ -52,6 +49,7 @@ class Families
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
$item->update($data);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
use App\Models\Botanic\Genre;
|
||||
use App\Exports\Botanic\GenresExport;
|
||||
use App\Models\Botanic\Genre;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class Genres
|
||||
{
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Genre::get()->SortBy('name')->pluck('name', 'id')->toArray();
|
||||
@@ -28,6 +26,7 @@ class Genres
|
||||
public static function store($data)
|
||||
{
|
||||
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
@@ -41,6 +40,7 @@ class Genres
|
||||
$id = $id ? $id : $data['id'];
|
||||
$model = self::get($id);
|
||||
$model->update($data);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
use App\Repositories\Core\Tag;
|
||||
use App\Models\Botanic\Specie;
|
||||
use App\Exports\Botanic\SpeciesExport;
|
||||
use App\Models\Botanic\Specie;
|
||||
use App\Repositories\Core\Tag;
|
||||
use App\Traits\Repository\Imageable;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class Species
|
||||
{
|
||||
@@ -33,6 +30,7 @@ class Species
|
||||
public static function getTags($id)
|
||||
{
|
||||
$model = self::get($id) ?? false;
|
||||
|
||||
return $model ? $model->tags->toArray() : false;
|
||||
}
|
||||
|
||||
@@ -41,6 +39,7 @@ class Species
|
||||
$specie = self::get($id);
|
||||
$data = $specie->toArray();
|
||||
$data['tags'] = self::getTagsBySpecie($specie);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -49,7 +48,6 @@ class Species
|
||||
return Tag::getTagsByModel($specie);
|
||||
}
|
||||
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Specie::with('tags.tag_group')->find($id);
|
||||
@@ -64,6 +62,7 @@ class Species
|
||||
$specie = self::store($data);
|
||||
self::storeImages($specie, $images);
|
||||
self::storeTags($specie, $tags);
|
||||
|
||||
return $specie;
|
||||
}
|
||||
|
||||
@@ -82,6 +81,7 @@ class Species
|
||||
$id = $id ? $id : $data['id'];
|
||||
$model = self::get($id);
|
||||
$ret = $model->update($data);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
use App\Repositories\Core\Tag;
|
||||
use App\Models\Botanic\Variety;
|
||||
use App\Exports\Botanic\VarietiesExport;
|
||||
use App\Models\Botanic\Variety;
|
||||
use App\Repositories\Core\Tag;
|
||||
use App\Traits\Repository\Imageable;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class Varieties
|
||||
{
|
||||
@@ -25,9 +22,10 @@ class Varieties
|
||||
$varieties = Variety::with('specie')->get();
|
||||
$data = [];
|
||||
foreach ($varieties as $variety) {
|
||||
$data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name;
|
||||
$data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name.' ' : '').$variety->name;
|
||||
}
|
||||
asort($data, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -56,6 +54,7 @@ class Varieties
|
||||
$variety = self::get($id);
|
||||
$data = $variety->toArray();
|
||||
$data['tags'] = self::getTagsByVariety($variety);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -73,6 +72,7 @@ class Varieties
|
||||
$variety = self::store($data);
|
||||
self::storeImages($variety, $images);
|
||||
self::storeTags($variety, $tags);
|
||||
|
||||
return $variety;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ class Varieties
|
||||
$id = $id ? $id : $data['id'];
|
||||
$variety = self::get($id);
|
||||
$ret = $variety->update($data);
|
||||
|
||||
return $variety;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user