add offers count, & minor fixes code standards
This commit is contained in:
@@ -20,7 +20,7 @@ class CommentsDataTable extends DataTable
|
|||||||
public function query(Comment $model)
|
public function query(Comment $model)
|
||||||
{
|
{
|
||||||
$model = $model::with(['user'])->select('*');
|
$model = $model::with(['user'])->select('*');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -29,7 +29,7 @@ class CommentsDataTable extends DataTable
|
|||||||
Column::make('updated_at')->title(__('date'))->width('80')->class('text-center')->searchable(false),
|
Column::make('updated_at')->title(__('date'))->width('80')->class('text-center')->searchable(false),
|
||||||
Column::make('user.name')->title(__('name'))->searchable(false),
|
Column::make('user.name')->title(__('name'))->searchable(false),
|
||||||
Column::make('comment')->title(__('comments'))->searchable(false),
|
Column::make('comment')->title(__('comments'))->searchable(false),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class FamiliesDataTable extends DataTable
|
|||||||
public function query(Family $model)
|
public function query(Family $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount(['genres','species','varieties']);
|
$model = $model::withCount(['genres','species','varieties']);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -25,7 +25,7 @@ class FamiliesDataTable extends DataTable
|
|||||||
Column::make('genres_count')->title('Nb genres')->searchable(false)->addClass('text-right'),
|
Column::make('genres_count')->title('Nb genres')->searchable(false)->addClass('text-right'),
|
||||||
Column::make('species_count')->title('Nb espèces')->searchable(false)->addClass('text-right'),
|
Column::make('species_count')->title('Nb espèces')->searchable(false)->addClass('text-right'),
|
||||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,17 @@ class GenresDataTable extends DataTable
|
|||||||
public function query(Genre $model)
|
public function query(Genre $model)
|
||||||
{
|
{
|
||||||
$model = $model::with('family')->withCount('species')->withCount('varieties');
|
$model = $model::with('family')->withCount('species')->withCount('varieties');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables
|
||||||
->editColumn(
|
->editColumn('family_name', function (Genre $genre) {
|
||||||
'family_name', function (Genre $genre) {
|
|
||||||
return $genre->family ? $genre->family->name : '';
|
return $genre->family ? $genre->family->name : '';
|
||||||
}
|
})
|
||||||
)
|
|
||||||
->rawColumns(['genre_name', 'action']);
|
->rawColumns(['genre_name', 'action']);
|
||||||
return Parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -37,7 +35,7 @@ class GenresDataTable extends DataTable
|
|||||||
Column::make('family.name')->data('family_name')->title('Famille'),
|
Column::make('family.name')->data('family_name')->title('Famille'),
|
||||||
Column::make('species_count')->title('Nb Espèces')->searchable(false)->addClass('text-right'),
|
Column::make('species_count')->title('Nb Espèces')->searchable(false)->addClass('text-right'),
|
||||||
Column::make('varieties_count')->title('Nb Variétés')->searchable(false)->addClass('text-right'),
|
Column::make('varieties_count')->title('Nb Variétés')->searchable(false)->addClass('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,17 @@ class SpeciesDataTable extends DataTable
|
|||||||
public function query(Specie $model)
|
public function query(Specie $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount('varieties')->with('genre');
|
$model = $model::withCount('varieties')->with('genre');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables
|
||||||
->editColumn(
|
->editColumn('genre_name', function (Specie $specie) {
|
||||||
'genre_name', function (Specie $specie) {
|
|
||||||
return $specie->genre ? $specie->genre->name : '';
|
return $specie->genre ? $specie->genre->name : '';
|
||||||
}
|
})
|
||||||
)
|
|
||||||
->rawColumns(['genre_name', 'action']);
|
->rawColumns(['genre_name', 'action']);
|
||||||
return Parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +35,7 @@ class SpeciesDataTable extends DataTable
|
|||||||
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
||||||
Column::make('latin'),
|
Column::make('latin'),
|
||||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,23 +14,21 @@ class VarietiesDataTable extends DataTable
|
|||||||
{
|
{
|
||||||
// $model = $model::with('specie')->withCount('Articles')->select('botanic_varieties.*');
|
// $model = $model::with('specie')->withCount('Articles')->select('botanic_varieties.*');
|
||||||
$model = $model::joinRelationship('Specie')->select('botanic_varieties.*', 'botanic_species.name as specie_name')->with('Specie')->withCount('Articles');
|
$model = $model::joinRelationship('Specie')->select('botanic_varieties.*', 'botanic_species.name as specie_name')->with('Specie')->withCount('Articles');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables
|
||||||
->editColumn(
|
->editColumn('photo', function (Variety $variety) {
|
||||||
'photo', function (Variety $variety) {
|
|
||||||
$media = $variety->getFirstMedia();
|
$media = $variety->getFirstMedia();
|
||||||
// dump($media);
|
// dump($media);
|
||||||
// return $media('thumb');
|
// return $media('thumb');
|
||||||
return '';
|
return '';
|
||||||
}
|
})
|
||||||
)
|
|
||||||
->rawColumns(['photo', 'action']);
|
->rawColumns(['photo', 'action']);
|
||||||
return Parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +39,7 @@ class VarietiesDataTable extends DataTable
|
|||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
||||||
Column::make('photo')->title('')->searchable(false)->orderable(false),
|
Column::make('photo')->title('')->searchable(false)->orderable(false),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ class ArticleNaturesDataTable extends DataTable
|
|||||||
public function query(ArticleNature $model)
|
public function query(ArticleNature $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount('Articles');
|
$model = $model::withCount('Articles');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('articles_count')->title('Nb articles')->addClass('text-right'),
|
Column::make('articles_count')->title('Nb articles')->addClass('text-right')->searchable(false),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class ArticlesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Article $model)
|
public function query(Article $model)
|
||||||
{
|
{
|
||||||
$model = $model::with(['article_nature','image'])->withCount(['categories', 'tags'])->joinRelationship('article_nature');
|
$model = $model::with(['article_nature', 'image'])->withCount(['categories', 'tags', 'offers'])->joinRelationship('article_nature');
|
||||||
$model = self::filterByArticleNature($model);
|
$model = self::filterByArticleNature($model);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function filterByArticleNature($model, $article_nature_id = false)
|
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||||
@@ -28,24 +28,23 @@ class ArticlesDataTable extends DataTable
|
|||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables->editColumn('thumb', function (Article $article) {
|
||||||
->editColumn('thumb', function (Article $article) {
|
|
||||||
return '<img src="' . Articles::getThumbSrc($article->image) . '">';
|
return '<img src="' . Articles::getThumbSrc($article->image) . '">';
|
||||||
})
|
})
|
||||||
->rawColumns(['thumb','action']);
|
->rawColumns(['thumb', 'action']);
|
||||||
return parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('article_nature.name')->title('Nature'),
|
Column::make('article_nature.name')->title('Nature'),
|
||||||
Column::make('thumb')->searchable(false)->width(40)->class('text-center'),
|
Column::make('thumb')->searchable(false)->orderable(false)->width(40)->class('text-center'),
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('tags_count')->title('Tags')->class('text-right')->searchable(false),
|
Column::make('tags_count')->title('Tags')->class('text-right')->searchable(false),
|
||||||
Column::make('categories_count')->title('Rayons')->class('text-right')->searchable(false),
|
Column::make('categories_count')->title('Rayons')->class('text-right')->searchable(false),
|
||||||
self::makeColumnButtons(),
|
Column::make('offers_count')->title('Offres')->class('text-right')->searchable(false),
|
||||||
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class CategoriesDataTable extends DataTable
|
|||||||
public function query(Category $model)
|
public function query(Category $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount('articles');
|
$model = $model::withCount('articles');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -21,7 +21,7 @@ class CategoriesDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class CustomersDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Customer $model)
|
public function query(Customer $model)
|
||||||
{
|
{
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -22,7 +22,7 @@ class CustomersDataTable extends DataTable
|
|||||||
Column::make('address')->title('Adresse'),
|
Column::make('address')->title('Adresse'),
|
||||||
Column::make('zipcode')->title('Code postal'),
|
Column::make('zipcode')->title('Code postal'),
|
||||||
Column::make('city')->title('Ville'),
|
Column::make('city')->title('Ville'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,21 @@ class DeliveriesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Delivery $model)
|
public function query(Delivery $model)
|
||||||
{
|
{
|
||||||
$model = $model->with('SaleChannel');
|
$model = $model->with('sale_channel');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables
|
||||||
->editColumn('active', function (Delivery $delivery) {
|
->editColumn('active', function (Delivery $delivery) {
|
||||||
return view("components.form.toggle", ['value' => $delivery->active, 'on' => __('active'), 'off' => __('inactive'), 'meta' => 'data-id='.$delivery->id, 'size' => 'sm']);
|
return view("components.form.toggle", [
|
||||||
|
'value' => $delivery->active,
|
||||||
|
'on' => __('active'),
|
||||||
|
'off' => __('inactive'),
|
||||||
|
'meta' => 'data-id='.$delivery->id,
|
||||||
|
'size' => 'sm',
|
||||||
|
]);
|
||||||
})
|
})
|
||||||
->rawColumns(['active', 'action']);
|
->rawColumns(['active', 'action']);
|
||||||
return parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
@@ -35,7 +41,7 @@ class DeliveriesDataTable extends DataTable
|
|||||||
Column::make('address')->title('Adresse'),
|
Column::make('address')->title('Adresse'),
|
||||||
Column::make('zipcode')->title('Code postal'),
|
Column::make('zipcode')->title('Code postal'),
|
||||||
Column::make('city')->title('Ville'),
|
Column::make('city')->title('Ville'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class InvoicesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Invoice $model)
|
public function query(Invoice $model)
|
||||||
{
|
{
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -21,7 +21,7 @@ class InvoicesDataTable extends DataTable
|
|||||||
Column::make('status.name'),
|
Column::make('status.name'),
|
||||||
Column::make('customer.name'),
|
Column::make('customer.name'),
|
||||||
Column::make('total'),
|
Column::make('total'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,18 @@ class OffersDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Offer $model)
|
public function query(Offer $model)
|
||||||
{
|
{
|
||||||
$model = $model->with(['article','variation','tariff'])->select(['shop_offers.*']);
|
$model = $model->with(['article.article_nature', 'variation', 'tariff']);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('article.name')->title('Article'),
|
Column::make('article.name')->title('Article'),
|
||||||
|
Column::make('article.article_nature.name')->title('Nature'),
|
||||||
Column::make('variation.name')->title('Déclinaison'),
|
Column::make('variation.name')->title('Déclinaison'),
|
||||||
Column::make('tariff.name')->title('Tarif'),
|
Column::make('tariff.name')->title('Tarif'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ class OrdersDataTable extends DataTable
|
|||||||
{
|
{
|
||||||
public $model_name = 'orders';
|
public $model_name = 'orders';
|
||||||
|
|
||||||
public function query(Product $model)
|
public function query(Order $model)
|
||||||
{
|
{
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('name'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class PackagesDataTable extends DataTable
|
|||||||
public function query(Package $model)
|
public function query(Package $model)
|
||||||
{
|
{
|
||||||
$model = $model->withCount(['variations','offers']);
|
$model = $model->withCount(['variations','offers']);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -22,7 +22,7 @@ class PackagesDataTable extends DataTable
|
|||||||
Column::make('value')->title('Valeur'),
|
Column::make('value')->title('Valeur'),
|
||||||
Column::make('variations_count')->title('nb variations')->searchable(false)->class('text-right'),
|
Column::make('variations_count')->title('nb variations')->searchable(false)->class('text-right'),
|
||||||
Column::make('offers_count')->title('nb offres')->searchable(false)->class('text-right'),
|
Column::make('offers_count')->title('nb offres')->searchable(false)->class('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class PriceGenericCategoriesDataTable extends DataTable
|
|||||||
public function query(PriceGenericCategory $model)
|
public function query(PriceGenericCategory $model)
|
||||||
{
|
{
|
||||||
$model = $model->withCount('price_generics');
|
$model = $model->withCount('price_generics');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -21,7 +21,7 @@ class PriceGenericCategoriesDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('price_generics_count')->title('Nb Tarifs')->class('text-right'),
|
Column::make('price_generics_count')->title('Nb Tarifs')->class('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class PriceListsDataTable extends DataTable
|
|||||||
{
|
{
|
||||||
$model = $model->with(['sale_channel','price_list_values']);
|
$model = $model->with(['sale_channel','price_list_values']);
|
||||||
$model = self::filterByTariff($model);
|
$model = self::filterByTariff($model);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function filterByTariff($model, $tariff_id = false)
|
public static function filterByTariff($model, $tariff_id = false)
|
||||||
@@ -49,7 +49,7 @@ class PriceListsDataTable extends DataTable
|
|||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('sale_channel.name')->title('Canal de vente'),
|
Column::make('sale_channel.name')->title('Canal de vente'),
|
||||||
Column::make('tariff_id')->title('Liste de prix'),
|
Column::make('tariff_id')->title('Liste de prix'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class SaleChannelsDataTable extends DataTable
|
|||||||
public function query(SaleChannel $model)
|
public function query(SaleChannel $model)
|
||||||
{
|
{
|
||||||
$model = $model->withCount('deliveries');
|
$model = $model->withCount('deliveries');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -21,8 +21,8 @@ class SaleChannelsDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('code')->title('Code abrégé')->width(100),
|
Column::make('code')->title('Code abrégé')->width(100),
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('deliveries_count')->title(__('shop.deliveries.list'))->searchable(false),
|
Column::make('deliveries_count')->title(__('shop.deliveries.list'))->searchable(false)->class('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class TagGroupsDataTable extends DataTable
|
|||||||
public function query(TagGroup $model)
|
public function query(TagGroup $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount('tags');
|
$model = $model::withCount('tags');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -21,7 +21,7 @@ class TagGroupsDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('name'),
|
||||||
Column::make('tags_count')->title('Nb de tags')->searchable(false)->addClass('text-right'),
|
Column::make('tags_count')->title('Nb de tags')->searchable(false)->addClass('text-right'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class TagsDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Tag $model)
|
public function query(Tag $model)
|
||||||
{
|
{
|
||||||
$model = $model::with('group')->withCount(['articles','species','varieties']);
|
$model = $model::with('group')->withCount(['articles', 'species', 'varieties']);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
@@ -22,10 +22,10 @@ class TagsDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('group.name')->title('Groupe'),
|
Column::make('group.name')->title('Groupe'),
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('articles_count')->title('Articles')->class('text-right'),
|
Column::make('articles_count')->title('Articles')->class('text-right')->searchable(false),
|
||||||
Column::make('species_count')->title('Espèces')->class('text-right'),
|
Column::make('species_count')->title('Espèces')->class('text-right')->searchable(false),
|
||||||
Column::make('varieties_count')->title('Variétés')->class('text-right'),
|
Column::make('varieties_count')->title('Variétés')->class('text-right')->searchable(false),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class TariffsDataTable extends DataTable
|
|||||||
public function query(Tariff $model)
|
public function query(Tariff $model)
|
||||||
{
|
{
|
||||||
$model = $model->with(['sale_channel'])->select(['shop_tariffs.*']);
|
$model = $model->with(['sale_channel'])->select(['shop_tariffs.*']);
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
@@ -36,7 +36,7 @@ class TariffsDataTable extends DataTable
|
|||||||
Column::make('sale_channel.name')->title('Canal de vente par défaut'),
|
Column::make('sale_channel.name')->title('Canal de vente par défaut'),
|
||||||
Column::make('code')->title('Code'),
|
Column::make('code')->title('Code'),
|
||||||
Column::make('ref')->title('Référence'),
|
Column::make('ref')->title('Référence'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ class UnitiesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Unity $model)
|
public function query(Unity $model)
|
||||||
{
|
{
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('value')->title('Valeur'),
|
Column::make('value')->title('Valeur'),
|
||||||
self::makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,19 @@ class VariationsDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Variation $model)
|
public function query(Variation $model)
|
||||||
{
|
{
|
||||||
$model = $model->with(['package','unity'])->select($model->table . 'shop_variations.*');
|
$model = $model->with(['package','unity'])->withCount('offers');
|
||||||
return self::buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('package.value')->title('Package'),
|
Column::make('package.value')->title('Package'),
|
||||||
Column::make('quantity')->title('Quantité')->class('text-right'),
|
Column::make('quantity')->title('Quantité')->class('text-right')->with(80),
|
||||||
Column::make('unity.value')->title('Unité'),
|
Column::make('unity.value')->title('Unité')->searchable(false)->with(80),
|
||||||
Column::make('description')->title('Description'),
|
Column::make('description')->title('Description'),
|
||||||
self::makeColumnButtons(),
|
Column::make('offers_count')->title('Offres')->searchable(false)->class('text-right'),
|
||||||
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ class FamilyController extends Controller
|
|||||||
return $dataTable->render('Admin.Botanic.Families.list');
|
return $dataTable->render('Admin.Botanic.Families.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Families::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('Admin.Botanic.Families.create', $data ?? []);
|
return view('Admin.Botanic.Families.create', $data ?? []);
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ class SpecieController extends Controller
|
|||||||
return $dataTable->render('Admin.Botanic.Species.list');
|
return $dataTable->render('Admin.Botanic.Species.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Species::getDatatable($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptions()
|
public function getOptions()
|
||||||
{
|
{
|
||||||
return response()->json(['0' => ''] + Species::getOptions());
|
return response()->json(['0' => ''] + Species::getOptions());
|
||||||
|
|||||||
@@ -19,16 +19,11 @@ class ApplicationController extends Controller
|
|||||||
return $dataTable->render('admin.Core.App.Application.index', $data);
|
return $dataTable->render('admin.Core.App.Application.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable()
|
|
||||||
{
|
|
||||||
return Applications::getDatatable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function edit(Request $request, $id = false)
|
public function edit(Request $request, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $request->input('id');
|
$id = $id ? $id : $request->input('id');
|
||||||
$data = \App\Repositories\Config::init();
|
$data = \App\Repositories\Config::init();
|
||||||
$data = Applications::select_by_id($id);
|
$data = Applications::get($id);
|
||||||
return view('Admin.Core.App.Application.edit', $data);
|
return view('Admin.Core.App.Application.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ class ApplicationModuleController extends Controller
|
|||||||
return $dataTable->render('admin.Core.App.ApplicationModule.index', $data);
|
return $dataTable->render('admin.Core.App.ApplicationModule.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable()
|
|
||||||
{
|
|
||||||
return ApplicationModules::getDatatable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = \App\Repositories\Config::init();
|
$data = \App\Repositories\Config::init();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class PermissionController extends Controller
|
|||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
Permissions::destroy($id);
|
Permissions::delete($id);
|
||||||
return response()->json(['error' => 0]);
|
return response()->json(['error' => 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class RoleController extends Controller
|
|||||||
public function destroy(Request $request, $id = false)
|
public function destroy(Request $request, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $request->input('id');
|
$id = $id ? $id : $request->input('id');
|
||||||
Roles::destroy($id);
|
Roles::delete($id);
|
||||||
return response()->json(['error' => 0]);
|
return response()->json(['error' => 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ class TeamController extends Controller
|
|||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$team = Team::find($id);
|
$team = Team::find($id);
|
||||||
|
return view('Admin.Core.Auth.Team.edit', compact('team'));
|
||||||
return view('Admin.Core.Auth.Team.edit', compact('team', 'teams'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ class ArticleNatureController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.ArticleNatures.list');
|
return $dataTable->render('Admin.Shop.ArticleNatures.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return ArticleNatures::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('Admin.Shop.ArticleNatures.create');
|
return view('Admin.Shop.ArticleNatures.create');
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ class CategoryController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.Categories.list');
|
return $dataTable->render('Admin.Shop.Categories.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Categories::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(InvoicesDataTable $dataTable)
|
public function index(InvoicesDataTable $dataTable)
|
||||||
{
|
{
|
||||||
return $dataTable->render('Admin.Shop.Invoices.list', $data);
|
return $dataTable->render('Admin.Shop.Invoices.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class OrderController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(OrdersDataTable $dataTable)
|
public function index(OrdersDataTable $dataTable)
|
||||||
{
|
{
|
||||||
return $dataTable->render('Admin.Shop.Orders.list', $data);
|
return $dataTable->render('Admin.Shop.Orders.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ class PackageController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.Packages.list', $data);
|
return $dataTable->render('Admin.Shop.Packages.list', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Packages::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptionsByFamily(Request $request)
|
public function getOptionsByFamily(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->input('family_id');
|
$id = $request->input('family_id');
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ class TagController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.Tags.list');
|
return $dataTable->render('Admin.Shop.Tags.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Tags::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ class TagGroupController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.TagGroups.list');
|
return $dataTable->render('Admin.Shop.TagGroups.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return TagGroups::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data['article_families'] = ArticleNatures::getOptions();
|
$data['article_families'] = ArticleNatures::getOptions();
|
||||||
|
|||||||
@@ -14,16 +14,9 @@ class TaxController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.Taxes.list');
|
return $dataTable->render('Admin.Shop.Taxes.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Taxes::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [];
|
return view('Admin.Shop.Taxes.create');
|
||||||
$data['groups'] = TagGroups::getOptions();
|
|
||||||
return view('Admin.Shop.Taxes.create', $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
@@ -41,15 +34,9 @@ class TaxController extends Controller
|
|||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data = Taxes::get($id);
|
$data = Taxes::get($id);
|
||||||
$data['groups'] = TagGroups::getOptions();
|
|
||||||
return view('Admin.Shop.Taxes.edit', $data);
|
return view('Admin.Shop.Taxes.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return Taxes::destroy($id);
|
return Taxes::destroy($id);
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ class UnityController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.Unities.list', $data);
|
return $dataTable->render('Admin.Shop.Unities.list', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Unities::getTables($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getOptionsByPackage(Request $request)
|
public function getOptionsByPackage(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->input('package_id');
|
$id = $request->input('package_id');
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ class CategoryController extends Controller
|
|||||||
return $dataTable->render('Shop.Categories.list');
|
return $dataTable->render('Shop.Categories.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
|
||||||
{
|
|
||||||
return Categories::getDatatable($request->all());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$data = self::init();
|
$data = self::init();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Delivery extends Model
|
|||||||
return $this->hasMany(Customer::class);
|
return $this->hasMany(Customer::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SaleChannel()
|
public function sale_channel()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(SaleChannel::class);
|
return $this->belongsTo(SaleChannel::class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,15 @@ use App\Repositories\Languages;
|
|||||||
|
|
||||||
class Applications
|
class Applications
|
||||||
{
|
{
|
||||||
public static function select_all()
|
|
||||||
|
public static function getFullBySlug($slug)
|
||||||
{
|
{
|
||||||
return Application::all()->toArray();
|
return Application::with('clients')->active()->bySlug($slug)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAll()
|
||||||
|
{
|
||||||
|
return Application::all();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getOptions()
|
public static function getOptions()
|
||||||
@@ -39,7 +45,9 @@ class Applications
|
|||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $data['id'];
|
$id = $id ? $id : $data['id'];
|
||||||
return self::get($id)->update($data);
|
$item = self::get($id);
|
||||||
|
$item->update($data);
|
||||||
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function destroy($id)
|
public static function destroy($id)
|
||||||
@@ -97,4 +105,12 @@ class Applications
|
|||||||
{
|
{
|
||||||
return Application::active()->bySlug($slug)->first();
|
return Application::active()->bySlug($slug)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function toggleActive($id, $active) {
|
||||||
|
return self::update(['active' => $active], $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toggleVisible($id, $visible) {
|
||||||
|
return self::update(['visible' => $visible], $id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Core\User\Notifications;
|
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
use Illuminate\Notifications\Notification;
|
|
||||||
|
|
||||||
class NewUser extends Notification
|
|
||||||
{
|
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
|
||||||
{
|
|
||||||
return ['mail'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
|
||||||
{
|
|
||||||
$currentUser = \Auth::user();
|
|
||||||
|
|
||||||
return (new MailMessage())
|
|
||||||
->markdown('notifications.email')
|
|
||||||
->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name]))
|
|
||||||
->subject(__('notifications.newuser.subject', ['name' => config('app.name')]))
|
|
||||||
->line(
|
|
||||||
__(
|
|
||||||
'notifications.newuser.intro', [
|
|
||||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->action(
|
|
||||||
__('notifications.newuser.button'),
|
|
||||||
route('users.firstlogin', $notifiable->remember_token)
|
|
||||||
)
|
|
||||||
->salutation(
|
|
||||||
__(
|
|
||||||
'notifications.salutation', [
|
|
||||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->line(__('notifications.newuser.outro'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,12 +9,19 @@ class PasswordSecurities
|
|||||||
{
|
{
|
||||||
public static function create($user_id, $delay = 90)
|
public static function create($user_id, $delay = 90)
|
||||||
{
|
{
|
||||||
return PasswordSecurity::create(
|
return PasswordSecurity::create([
|
||||||
[
|
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'password_expiry_days' => $delay,
|
'password_expiry_days' => $delay,
|
||||||
'password_updated_at' => Carbon::now(),
|
'password_updated_at' => Carbon::now(),
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getUserName($id) {
|
||||||
|
return self::getUser($id)->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getUser($id) {
|
||||||
|
return PasswordSecurity::with('user')->find($id)->user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Core\User\Notifications;
|
|
||||||
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
|
|
||||||
class ResetPassword extends \Illuminate\Auth\Notifications\ResetPassword
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
public function toMail($notifiable)
|
|
||||||
{
|
|
||||||
return (new MailMessage())
|
|
||||||
->markdown('notifications.email')
|
|
||||||
->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name]))
|
|
||||||
->subject(__('notifications.resetpassword.subject'))
|
|
||||||
->line(__('notifications.resetpassword.intro'))
|
|
||||||
->action(
|
|
||||||
__('notifications.resetpassword.button'),
|
|
||||||
route('password.reset', $this->token)
|
|
||||||
)
|
|
||||||
->line(__('notifications.resetpassword.outro'));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Core\Auth;
|
namespace App\Repositories\Core\Auth;
|
||||||
|
|
||||||
use Hyn\Tenancy\Environment;
|
|
||||||
use Hyn\Tenancy\Database\Connection;
|
|
||||||
use App\Models\Admin\Website;
|
|
||||||
use Hyn\Tenancy\Contracts\Repositories\WebsiteRepository;
|
|
||||||
|
|
||||||
use App\Models\Core\Auth\UserClient;
|
use App\Models\Core\Auth\UserClient;
|
||||||
use App\Models\Core\Auth\User;
|
use App\Models\Core\Auth\User;
|
||||||
|
|
||||||
@@ -48,7 +43,7 @@ class UserClients
|
|||||||
{
|
{
|
||||||
$history = "";
|
$history = "";
|
||||||
foreach ($clients as $key => $client_id) {
|
foreach ($clients as $key => $client_id) {
|
||||||
$client = Clients::select_by_id($client_id);
|
$client = Clients::get($client_id);
|
||||||
if ($client) {
|
if ($client) {
|
||||||
self::associate_client($user_id, $client_id);
|
self::associate_client($user_id, $client_id);
|
||||||
$history .= $client['name'] . "| ";
|
$history .= $client['name'] . "| ";
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ use App\Models\Core\Auth\RoleUser;
|
|||||||
|
|
||||||
use App\Repositories\Clients;
|
use App\Repositories\Clients;
|
||||||
use App\Repositories\Partners;
|
use App\Repositories\Partners;
|
||||||
|
use App\Repositories\Core\Upload;
|
||||||
|
|
||||||
|
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
|
||||||
class Users
|
class Users
|
||||||
{
|
{
|
||||||
use LaratrustUserTrait;
|
use LaratrustUserTrait;
|
||||||
@@ -35,16 +37,18 @@ class Users
|
|||||||
$data = $user->toArray();
|
$data = $user->toArray();
|
||||||
$data['name'] = $user->name;
|
$data['name'] = $user->name;
|
||||||
$data['avatar'] = self::getAvatar($id);
|
$data['avatar'] = self::getAvatar($id);
|
||||||
$data['last_login'] = $user->previousLoginAt();
|
// $data['last_login'] = $user->previousLoginAt();
|
||||||
// $data['roles'] = self::getRoles();
|
// $data['roles'] = self::getRoles();
|
||||||
// $data['permissions'] = self::getPermissions();
|
// $data['permissions'] = self::getPermissions();
|
||||||
$data['roles'] = $user->roles->pluck('id')->toArray();
|
$data['roles'] = $user->roles->pluck('id')->toArray();
|
||||||
$data['permissions'] = $user->allPermissions()->pluck('id')->toArray();
|
$data['permissions'] = $user->allPermissions()->pluck('id')->toArray();
|
||||||
|
$data['clients'] = $user->clients->pluck('id')->toArray();
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function store($data)
|
public static function store($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
|
|
||||||
if (!empty($data['password'])) {
|
if (!empty($data['password'])) {
|
||||||
@@ -60,19 +64,20 @@ class Users
|
|||||||
$data['active'] = true;
|
$data['active'] = true;
|
||||||
|
|
||||||
$user = $id ? self::update($data, $id) : self::create($data);
|
$user = $id ? self::update($data, $id) : self::create($data);
|
||||||
|
$user->roles()->sync(array_keys($data['roles'] ?? []));
|
||||||
|
|
||||||
if (isset($data['roles'])) {
|
UserClients::associate($user->id, $data['clients'] ?? false );
|
||||||
$user->roles()->sync(array_keys($data['roles']));
|
|
||||||
}
|
|
||||||
// $user->sendNewUserNotification($data['remember_token'], Auth::user());
|
// $user->sendNewUserNotification($data['remember_token'], Auth::user());
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function create($data)
|
public static function create($data, $copy_password = false)
|
||||||
{
|
{
|
||||||
$data['password'] = $data['password'] ? Hash::make($data['password']) : Hash::make(Str::random(8));
|
$data['password'] = $copy_password ? $data['password'] : ($data['password'] ? Hash::make($data['password']) : Hash::make(Str::random(8)));
|
||||||
return User::create($data);
|
$user = User::create($data);
|
||||||
|
PasswordSecurities::create($user->id);
|
||||||
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
@@ -95,12 +100,17 @@ class Users
|
|||||||
return $user ? $user->id : false;
|
return $user ? $user->id : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getName()
|
public static function getName($id = false)
|
||||||
{
|
{
|
||||||
$user = self::getUser();
|
$user = $id ? self::get($id) : self::getUser();
|
||||||
return $user->first_name . ' ' . $user->last_name;
|
return $user->first_name . ' ' . $user->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getUsername($id = false)
|
||||||
|
{
|
||||||
|
return $id ? self::get($id)->username : self::getUser()->username;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getUser()
|
public static function getUser()
|
||||||
{
|
{
|
||||||
return Auth::user();
|
return Auth::user();
|
||||||
@@ -113,7 +123,7 @@ class Users
|
|||||||
|
|
||||||
public static function getOptions()
|
public static function getOptions()
|
||||||
{
|
{
|
||||||
return User::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray();
|
return User::orderBy('name')->pluck('name', 'id')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function delete($id)
|
public static function delete($id)
|
||||||
@@ -124,7 +134,7 @@ class Users
|
|||||||
|
|
||||||
public static function getListByRole($role)
|
public static function getListByRole($role)
|
||||||
{
|
{
|
||||||
return self::selectOptions()->orderBy('name', 'asc')->whereRoleIs($role)->get();
|
return self::selectOptions()->orderBy('name')->whereRoleIs($role)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function hasRole($role, $user = false)
|
public static function hasRole($role, $user = false)
|
||||||
@@ -211,37 +221,36 @@ class Users
|
|||||||
return User::count();
|
return User::count();
|
||||||
}
|
}
|
||||||
|
|
||||||
// récupère tous les utilisateurs pour un statut donné
|
|
||||||
public static function select_all_by_status_id($status_id)
|
public static function select_all_by_status_id($status_id)
|
||||||
{
|
{
|
||||||
return User::byStatus($status_id);
|
return User::byStatus($status_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// récupère toutes les informations d'un utilisateur pour un id donné
|
|
||||||
public static function select_by_id($user_id)
|
public static function select_by_id($user_id)
|
||||||
{
|
{
|
||||||
return User::with('status')->find($user_id)->toArray();
|
return User::with('status')->find($user_id)->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// récupère toutes les informations d'un utilisateur pour un nom donné
|
|
||||||
public static function select_by_name($name)
|
public static function select_by_name($name)
|
||||||
{
|
{
|
||||||
return User::byName($name)->first()->toArray();
|
return self::getByName($name)->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getByUsername($username)
|
||||||
|
{
|
||||||
|
return User::byUsername($username)->withTrashed()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
// récupère les utilisateurs actifs d'un statut, d'une équipe et d'une entité donnés
|
|
||||||
public static function select_by_status_and_team_and_entity($status_id, $team_id, $third_party_id)
|
public static function select_by_status_and_team_and_entity($status_id, $team_id, $third_party_id)
|
||||||
{
|
{
|
||||||
return User::active()->byStatus($status_id)->byTeam($team_id)->byThirdParty($third_party_id)->get()->toArray();
|
return User::active()->byStatus($status_id)->byTeam($team_id)->byThirdParty($third_party_id)->get()->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// récupère toutes les informations nécessaires d'un utilisateur pour un id donné
|
|
||||||
public static function select_datas_by_id($user_id)
|
public static function select_datas_by_id($user_id)
|
||||||
{
|
{
|
||||||
return User::with('status')->find($user_id)->toArray();
|
return User::with('status')->find($user_id)->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// met à jour le statut actif/inactif d'un utilisateur
|
|
||||||
public static function toggle_active($id, $active)
|
public static function toggle_active($id, $active)
|
||||||
{
|
{
|
||||||
return self::get($id)->update(['active' => $active]);
|
return self::get($id)->update(['active' => $active]);
|
||||||
@@ -251,26 +260,29 @@ class Users
|
|||||||
{
|
{
|
||||||
$targetDir = 'uploads';
|
$targetDir = 'uploads';
|
||||||
$file = $request->file('avatar_file');
|
$file = $request->file('avatar_file');
|
||||||
$data = \App\Repositories\Core\Upload::getData($file);
|
$data = Upload::getData($file);
|
||||||
$file_uploaded = \App\Repositories\Core\Upload::store($file, $targetDir);
|
$file_uploaded = Upload::store($file, $targetDir);
|
||||||
$tab = pathinfo($file_uploaded);
|
$tab = pathinfo($file_uploaded);
|
||||||
$response['name'] = $tab['basename'];
|
$response['name'] = $tab['basename'];
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// met à jour l'avatar d'un utilisateur
|
|
||||||
public static function update_avatar($id, $avatar)
|
public static function update_avatar($id, $avatar)
|
||||||
{
|
{
|
||||||
return User::find($id)->update(['avatar' => $avatar]);
|
return User::find($id)->update(['avatar' => $avatar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// met à jour le mot de passe d'un utilisateur
|
|
||||||
public static function update_password($id, $password)
|
public static function update_password($id, $password)
|
||||||
{
|
{
|
||||||
$password = Hash::make($password);
|
$password = Hash::make($password);
|
||||||
UserClients::changePasswordsByUser($id, $password);
|
UserClients::changePasswordsByUser($id, $password);
|
||||||
$connection = app(Connection::class);
|
return User::find($id)->update(['password' => $password]);
|
||||||
return User::on($connection->systemName())->find($id)->update(['password' => $password]);
|
// $connection = app(Connection::class);
|
||||||
|
// return User::on($connection->systemName())->find($id)->update(['password' => $password]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function validate($username, $field = 'current_password')
|
||||||
|
{
|
||||||
|
return PasswordRules::changePassword($username, $field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Comments
|
|||||||
|
|
||||||
public static function getClass($model)
|
public static function getClass($model)
|
||||||
{
|
{
|
||||||
return 'App\Models\\' . str_replace('.','\\', $model);
|
return 'App\Models\\' . str_replace('.', '\\', $model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByModel($model)
|
public static function getByModel($model)
|
||||||
@@ -94,5 +94,4 @@ class Comments
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Repositories\Core;
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Collective\Html\Eloquent\FormAccessible;
|
use Collective\Html\Eloquent\Form;
|
||||||
|
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ use Illuminate\Support\Str;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Jenssegers\Date\Date;
|
use Jenssegers\Date\Date;
|
||||||
|
|
||||||
use App\Repositories\Languages;
|
|
||||||
|
|
||||||
class DateCalculation
|
class DateCalculation
|
||||||
{
|
{
|
||||||
public static function isPast($date, $format = false)
|
public static function isPast($date, $format = false)
|
||||||
@@ -20,12 +18,12 @@ class DateCalculation
|
|||||||
return Carbon::createFromFormat(self::getFormat($format), $date)->greaterThan(Carbon::now());
|
return Carbon::createFromFormat(self::getFormat($format), $date)->greaterThan(Carbon::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isAfter($date1, $date2)
|
public static function isAfter($date1, $date2, $format = false)
|
||||||
{
|
{
|
||||||
return Carbon::createFromFormat(self::getFormat($format), $date1)->greaterThan(Carbon::createFromFormat(self::getFormat($format), $date2));
|
return Carbon::createFromFormat(self::getFormat($format), $date1)->greaterThan(Carbon::createFromFormat(self::getFormat($format), $date2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isBefore($date1, $date2)
|
public static function isBefore($date1, $date2, $format = false)
|
||||||
{
|
{
|
||||||
return Carbon::createFromFormat(self::getFormat($format), $date1)->lessThan(Carbon::createFromFormat(self::getFormat($format), $date2));
|
return Carbon::createFromFormat(self::getFormat($format), $date1)->lessThan(Carbon::createFromFormat(self::getFormat($format), $date2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ namespace App\Repositories\Core;
|
|||||||
|
|
||||||
class Export
|
class Export
|
||||||
{
|
{
|
||||||
|
public $xls;
|
||||||
|
public $sheet;
|
||||||
|
public $filename;
|
||||||
|
public $stockage;
|
||||||
|
public $lig;
|
||||||
|
public $nb;
|
||||||
|
public $debug;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
@@ -68,7 +76,7 @@ class Export
|
|||||||
$txt = $options[$key][$txt];
|
$txt = $options[$key][$txt];
|
||||||
}
|
}
|
||||||
if (isset($multioptions[$key])) {
|
if (isset($multioptions[$key])) {
|
||||||
$tabs = BaseController::getReverseMultiOptions($txt);
|
$tabs = self::getReverseMultiOptions($txt);
|
||||||
foreach ($tabs as $key2 => $value) {
|
foreach ($tabs as $key2 => $value) {
|
||||||
$txt .= $multioptions[$key][$key2] . '\n';
|
$txt .= $multioptions[$key][$key2] . '\n';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Core;
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class Stat
|
class Stat
|
||||||
{
|
{
|
||||||
public static $is_debug = false;
|
public static $is_debug = false;
|
||||||
@@ -17,48 +19,38 @@ class Stat
|
|||||||
return $model->where('created_at', '<', $end)->count();
|
return $model->where('created_at', '<', $end)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
fonctions de rendus
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static function renderStatsbyMultiVar($var, $var_option = '')
|
public static function renderStatsbyMultiVar($var, $var_option = '')
|
||||||
{
|
{
|
||||||
static::renderStatsJson(static::getStatsbyMultiVar($var, $var_option));
|
self::renderStatsJson(self::getStatsbyMultiVar($var, $var_option));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function renderStatsbyVar($var)
|
public static function renderStatsbyVar($var)
|
||||||
{
|
{
|
||||||
static::renderStatsJson(static::getStatsbyVar($var));
|
self::renderStatsJson(self::getStatsbyVar($var));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function renderStatsbyOptions($var, $var_option = '')
|
public static function renderStatsbyOptions($var, $var_option = '')
|
||||||
{
|
{
|
||||||
static::renderStatsJson(static::getStatsbyOptions($var, $var_option));
|
self::renderStatsJson(self::getStatsbyOptions($var, $var_option));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function renderStatsJson($data)
|
public static function renderStatsJson($data)
|
||||||
{
|
{
|
||||||
Response::headers()->set('Content-Type', 'application/json');
|
return json_encode($data, JSON_NUMERIC_CHECK);
|
||||||
Response::setBody(json_encode($data, JSON_NUMERIC_CHECK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Fonctions internes
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static function getStatsbyMultiVar($var, $var_option = '')
|
public static function getStatsbyMultiVar($var, $var_option = '')
|
||||||
{
|
{
|
||||||
if (empty($var_option)) {
|
if (empty($var_option)) {
|
||||||
$var_option = $var;
|
$var_option = $var;
|
||||||
}
|
}
|
||||||
$options = self::getInstance()->controller->getOption($var_option);
|
$options = self::getOption($var_option);
|
||||||
return self::getInstance()->getStatsbyMultiOptions($var, $options);
|
return self::getStatsbyMultiOptions($var, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCountByPeriod($var, $begin, $end)
|
public static function getCountByPeriod($var, $begin, $end)
|
||||||
{
|
{
|
||||||
$count = static::getModel()
|
$count = self::getModel()
|
||||||
->whereBetween($var, $begin, $end)
|
->whereBetween($var, $begin, $end)
|
||||||
->count();
|
->count();
|
||||||
return $count;
|
return $count;
|
||||||
@@ -67,7 +59,7 @@ class Stat
|
|||||||
public static function getCountbyVar($var)
|
public static function getCountbyVar($var)
|
||||||
{
|
{
|
||||||
$db = self::getInstance()->app->db;
|
$db = self::getInstance()->app->db;
|
||||||
$data = static::getModel()
|
$data = self::getModel()
|
||||||
->select($db::raw("count(id) as y, $var as name"))
|
->select($db::raw("count(id) as y, $var as name"))
|
||||||
->groupBy($var)
|
->groupBy($var)
|
||||||
->get();
|
->get();
|
||||||
@@ -82,7 +74,7 @@ class Stat
|
|||||||
$var_option = $var;
|
$var_option = $var;
|
||||||
}
|
}
|
||||||
$options = self::getInstance()->controller->getOption($var_option);
|
$options = self::getInstance()->controller->getOption($var_option);
|
||||||
$nb = static::getCountbyOption($var);
|
$nb = self::getCountbyOption($var);
|
||||||
// var_Debug::message($nb);
|
// var_Debug::message($nb);
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
$y = (int) $nb[$key];
|
$y = (int) $nb[$key];
|
||||||
@@ -95,7 +87,7 @@ class Stat
|
|||||||
public static function getCountbyOption($var)
|
public static function getCountbyOption($var)
|
||||||
{
|
{
|
||||||
$db = self::getInstance()->app->db;
|
$db = self::getInstance()->app->db;
|
||||||
$data = static::getModel()
|
$data = self::getModel()
|
||||||
->select($db::raw('count(id) as nb'))
|
->select($db::raw('count(id) as nb'))
|
||||||
->groupBy($var)
|
->groupBy($var)
|
||||||
->get();
|
->get();
|
||||||
@@ -112,7 +104,7 @@ class Stat
|
|||||||
public static function getStatsbyMultiOptions($var, $options)
|
public static function getStatsbyMultiOptions($var, $options)
|
||||||
{
|
{
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
$nb = static::getCountbyBin($var, $key);
|
$nb = self::getCountbyBin($var, $key);
|
||||||
$data[] = ['y' => $nb, 'name' => $value];
|
$data[] = ['y' => $nb, 'name' => $value];
|
||||||
}
|
}
|
||||||
return ($data);
|
return ($data);
|
||||||
@@ -121,7 +113,7 @@ class Stat
|
|||||||
public static function getCountbyBin($var, $value)
|
public static function getCountbyBin($var, $value)
|
||||||
{
|
{
|
||||||
$bit = pow(2, $value);
|
$bit = pow(2, $value);
|
||||||
$count = static::getModel()
|
$count = self::getModel()
|
||||||
->where($var, '&', $bit)
|
->where($var, '&', $bit)
|
||||||
->count();
|
->count();
|
||||||
return $count;
|
return $count;
|
||||||
@@ -149,7 +141,7 @@ class Stat
|
|||||||
|
|
||||||
public static function serializeValues($tab)
|
public static function serializeValues($tab)
|
||||||
{
|
{
|
||||||
return static::serializeByVar($tab, 'count');
|
return self::serializeByVar($tab, 'count');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function serializeByVar($tab, $var, $n = 0)
|
public static function serializeByVar($tab, $var, $n = 0)
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ class Upload
|
|||||||
{
|
{
|
||||||
$data = (is_array($data)) ? (object) $data : $data;
|
$data = (is_array($data)) ? (object) $data : $data;
|
||||||
$pos = strrpos($file, '/');
|
$pos = strrpos($file, '/');
|
||||||
$uuid = substr($file, $pos+1);
|
$uuid = substr($file, $pos + 1);
|
||||||
$uuid = pathinfo($uuid, PATHINFO_FILENAME);
|
$uuid = pathinfo($uuid, PATHINFO_FILENAME);
|
||||||
// $uuid = str_replace('.' . strtolower($data->filetype), '', $uuid);
|
|
||||||
// $uuid = str_replace('.' . $data->filetype, '', $uuid);
|
|
||||||
return $uuid;
|
return $uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +34,7 @@ class Upload
|
|||||||
// $path = Storage::putFile('avatars', $request->file('avatar'));
|
// $path = Storage::putFile('avatars', $request->file('avatar'));
|
||||||
// $path = $request->file('avatar')->storeAs('avatars',$request->user()->id,'s3');
|
// $path = $request->file('avatar')->storeAs('avatars',$request->user()->id,'s3');
|
||||||
// $path = $request->file('avatar')->storePublicly('avatars', 's3');
|
// $path = $request->file('avatar')->storePublicly('avatars', 's3');
|
||||||
|
$request = Request();
|
||||||
return $request->has($var) ? basename($request->file($var)->store($path)) : false;
|
return $request->has($var) ? basename($request->file($var)->store($path)) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,27 +127,17 @@ class Upload
|
|||||||
if (Storage::exists($dest)) {
|
if (Storage::exists($dest)) {
|
||||||
self::delete($dest);
|
self::delete($dest);
|
||||||
}
|
}
|
||||||
return Storage::move($source, $dest); // transfère et renomme le fichier du dossier temporaire au dossier du client
|
return Storage::move($source, $dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function delete($file)
|
public static function delete($file)
|
||||||
{
|
{
|
||||||
// Storage::delete($file);
|
return Storage::exists($file) ? Storage::delete($file) : false;
|
||||||
// return unlink($file);
|
|
||||||
return Storage::delete($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function deleteFile($path)
|
|
||||||
{
|
|
||||||
if (!Storage::exists($path)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Storage::delete($path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteRecursive($path)
|
public static function deleteRecursive($path)
|
||||||
{
|
{
|
||||||
rmdir_recursive($targetDir);
|
return rmdir_recursive($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function make_dir($path, $permissions = 0777)
|
public function make_dir($path, $permissions = 0777)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Repositories\Core\User;
|
namespace App\Repositories\Core\User;
|
||||||
|
|
||||||
use App\Repositories\Core\Auth\Users;
|
use App\Repositories\Core\Auth\Users;
|
||||||
|
use \Cart;
|
||||||
|
|
||||||
class ShopCart
|
class ShopCart
|
||||||
{
|
{
|
||||||
@@ -11,8 +12,40 @@ class ShopCart
|
|||||||
return self::get()->add($data);
|
return self::get()->add($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function remove($id)
|
||||||
|
{
|
||||||
|
return self::get()->remove($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function clear()
|
||||||
|
{
|
||||||
|
Cart::session(1)->clear();
|
||||||
|
return Cart::clear();
|
||||||
|
// return self::get()->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function has($id)
|
||||||
|
{
|
||||||
|
return array_key_exists($id, self::getContent()->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function keys()
|
||||||
|
{
|
||||||
|
return array_keys(self::getContent()->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function count()
|
||||||
|
{
|
||||||
|
return self::getContent()->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getContent()
|
||||||
|
{
|
||||||
|
return self::get()->getContent();
|
||||||
|
}
|
||||||
|
|
||||||
public static function get()
|
public static function get()
|
||||||
{
|
{
|
||||||
return \Cart::session(Users::getId());
|
return Cart::session(Users::getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
38
app/Repositories/Core/User/ShopCartStorage.php
Normal file
38
app/Repositories/Core/User/ShopCartStorage.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core\User;
|
||||||
|
|
||||||
|
use Darryldecode\Cart\CartCollection;
|
||||||
|
|
||||||
|
use App\Models\Core\CartStorage;
|
||||||
|
use App\Repositories\Core\Auth\Users;
|
||||||
|
|
||||||
|
class ShopCartStorage
|
||||||
|
{
|
||||||
|
public function has($key)
|
||||||
|
{
|
||||||
|
return CartStorage::find($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($key)
|
||||||
|
{
|
||||||
|
if ($this->has($key)) {
|
||||||
|
return new CartCollection(CartStorage::find($key)->cart_data);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function put($key, $value)
|
||||||
|
{
|
||||||
|
if ($row = CartStorage::find($key)) {
|
||||||
|
$row->cart_data = $value;
|
||||||
|
$row->save();
|
||||||
|
} else {
|
||||||
|
CartStorage::create([
|
||||||
|
'id' => $key,
|
||||||
|
'cart_data' => $value
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Shop;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
|
||||||
|
|
||||||
use App\Models\Shop\ArticleComponent;
|
|
||||||
|
|
||||||
class ArticleComponents
|
|
||||||
{
|
|
||||||
public static function getDatatable()
|
|
||||||
{
|
|
||||||
$model = ArticleComponent::orderBy('name');
|
|
||||||
return Datatables::of($model)->make(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getAll()
|
|
||||||
{
|
|
||||||
return ArticleComponent::orderBy('name', 'asc')->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function get($id)
|
|
||||||
{
|
|
||||||
return ArticleComponent::find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function store($data)
|
|
||||||
{
|
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
|
||||||
$item = $id ? self::update($data) : self::create($data);
|
|
||||||
return $item->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function create($data)
|
|
||||||
{
|
|
||||||
return ArticleComponent::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function update($data)
|
|
||||||
{
|
|
||||||
return ArticleComponent::find($id)->update($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function destroy($id)
|
|
||||||
{
|
|
||||||
return ArticleComponent::destroy($id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Shop;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
|
||||||
|
|
||||||
use App\Models\Shop\ArticlePrice;
|
|
||||||
|
|
||||||
class ArticlePrices
|
|
||||||
{
|
|
||||||
public static function getByArticle($id)
|
|
||||||
{
|
|
||||||
return ArticlePrice::byArticle($id)->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getByArticleWithAttribute($id)
|
|
||||||
{
|
|
||||||
return ArticlePrice::with('article_attribute.attribute_value')->byArticle($id)->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getDatatable()
|
|
||||||
{
|
|
||||||
$model = ArticlePrice::orderBy('name');
|
|
||||||
return Datatables::of($model)->make(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getAll()
|
|
||||||
{
|
|
||||||
return ArticlePrice::orderBy('name', 'asc')->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function get($id)
|
|
||||||
{
|
|
||||||
return ArticlePrice::find($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function storePrices($article_id, $prices)
|
|
||||||
{
|
|
||||||
// dump($article_id);
|
|
||||||
// dump($prices);
|
|
||||||
// exit;
|
|
||||||
if ($prices) {
|
|
||||||
foreach ($prices as $key => $price) {
|
|
||||||
$price['article_attribute']['article_attribute_value_id'] = $price['attribute']['attribute_value_id'];
|
|
||||||
$prices[$key]['article_attribute_id'] = ArticleAttributes::storeAttribute($article_id, $price['article_attribute']);
|
|
||||||
|
|
||||||
unset($prices[$key]['article_attribute']);
|
|
||||||
unset($prices[$key]['attribute']);
|
|
||||||
self::store($prices[$key]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function store($data)
|
|
||||||
{
|
|
||||||
$attributes = isset($data['attributes']) ? $data['attributes'] : false;
|
|
||||||
unset($data['attributes']);
|
|
||||||
|
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
|
||||||
$price = $id ? self::update($data) : self::create($data);
|
|
||||||
|
|
||||||
$ret = $attributes ? self::storeAttributes($price->id, $attributes) : false;
|
|
||||||
|
|
||||||
return $price->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function storeAttributes($article_price_id, $attributes)
|
|
||||||
{
|
|
||||||
return ArticleAttributes::storeAttribute($article_price_id, $attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function create($data)
|
|
||||||
{
|
|
||||||
return ArticlePrice::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function update($data, $id = false)
|
|
||||||
{
|
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
|
||||||
$article = ArticlePrice::find($id);
|
|
||||||
$article->update($data);
|
|
||||||
return $article;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function destroy($id)
|
|
||||||
{
|
|
||||||
return ArticlePrice::destroy($id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -172,7 +172,7 @@ class Articles
|
|||||||
|
|
||||||
public static function getByCategory($category_id)
|
public static function getByCategory($category_id)
|
||||||
{
|
{
|
||||||
return Article::byCategory($category_id)->with(['prices','product','image'])->get();
|
return Article::byCategory($category_id)->with(['prices', 'product', 'image'])->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCategoriesByArticle($article)
|
public static function getCategoriesByArticle($article)
|
||||||
@@ -223,7 +223,6 @@ class Articles
|
|||||||
self::storeImages($article, $images);
|
self::storeImages($article, $images);
|
||||||
self::storeCategories($article, $categories);
|
self::storeCategories($article, $categories);
|
||||||
self::storeTags($article, $tags);
|
self::storeTags($article, $tags);
|
||||||
self::storePrices($article, $prices);
|
|
||||||
return $article->id;
|
return $article->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,11 +269,6 @@ class Articles
|
|||||||
return Tag::storeTags($article, $tags);
|
return Tag::storeTags($article, $tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storePrices($article, $prices)
|
|
||||||
{
|
|
||||||
return ArticlePrices::storePrices($article->id, $prices);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function storeImages($article, $files)
|
public static function storeImages($article, $files)
|
||||||
{
|
{
|
||||||
return Medias::storeImages($article, $files);
|
return Medias::storeImages($article, $files);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Categories
|
|||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $data['id'];
|
$id = $id ? $id : $data['id'];
|
||||||
$category = Category::find($id);
|
$category = self::get($id);
|
||||||
$ret = $category->update($data);
|
$ret = $category->update($data);
|
||||||
CategoryTrees::update($data, $category->category_id);
|
CategoryTrees::update($data, $category->category_id);
|
||||||
return $category;
|
return $category;
|
||||||
@@ -127,7 +127,7 @@ class Categories
|
|||||||
public static function destroy($id)
|
public static function destroy($id)
|
||||||
{
|
{
|
||||||
$category = self::get($id);
|
$category = self::get($id);
|
||||||
self::deleteNode($category->category_id);
|
CategoryTrees::destroy($category->category_id);
|
||||||
return Category::destroy($id);
|
return Category::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
73
app/Repositories/Shop/Merchandises.php
Normal file
73
app/Repositories/Shop/Merchandises.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
|
use App\Models\Shop\Merchandise;
|
||||||
|
|
||||||
|
class Merchandises
|
||||||
|
{
|
||||||
|
public static function autocomplete($str)
|
||||||
|
{
|
||||||
|
$data = Merchandise::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||||
|
$export = [];
|
||||||
|
foreach ($data as $key => $name) {
|
||||||
|
$export[] = ['value' => $key, 'text' => $name];
|
||||||
|
}
|
||||||
|
return $export;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPrices($id)
|
||||||
|
{
|
||||||
|
return Merchandise::with(['price_lists.price_list_values', 'price_lists.sale_channel'])->find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOptions()
|
||||||
|
{
|
||||||
|
return Merchandise::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStatus($status_id)
|
||||||
|
{
|
||||||
|
return self::getStatuses()[$status_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStatuses()
|
||||||
|
{
|
||||||
|
return ['Actif','Suspendu','Invisible','Obsolete'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAll()
|
||||||
|
{
|
||||||
|
return Merchandise::orderBy('name', 'asc')->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
|
{
|
||||||
|
return Merchandise::find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function store($data)
|
||||||
|
{
|
||||||
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
|
$item = $id ? self::update($data, $id) : self::create($data);
|
||||||
|
return $item->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create($data)
|
||||||
|
{
|
||||||
|
return Merchandise::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function update($data, $id = false)
|
||||||
|
{
|
||||||
|
$id = $id ? $id : $data['id'];
|
||||||
|
$item = self::get($id);
|
||||||
|
$item->update($data);
|
||||||
|
return $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function destroy($id)
|
||||||
|
{
|
||||||
|
return Merchandise::destroy($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,7 @@
|
|||||||
"santigarcor/laratrust": "^6.0",
|
"santigarcor/laratrust": "^6.0",
|
||||||
"sebastienheyd/boilerplate": "^7.5",
|
"sebastienheyd/boilerplate": "^7.5",
|
||||||
"smajohusic/laravel-mail-logger": "^1.0",
|
"smajohusic/laravel-mail-logger": "^1.0",
|
||||||
|
"softcreatr/php-mime-detector": "^3.2",
|
||||||
"spatie/eloquent-sortable": "^3.11",
|
"spatie/eloquent-sortable": "^3.11",
|
||||||
"spatie/image-optimizer": "^1.4",
|
"spatie/image-optimizer": "^1.4",
|
||||||
"spatie/laravel-activitylog": "^3.6",
|
"spatie/laravel-activitylog": "^3.6",
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ return [
|
|||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
*/
|
*/
|
||||||
|
Darryldecode\Cart\CartServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
@@ -226,6 +227,7 @@ return [
|
|||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
|
||||||
|
'Cart' => Darryldecode\Cart\Facades\CartFacade::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
161
phpcs.xml
Normal file
161
phpcs.xml
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="Laravel Standards">
|
||||||
|
<description>PSR-2 The Laravel conventions</description>
|
||||||
|
<rule ref="Generic.Classes.DuplicateClassName">
|
||||||
|
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
|
||||||
|
<exclude-pattern>/app/Http/Resources/*\.php</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||||
|
<rule ref="Generic.Commenting.DocComment">
|
||||||
|
<exclude name="Generic.Commenting.DocComment.TagValueIndent"/>
|
||||||
|
<exclude name="Generic.Commenting.DocComment.NonParamGroup"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
||||||
|
<rule ref="Generic.Files.ByteOrderMark"/>
|
||||||
|
<rule ref="Generic.Files.LineEndings">
|
||||||
|
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||||
|
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
||||||
|
<rule ref="Generic.Functions.CallTimePassByReference"/>
|
||||||
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||||
|
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
|
||||||
|
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||||
|
<properties>
|
||||||
|
<property name="complexity" value="20"/>
|
||||||
|
<property name="absoluteComplexity" value="25"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
|
<properties>
|
||||||
|
<property name="nestingLevel" value="5"/>
|
||||||
|
<property name="absoluteNestingLevel" value="15"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||||
|
<rule ref="Generic.PHP.LowerCaseConstant"/>
|
||||||
|
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
||||||
|
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
||||||
|
<rule ref="Generic.PHP.ForbiddenFunctions"/>
|
||||||
|
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||||
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
|
<properties>
|
||||||
|
<property name="indent" value="4"/>
|
||||||
|
<property name="tabIndent" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="MySource.PHP.EvalObjectFactory"/>
|
||||||
|
<rule ref="PSR1.Classes.ClassDeclaration"/>
|
||||||
|
<rule ref="PSR1.Files.SideEffects"/>
|
||||||
|
<rule ref="PSR2.Classes.ClassDeclaration"/>
|
||||||
|
<rule ref="PSR2.Classes.PropertyDeclaration"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
||||||
|
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
|
||||||
|
<rule ref="PSR2.Files.EndFileNewline"/>
|
||||||
|
<rule ref="PSR2.Methods.MethodDeclaration"/>
|
||||||
|
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
|
||||||
|
<rule ref="PSR2.Namespaces.UseDeclaration"/>
|
||||||
|
<rule ref="PSR1">
|
||||||
|
<exclude-pattern>*.php</exclude-pattern>
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||||
|
|
||||||
|
<exclude-pattern>database/*</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE" />
|
||||||
|
<properties>
|
||||||
|
<property name="lineLimit" value="130"/>
|
||||||
|
<property name="absoluteLineLimit" value="135"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.Arrays.ArrayDeclaration">
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed" />
|
||||||
|
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.NewlineBeforeOpenBrace" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified" />
|
||||||
|
<exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.PHP.CommentedOutCode"/>
|
||||||
|
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
|
||||||
|
<rule ref="Squiz.PHP.DiscouragedFunctions">
|
||||||
|
<properties>
|
||||||
|
<property name="error" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.PHP.Eval"/>
|
||||||
|
<rule ref="Squiz.PHP.GlobalKeyword"/>
|
||||||
|
<rule ref="Squiz.PHP.Heredoc"/>
|
||||||
|
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
|
||||||
|
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
||||||
|
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||||
|
<rule ref="Squiz.Scope.MethodScope"/>
|
||||||
|
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
|
||||||
|
<properties>
|
||||||
|
<property name="ignoreNewlines" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
|
||||||
|
<properties>
|
||||||
|
<property name="ignoreNewlines" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
|
||||||
|
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||||
|
<rule ref="Zend.Files.ClosingTag"/>
|
||||||
|
|
||||||
|
<file>app</file>
|
||||||
|
<file>config</file>
|
||||||
|
<file>public</file>
|
||||||
|
<file>resources</file>
|
||||||
|
<file>routes</file>
|
||||||
|
<file>tests</file>
|
||||||
|
|
||||||
|
<exclude-pattern>*/.phpstorm.meta.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/_ide_helper.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/database/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/cache/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.js</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.css</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.xml</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.blade.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/autoload.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/storage/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/docs/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/migrations/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/config/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/public/index.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/*.blade.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Console/Kernel.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Exceptions/Handler.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Http/Kernel.php</exclude-pattern>
|
||||||
|
<exclude-pattern>*/Providers/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/resources/lang/*</exclude-pattern>
|
||||||
|
|
||||||
|
<arg name="colors"/>
|
||||||
|
<arg value="spv"/>
|
||||||
|
<ini name="memory_limit" value="128M"/>
|
||||||
|
</ruleset>
|
||||||
@@ -4,8 +4,6 @@
|
|||||||
'breadcrumb' => [__('shop.articles.title')]
|
'breadcrumb' => [__('shop.articles.title')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('load.form.select2')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Admin.Shop.Articles.index'), 'model' => 'articles', 'with_filters' => true])
|
@include('components.datatable', ['route' => route('Admin.Shop.Articles.index'), 'model' => 'articles', 'with_filters' => true])
|
||||||
@@ -15,3 +13,4 @@
|
|||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@include('load.form.select2')
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
@extends('layout.index', [
|
|
||||||
'title' => __('shop.packages.title'),
|
|
||||||
'subtitle' => __('shop.packages.list'),
|
|
||||||
'breadcrumb' => [__('shop.packages.title')]
|
|
||||||
])
|
|
||||||
|
|
||||||
@include('boilerplate::load.select2')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<div class="nav nav-tabs">
|
|
||||||
<a href="#families" data-toggle="tab" class="nav-item nav-link" role="tab" aria-controls="families" aria-selected="true">
|
|
||||||
{{ __('shop.packages.title') }}
|
|
||||||
</a>
|
|
||||||
<a href="#values" data-toggle="tab" class="nav-item nav-link active" role="tab" aria-controls="values" aria-selected="false">
|
|
||||||
{{ __('shop.packages.title') }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="tab-content mb-0">
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="families">
|
|
||||||
@section('content')
|
|
||||||
@include('components.datatable', ['route' => route('Admin.Shop.Unities.index'), 'model' => 'ArticleAttributefamilies'])
|
|
||||||
@endsection
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="values">
|
|
||||||
@section('content')
|
|
||||||
@component('components.card')
|
|
||||||
@include('components.datatable', ['route' => route('Admin.Shop.ArticleAttributeValues.index'), 'model' => 'Unities'])
|
|
||||||
@endcomponent
|
|
||||||
|
|
||||||
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-filters'])
|
|
||||||
@include('Admin.Shop.Unities.partials.filters')
|
|
||||||
@endcomponent
|
|
||||||
@endsection
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@push('scripts')
|
|
||||||
@include('components.js.datatable', ['route' => route('Admin.Shop.Unities.index'), 'model' => 'Unities'])
|
|
||||||
@endpush
|
|
||||||
@@ -5,13 +5,10 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Admin.Shop.Packages.index'), 'model' => 'packages', 'with_filters' => true])
|
@include('components.datatable', ['route' => route('Admin.Shop.Packages.index'), 'model' => 'packages', 'with_filters' => true])
|
||||||
@endcomponent
|
|
||||||
|
|
||||||
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-packages-filters'])
|
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-packages-filters'])
|
||||||
@include('Admin.Shop.Packages.partials.filters')
|
@include('Admin.Shop.Packages.partials.filters')
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@include('load.datatables')
|
|
||||||
|
|
||||||
<div id="{{ $model }}-datatable-content">
|
<div id="{{ $model }}-datatable-content">
|
||||||
@include('components.datatables.header')
|
@include('components.datatables.header')
|
||||||
@if ($dataTable)
|
@if ($dataTable)
|
||||||
@@ -7,6 +5,15 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (($with_filters ?? false) && false)
|
||||||
|
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-' . $model . '-filters'])
|
||||||
|
@dd($route)
|
||||||
|
@include('Admin.Shop.' . ucfirst($model) . '.partials.filters')
|
||||||
|
@endcomponent
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@include('load.datatables')
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
@include('components.datatables.js.datatable')
|
@include('components.datatables.js.datatable')
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user