coding style

This commit is contained in:
ludo
2024-02-22 19:35:51 +01:00
parent 722ea43bc2
commit 64a218afc2
33 changed files with 54 additions and 93 deletions

View File

@@ -17,7 +17,6 @@ class Order
->setLabels(array_keys($data)) ->setLabels(array_keys($data))
->setDataset('CA', 'bar', array_values($data)) ->setDataset('CA', 'bar', array_values($data))
->setColor('#334F17') ->setColor('#334F17')
->setStrokeColors(['#527C39']) ->setStrokeColors(['#527C39']);
;
} }
} }

View File

@@ -4,7 +4,6 @@ namespace App\Console\Commands;
use App\Models\Shop\Article; use App\Models\Shop\Article;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Str;
class FixSlug extends Command class FixSlug extends Command
{ {

View File

@@ -4,8 +4,8 @@ namespace App\Datatables\Admin\Shop;
use App\Datatables\ParentDataTable as DataTable; use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Article; use App\Models\Shop\Article;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\ArticleImages; use App\Repositories\Shop\ArticleImages;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\Tags; use App\Repositories\Shop\Tags;
use Yajra\DataTables\Html\Column; use Yajra\DataTables\Html\Column;

View File

@@ -68,7 +68,7 @@ class ParentDataTable extends DataTable
]); ]);
} }
public function getButtonDel($field ='id', $title = 'Effacer') public function getButtonDel($field = 'id', $title = 'Effacer')
{ {
return view('components.form.buttons.delete', [ return view('components.form.buttons.delete', [
'dataId' => '{{$'.$field.'}}', 'dataId' => '{{$'.$field.'}}',

View File

@@ -41,7 +41,7 @@ class CustomerInvoicesDataTable extends DataTable
'class' => 'btn-sm btn-secondary btn-invoice mr-2', 'class' => 'btn-sm btn-secondary btn-invoice mr-2',
'icon' => 'fa-file-pdf', 'icon' => 'fa-file-pdf',
'title' => 'Télécharger la facture', 'title' => 'Télécharger la facture',
'url' => route('Shop.Invoices.pdf') . '/{{$uuid}}', 'url' => route('Shop.Invoices.pdf').'/{{$uuid}}',
]); ]);
$buttons .= self::getButtonShow('uuid', 'Voir la facture'); $buttons .= self::getButtonShow('uuid', 'Voir la facture');

View File

@@ -29,6 +29,7 @@ class InvoicesDataTable extends DataTable
}) })
->editColumn('customer.last_name', function (Invoice $invoice) { ->editColumn('customer.last_name', function (Invoice $invoice) {
$customer = $invoice->customer ?? false; $customer = $invoice->customer ?? false;
return $customer ? $customer->last_name.' '.$customer->first_name : ''; return $customer ? $customer->last_name.' '.$customer->first_name : '';
}) })
->rawColumns(['action']); ->rawColumns(['action']);

View File

@@ -2,9 +2,9 @@
namespace App\Http\Controllers\Admin; namespace App\Http\Controllers\Admin;
use App\Charts\Shop\Order;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Shop\Dashboards; use App\Repositories\Shop\Dashboards;
use App\Charts\Shop\Order;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -22,6 +22,7 @@ class HomeController extends Controller
$data = Dashboards::getStats($start, $end); $data = Dashboards::getStats($start, $end);
$data['chart'] = Order::getMonthly(); $data['chart'] = Order::getMonthly();
// dump($data); // dump($data);
// exit; // exit;
return view('Admin.Shop.Dashboard.index', $data); return view('Admin.Shop.Dashboard.index', $data);

View File

@@ -4,9 +4,9 @@ namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\ArticlesDataTable; use App\Datatables\Admin\Shop\ArticlesDataTable;
use App\Http\Requests\Admin\Shop\StoreArticlePost; use App\Http\Requests\Admin\Shop\StoreArticlePost;
use App\Repositories\Shop\ArticleInherited;
use App\Repositories\Shop\ArticleNatures; use App\Repositories\Shop\ArticleNatures;
use App\Repositories\Shop\Articles; use App\Repositories\Shop\Articles;
use App\Repositories\Shop\ArticleInherited;
use App\Repositories\Shop\Categories; use App\Repositories\Shop\Categories;
use App\Repositories\Shop\Tags; use App\Repositories\Shop\Tags;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View File

@@ -27,7 +27,7 @@ class DeliveryTypeController extends Controller
public function edit($id) public function edit($id)
{ {
$data = []; $data = [];
$data['delivery'] = DeliveryTypes::get($id)->toArray(); $data['delivery'] = DeliveryTypes::get($id)->toArray();
return view('Admin.Shop.DeliveryTypes.edit', $data); return view('Admin.Shop.DeliveryTypes.edit', $data);

View File

@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Admin\Shop; namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Admin\Shop\InvoicePaymentsDataTable;
use App\Datatables\Admin\Shop\InvoicesDataTable; use App\Datatables\Admin\Shop\InvoicesDataTable;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Shop\Invoices; use App\Repositories\Shop\Invoices;

View File

@@ -19,6 +19,7 @@ class ArticleController extends Controller
public function showBySlug($slug) public function showBySlug($slug)
{ {
$id = Articles::getIDBySlug($slug); $id = Articles::getIDBySlug($slug);
return $id ? $this->show($id) : view('errors.404'); return $id ? $this->show($id) : view('errors.404');
} }

View File

@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Shop; namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Shop\Controller;
use App\Repositories\Shop\Customers; use App\Repositories\Shop\Customers;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View File

@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Shop; namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Shop\Controller;
use App\Datatables\Shop\CustomerInvoicesDataTable; use App\Datatables\Shop\CustomerInvoicesDataTable;
use App\Repositories\Shop\InvoicePDF; use App\Repositories\Shop\InvoicePDF;
use App\Repositories\Shop\Invoices; use App\Repositories\Shop\Invoices;

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Shop; namespace App\Http\Controllers\Shop;
use App\Datatables\Shop\CustomerOrdersDataTable; use App\Datatables\Shop\CustomerOrdersDataTable;
use App\Http\Controllers\Shop\Controller;
use App\Repositories\Core\User\ShopCart; use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets; use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Customers; use App\Repositories\Shop\Customers;
@@ -71,8 +70,10 @@ class OrderController extends Controller
return Paybox::makeAuthorizationRequest($order); return Paybox::makeAuthorizationRequest($order);
} }
OrderMails::sendOrderConfirmed($order->id); OrderMails::sendOrderConfirmed($order->id);
return redirect()->route('Shop.Orders.confirmed'); return redirect()->route('Shop.Orders.confirmed');
} }
return view('Shop.Orders.order'); return view('Shop.Orders.order');
} }

View File

@@ -223,11 +223,11 @@ class Article extends Model implements HasMedia
$product = $this->product ?? false; $product = $this->product ?? false;
if (is_object($product)) { if (is_object($product)) {
$description .= ' ' . $product ? $product->description : ''; $description .= ' '.$product ? $product->description : '';
$description .= ' ' . $product ? $product->plus ?? '' : ''; $description .= ' '.$product ? $product->plus ?? '' : '';
$specie = $product ? $product->specie : false; $specie = $product ? $product->specie : false;
$description .= ' ' . $specie ? $specie->description ?? '' : ''; $description .= ' '.$specie ? $specie->description ?? '' : '';
} }
return [ return [
@@ -254,8 +254,8 @@ class Article extends Model implements HasMedia
{ {
return [ return [
'slug' => [ 'slug' => [
'source' => 'name' 'source' => 'name',
] ],
]; ];
} }
} }

View File

@@ -11,7 +11,7 @@ class AppServiceProvider extends ServiceProvider
{ {
public function boot() public function boot()
{ {
if(config('app.env') === 'production') { if (config('app.env') === 'production') {
\URL::forceScheme('https'); \URL::forceScheme('https');
} }
Schema::defaultStringLength(191); Schema::defaultStringLength(191);

View File

@@ -4,13 +4,6 @@ namespace App\Repositories\Shop;
use App\Models\Shop\Article; use App\Models\Shop\Article;
use App\Models\Shop\Merchandise; use App\Models\Shop\Merchandise;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Core\Comments;
use App\Repositories\Core\Tag;
use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleCategories class ArticleCategories
{ {

View File

@@ -2,15 +2,10 @@
namespace App\Repositories\Shop; namespace App\Repositories\Shop;
use App\Models\Shop\Article;
use App\Models\Shop\Merchandise;
use App\Repositories\Botanic\Species; use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties; use App\Repositories\Botanic\Varieties;
use App\Repositories\Core\Comments;
use App\Repositories\Core\Tag;
use App\Traits\Model\Basic; use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable; use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleImages class ArticleImages
{ {

View File

@@ -3,14 +3,6 @@
namespace App\Repositories\Shop; namespace App\Repositories\Shop;
use App\Models\Shop\Article; use App\Models\Shop\Article;
use App\Models\Shop\Merchandise;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Core\Comments;
use App\Repositories\Core\Tag;
use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleSiblings class ArticleSiblings
{ {

View File

@@ -2,15 +2,7 @@
namespace App\Repositories\Shop; namespace App\Repositories\Shop;
use App\Models\Shop\Article;
use App\Models\Shop\Merchandise;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties;
use App\Repositories\Core\Comments;
use App\Repositories\Core\Tag; use App\Repositories\Core\Tag;
use App\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleTags class ArticleTags
{ {

View File

@@ -17,7 +17,7 @@ class BasketStores
public function get($key) public function get($key)
{ {
if($this->has($key)) { if ($this->has($key)) {
return new CartCollection(Basket::find($key)->cart_data); return new CartCollection(Basket::find($key)->cart_data);
} else { } else {
return []; return [];
@@ -26,14 +26,14 @@ class BasketStores
public function put($key, $value) public function put($key, $value)
{ {
if($row = Basket::find($key)) { if ($row = Basket::find($key)) {
// update // update
$row->cart_data = $value; $row->cart_data = $value;
$row->save(); $row->save();
} else { } else {
Basket::create([ Basket::create([
'id' => $key, 'id' => $key,
'cart_data' => $value 'cart_data' => $value,
]); ]);
} }
} }

View File

@@ -3,9 +3,9 @@
namespace App\Repositories\Shop; namespace App\Repositories\Shop;
use Carbon\Carbon; use Carbon\Carbon;
use LaravelDaily\Invoices\Invoice;
use LaravelDaily\Invoices\Classes\Party;
use LaravelDaily\Invoices\Classes\InvoiceItem; use LaravelDaily\Invoices\Classes\InvoiceItem;
use LaravelDaily\Invoices\Classes\Party;
use LaravelDaily\Invoices\Invoice;
class InvoicePDF class InvoicePDF
{ {
@@ -18,8 +18,8 @@ class InvoicePDF
{ {
$invoice = Invoices::getFull($id); $invoice = Invoices::getFull($id);
$customer = new Party([ $customer = new Party([
'name' => $invoice->customer->name, 'name' => $invoice->customer->name,
'address' => self::makeAddress($invoice->address), 'address' => self::makeAddress($invoice->address),
'custom_fields' => [ 'custom_fields' => [
'order number' => $invoice->order->ref, 'order number' => $invoice->order->ref,
], ],
@@ -27,13 +27,13 @@ class InvoicePDF
$items = self::makeItems($invoice->order->detail); $items = self::makeItems($invoice->order->detail);
$invoice = Invoice::make(__('invoices::invoice.invoice') . ' ' .$invoice->ref) $invoice = Invoice::make(__('invoices::invoice.invoice').' '.$invoice->ref)
->status(Invoices::getStatus($invoice->status)) ->status(Invoices::getStatus($invoice->status))
->buyer($customer) ->buyer($customer)
->shipping($invoice->shipping) ->shipping($invoice->shipping)
->date(Carbon::parse($invoice->date_invoice)) ->date(Carbon::parse($invoice->date_invoice))
->payUntilDays(14) ->payUntilDays(14)
->filename('invoice-' . $invoice->ref . '-' . $invoice->uuid) ->filename('invoice-'.$invoice->ref.'-'.$invoice->uuid)
->addItems($items) ->addItems($items)
->notes($invoice->comment ?? '') ->notes($invoice->comment ?? '')
->logo(public_path('img/logo.png')) ->logo(public_path('img/logo.png'))
@@ -48,7 +48,7 @@ class InvoicePDF
public static function makeAddress($address) public static function makeAddress($address)
{ {
return $address->address . '<br>' . $address->zipcode . ' ' . $address->city; return $address->address.'<br>'.$address->zipcode.' '.$address->city;
} }
public static function makeItems($details) public static function makeItems($details)

View File

@@ -3,7 +3,6 @@
namespace App\Repositories\Shop; namespace App\Repositories\Shop;
use App\Models\Shop\Offer; use App\Models\Shop\Offer;
use App\Traits\Model\Basic;
class OfferStocks class OfferStocks
{ {

View File

@@ -5,7 +5,6 @@ namespace App\Repositories\Shop;
use App\Models\Shop\Order; use App\Models\Shop\Order;
use App\Repositories\Core\DateStats; use App\Repositories\Core\DateStats;
use App\Repositories\Core\PDF; use App\Repositories\Core\PDF;
use App\Repositories\Shop\Customers;
use App\Traits\Model\Basic; use App\Traits\Model\Basic;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -30,7 +29,7 @@ class Orders
public static function getPdfByUUID($uuid) public static function getPdfByUUID($uuid)
{ {
return self::getPdf(self::getIdByUUID($uuid), 'commande-' . $uuid . '.pdf'); return self::getPdf(self::getIdByUUID($uuid), 'commande-'.$uuid.'.pdf');
} }
public static function getPdf($id, $file = 'order.pdf') public static function getPdf($id, $file = 'order.pdf')

View File

@@ -12,6 +12,7 @@ class Searches
'ids' => Article::search($options['search_name'])->get()->pluck('id'), 'ids' => Article::search($options['search_name'])->get()->pluck('id'),
]))->sortBy('searchOrder')->toArray(); ]))->sortBy('searchOrder')->toArray();
} }
public static function getResults($options) public static function getResults($options)
{ {
return Articles::getArticlesToSell($options); return Articles::getArticlesToSell($options);

View File

@@ -15,14 +15,14 @@ return [
], ],
'serial_number' => [ 'serial_number' => [
'series' => 'AA', 'series' => 'AA',
'sequence' => 1, 'sequence' => 1,
/* /*
* Sequence will be padded accordingly, for ex. 00001 * Sequence will be padded accordingly, for ex. 00001
*/ */
'sequence_padding' => 5, 'sequence_padding' => 5,
'delimiter' => '.', 'delimiter' => '.',
/* /*
* Supported tags {SERIES}, {DELIMITER}, {SEQUENCE} * Supported tags {SERIES}, {DELIMITER}, {SEQUENCE}
@@ -41,7 +41,7 @@ return [
* Example: Amount in words: Eight hundred fifty thousand sixty-eight EUR and fifteen ct. * Example: Amount in words: Eight hundred fifty thousand sixty-eight EUR and fifteen ct.
*/ */
'fraction' => 'ct.', 'fraction' => 'ct.',
'symbol' => '€', 'symbol' => '€',
/* /*
* Example: 19.00 * Example: 19.00
@@ -68,7 +68,7 @@ return [
'paper' => [ 'paper' => [
// A4 = 210 mm x 297 mm = 595 pt x 842 pt // A4 = 210 mm x 297 mm = 595 pt x 842 pt
'size' => 'a4', 'size' => 'a4',
'orientation' => 'portrait', 'orientation' => 'portrait',
], ],
@@ -87,11 +87,11 @@ return [
* Default attributes for Seller::class * Default attributes for Seller::class
*/ */
'attributes' => [ 'attributes' => [
'name' => 'Jardin\'Envie', 'name' => 'Jardin\'Envie',
'address' => '89982 Pfeffer Falls Damianstad, CO 66972-8160', 'address' => '89982 Pfeffer Falls Damianstad, CO 66972-8160',
'code' => '41-1985581', 'code' => '41-1985581',
'vat' => '123456789', 'vat' => '123456789',
'phone' => '760-355-3930', 'phone' => '760-355-3930',
'custom_fields' => [ 'custom_fields' => [
/* /*
* Custom attributes for Seller::class * Custom attributes for Seller::class
@@ -108,6 +108,7 @@ return [
'enable_php' => true, 'enable_php' => true,
/** /**
* Do not write log.html or make it optional * Do not write log.html or make it optional
*
* @see https://github.com/dompdf/dompdf/issues/2810 * @see https://github.com/dompdf/dompdf/issues/2810
*/ */
'logOutputFile' => '/dev/null', 'logOutputFile' => '/dev/null',

View File

@@ -136,7 +136,7 @@ return [
'key' => env('MEILISEARCH_KEY', null), 'key' => env('MEILISEARCH_KEY', null),
'index-settings' => [ 'index-settings' => [
Article::class => [ Article::class => [
'filterableAttributes'=> ['article_nature_id'], 'filterableAttributes' => ['article_nature_id'],
'sortableAttributes' => ['name', 'created_at'], 'sortableAttributes' => ['name', 'created_at'],
], ],
], ],

View File

@@ -17,7 +17,6 @@ return [
* *
* Defaults to null, which uses the toString() method on your model. * Defaults to null, which uses the toString() method on your model.
*/ */
'source' => null, 'source' => null,
/** /**
@@ -25,7 +24,6 @@ return [
* no length restrictions are enforced. Set it to a positive integer if you * no length restrictions are enforced. Set it to a positive integer if you
* want to make sure your slugs aren't too long. * want to make sure your slugs aren't too long.
*/ */
'maxLength' => null, 'maxLength' => null,
/** /**
@@ -40,7 +38,6 @@ return [
* *
* "my source string" -> "my-source-st" * "my source string" -> "my-source-st"
*/ */
'maxLengthKeepWords' => true, 'maxLengthKeepWords' => true,
/** /**
@@ -58,13 +55,11 @@ return [
* *
* 'method' => array('Str','slug'), * 'method' => array('Str','slug'),
*/ */
'method' => null, 'method' => null,
/** /**
* Separator to use when generating slugs. Defaults to a hyphen. * Separator to use when generating slugs. Defaults to a hyphen.
*/ */
'separator' => '-', 'separator' => '-',
/** /**
@@ -76,7 +71,6 @@ return [
* my-slug-1 * my-slug-1
* my-slug-2 * my-slug-2
*/ */
'unique' => true, 'unique' => true,
/** /**
@@ -87,7 +81,6 @@ return [
* "similar" slugs. The closure should return the new unique * "similar" slugs. The closure should return the new unique
* suffix to append to the slug. * suffix to append to the slug.
*/ */
'uniqueSuffix' => null, 'uniqueSuffix' => null,
/** /**
@@ -107,7 +100,6 @@ return [
* If set to "false", then a new slug could duplicate one that exists on a trashed model. * If set to "false", then a new slug could duplicate one that exists on a trashed model.
* If set to "true", then uniqueness is enforced across trashed and existing models. * If set to "true", then uniqueness is enforced across trashed and existing models.
*/ */
'includeTrashed' => false, 'includeTrashed' => false,
/** /**
@@ -133,7 +125,6 @@ return [
* *
* and continue from there. * and continue from there.
*/ */
'reserved' => null, 'reserved' => null,
/** /**
@@ -146,7 +137,6 @@ return [
* is probably not a good idea from an SEO point of view. * is probably not a good idea from an SEO point of view.
* Only set this to true if you understand the possible consequences. * Only set this to true if you understand the possible consequences.
*/ */
'onUpdate' => false, 'onUpdate' => false,
/** /**

View File

@@ -28,7 +28,7 @@ return new class extends Migration
$table->timestamps(); $table->timestamps();
}); });
Schema::connection($connection)->table($tableName, function(Blueprint $table) { Schema::connection($connection)->table($tableName, function (Blueprint $table) {
$table->index('created_at'); $table->index('created_at');
$table->index('batch'); $table->index('batch');
}); });

View File

@@ -1,8 +1,8 @@
<?php <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
{ {