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))
->setDataset('CA', 'bar', array_values($data))
->setColor('#334F17')
->setStrokeColors(['#527C39'])
;
->setStrokeColors(['#527C39']);
}
}

View File

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

View File

@@ -4,8 +4,8 @@ namespace App\Datatables\Admin\Shop;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\Article;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\ArticleImages;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\Tags;
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', [
'dataId' => '{{$'.$field.'}}',

View File

@@ -41,7 +41,7 @@ class CustomerInvoicesDataTable extends DataTable
'class' => 'btn-sm btn-secondary btn-invoice mr-2',
'icon' => 'fa-file-pdf',
'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');

View File

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

View File

@@ -2,9 +2,9 @@
namespace App\Http\Controllers\Admin;
use App\Charts\Shop\Order;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Dashboards;
use App\Charts\Shop\Order;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -22,6 +22,7 @@ class HomeController extends Controller
$data = Dashboards::getStats($start, $end);
$data['chart'] = Order::getMonthly();
// dump($data);
// exit;
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\Http\Requests\Admin\Shop\StoreArticlePost;
use App\Repositories\Shop\ArticleInherited;
use App\Repositories\Shop\ArticleNatures;
use App\Repositories\Shop\Articles;
use App\Repositories\Shop\ArticleInherited;
use App\Repositories\Shop\Categories;
use App\Repositories\Shop\Tags;
use Illuminate\Http\Request;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,13 +4,6 @@ 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\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleCategories
{

View File

@@ -2,15 +2,10 @@
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\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleImages
{

View File

@@ -3,14 +3,6 @@
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\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleSiblings
{

View File

@@ -2,15 +2,7 @@
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\Traits\Model\Basic;
use App\Traits\Repository\Imageable;
use Illuminate\Support\Str;
class ArticleTags
{

View File

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

View File

@@ -3,9 +3,9 @@
namespace App\Repositories\Shop;
use Carbon\Carbon;
use LaravelDaily\Invoices\Invoice;
use LaravelDaily\Invoices\Classes\Party;
use LaravelDaily\Invoices\Classes\InvoiceItem;
use LaravelDaily\Invoices\Classes\Party;
use LaravelDaily\Invoices\Invoice;
class InvoicePDF
{
@@ -18,8 +18,8 @@ class InvoicePDF
{
$invoice = Invoices::getFull($id);
$customer = new Party([
'name' => $invoice->customer->name,
'address' => self::makeAddress($invoice->address),
'name' => $invoice->customer->name,
'address' => self::makeAddress($invoice->address),
'custom_fields' => [
'order number' => $invoice->order->ref,
],
@@ -27,13 +27,13 @@ class InvoicePDF
$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))
->buyer($customer)
->shipping($invoice->shipping)
->date(Carbon::parse($invoice->date_invoice))
->payUntilDays(14)
->filename('invoice-' . $invoice->ref . '-' . $invoice->uuid)
->filename('invoice-'.$invoice->ref.'-'.$invoice->uuid)
->addItems($items)
->notes($invoice->comment ?? '')
->logo(public_path('img/logo.png'))
@@ -48,7 +48,7 @@ class InvoicePDF
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)

View File

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

View File

@@ -5,7 +5,6 @@ namespace App\Repositories\Shop;
use App\Models\Shop\Order;
use App\Repositories\Core\DateStats;
use App\Repositories\Core\PDF;
use App\Repositories\Shop\Customers;
use App\Traits\Model\Basic;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
@@ -30,7 +29,7 @@ class Orders
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')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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