Minor fixes, coding standards
This commit is contained in:
@@ -25,7 +25,7 @@ class Articles
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Article::orderBy('name','asc')->pluck('name','id')->toArray();
|
||||
return Article::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsWithNature()
|
||||
@@ -78,14 +78,30 @@ class Articles
|
||||
$product_type = $article->product_type;
|
||||
switch ($product_type) {
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$data[] = ['name' => 'Espèces', 'description' => Species::getDescription($article->product->specie_id), 'tags' => Species::getTags($article->product->specie_id)];
|
||||
$data[] = ['name' => 'Variétés', 'description' => $article->product->description, 'tags' => $article->product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Espèces',
|
||||
'description' => Species::getDescription($article->product->specie_id),
|
||||
'tags' => Species::getTags($article->product->specie_id),
|
||||
];
|
||||
$data[] = [
|
||||
'name' => 'Variétés',
|
||||
'description' => $article->product->description,
|
||||
'tags' => $article->product->tags->toArray()
|
||||
];
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$data[] = ['name' => 'Espèces', 'description' => $article->product->description, 'tags' => $article->product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Espèces',
|
||||
'description' => $article->product->description,
|
||||
'tags' => $article->product->tags->toArray()
|
||||
];
|
||||
break;
|
||||
case 'App\Models\Shop\Merchandise':
|
||||
$data[] = ['name' => 'Marchandise', 'description' => $article->product->description, 'tags' => $article->product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Marchandise',
|
||||
'description' => $article->product->description,
|
||||
'tags' => $article->product->tags->toArray(),
|
||||
];
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
@@ -96,16 +112,32 @@ class Articles
|
||||
switch ($product_type) {
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$product = Varieties::get($product_id);
|
||||
$data[] = ['name' => 'Espèces', 'description' => Species::getDescription($product->specie_id), 'tags' => Species::getTags($product->specie_id)];
|
||||
$data[] = ['name' => 'Variétés', 'description' => $product->description, 'tags' => $product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Espèces',
|
||||
'description' => Species::getDescription($product->specie_id),
|
||||
'tags' => Species::getTags($product->specie_id),
|
||||
];
|
||||
$data[] = [
|
||||
'name' => 'Variétés',
|
||||
'description' => $product->description,
|
||||
'tags' => $product->tags->toArray(),
|
||||
];
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$product = Species::get($product_id);
|
||||
$data[] = ['name' => 'Espèces', 'description' => $product->description, 'tags' => $product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Espèces',
|
||||
'description' => $product->description,
|
||||
'tags' => $product->tags->toArray(),
|
||||
];
|
||||
break;
|
||||
case 'App\Models\Shop\Merchandise':
|
||||
$product = Merchandises::get($product_id);
|
||||
$data[] = ['name' => 'Marchandise', 'description' => $product->description, 'tags' => $product->tags->toArray()];
|
||||
$data[] = [
|
||||
'name' => 'Marchandise',
|
||||
'description' => $product->description,
|
||||
'tags' => $product->tags->toArray()
|
||||
];
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
|
||||
@@ -77,7 +77,7 @@ class Categories
|
||||
|
||||
public static function storeImage($category, $file)
|
||||
{
|
||||
return $article->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
||||
return $category->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
||||
}
|
||||
|
||||
public static function getImages($id)
|
||||
|
||||
@@ -38,7 +38,7 @@ class Customers
|
||||
return Customer::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return Customer::find($id)->update($data);
|
||||
|
||||
@@ -33,7 +33,7 @@ class Deliveries
|
||||
return Delivery::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$delivery = self::get($id);
|
||||
@@ -50,5 +50,4 @@ class Deliveries
|
||||
{
|
||||
return self::update(['active' => $active], $id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Invoices
|
||||
return Invoice::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
|
||||
@@ -39,7 +39,7 @@ class Offers
|
||||
return Offer::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -38,7 +38,7 @@ class Orders
|
||||
return Order::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -10,7 +10,7 @@ class Packages
|
||||
public static function getOptions()
|
||||
{
|
||||
return Package::orderBy('value', 'asc')->pluck('value', 'id')->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
@@ -30,7 +30,7 @@ class Packages
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ class Packages
|
||||
return Package::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
$item->update($data);
|
||||
$item->update($data);
|
||||
return $item;
|
||||
}
|
||||
|
||||
@@ -51,5 +51,4 @@ class Packages
|
||||
{
|
||||
return Package::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class PriceListValues
|
||||
return PriceListValue::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -28,7 +28,7 @@ class PriceLists
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return PriceList::pluck('name','id')->toArray();
|
||||
return PriceList::pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
@@ -76,7 +76,7 @@ class PriceLists
|
||||
return PriceList::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -16,7 +16,7 @@ class Prices
|
||||
public static function getByArticle($id)
|
||||
{
|
||||
$data['prices'] = Price::byArticle($id)->notGeneric()->get()->toArray();
|
||||
$data['generics'] = Price::byArticle($id)->generic()->with(['generic.prices','generic.category'])->get()->toArray();
|
||||
$data['generics'] = Price::byArticle($id)->generic()->with(['generic.prices', 'generic.category'])->get()->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class Prices
|
||||
return Price::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -33,7 +33,7 @@ class SaleChannels
|
||||
return SaleChannel::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -29,8 +29,8 @@ class TagGroups
|
||||
$group_tags[$tag->id] = $group->name . ' - ' . $tag->name;
|
||||
}
|
||||
$tags[] = [
|
||||
'label' => $group->name,
|
||||
'options' => $group_tags,
|
||||
'label' => $group->name,
|
||||
'options' => $group_tags,
|
||||
];
|
||||
}
|
||||
return $tags;
|
||||
@@ -63,9 +63,12 @@ class TagGroups
|
||||
return TagGroup::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
return TagGroup::find($id)->update($data);
|
||||
$id = $id ? $id : $data['id'];
|
||||
$model = self::get($id);
|
||||
$model->update($data);
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
|
||||
@@ -33,7 +33,7 @@ class TariffUnities
|
||||
return TariffUnity::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -8,7 +8,7 @@ class Tariffs
|
||||
{
|
||||
public static function autocomplete($str)
|
||||
{
|
||||
$data = Tariff::where('name', 'LIKE', "%${str}%")->orWhere('ref', 'LIKE', "${str}%")->orWhere('code', 'LIKE', "${str}%")->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||
$data = Tariff::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||
$export = [];
|
||||
foreach ($data as $key => $name) {
|
||||
$export[] = ['value' => $key, 'text' => $name];
|
||||
@@ -18,7 +18,7 @@ class Tariffs
|
||||
|
||||
public static function getPrices($id)
|
||||
{
|
||||
return Tariff::with(['price_lists.price_list_values','price_lists.sale_channel'])->find($id);
|
||||
return Tariff::with(['price_lists.price_list_values', 'price_lists.sale_channel'])->find($id);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
@@ -58,7 +58,7 @@ class Tariffs
|
||||
return Tariff::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -12,10 +12,6 @@ use App\Models\Shop\Tax;
|
||||
|
||||
class Taxes
|
||||
{
|
||||
public static function getDatatable()
|
||||
{
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
@@ -44,7 +40,7 @@ class Taxes
|
||||
return Tax::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -43,7 +43,7 @@ class Unities
|
||||
return Unity::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
|
||||
@@ -18,7 +18,7 @@ class Variations
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
$variations = Variation::with(['package','unity'])->get();
|
||||
$variations = Variation::with(['package', 'unity'])->get();
|
||||
foreach ($variations as $variation) {
|
||||
$data[$variation->id] = self::getName($variation);
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class Variations
|
||||
|
||||
public static function getNameByID($id)
|
||||
{
|
||||
return self::getName(sef::getFull($id));
|
||||
return self::getName(self::getFull($id));
|
||||
}
|
||||
|
||||
public static function getName($variation)
|
||||
@@ -48,7 +48,7 @@ class Variations
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
return Variation::with(['package','unity'])->findOrFail($id);
|
||||
return Variation::with(['package', 'unity'])->findOrFail($id);
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
|
||||
Reference in New Issue
Block a user