phpstan
This commit is contained in:
parent
2104c27427
commit
222347d890
70 changed files with 1492 additions and 1065 deletions
|
|
@ -26,28 +26,28 @@ class CreateAdmin extends Command
|
|||
/**
|
||||
* The firstname of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $firstname;
|
||||
|
||||
/**
|
||||
* The lastname of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $lastname;
|
||||
|
||||
/**
|
||||
* The email of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* The password of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ enum StaticPageType: int
|
|||
|
||||
/**
|
||||
* Optionnal labels definition.
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::contact->name => 'enums.static_page_type.contact',
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class ConceptController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $concepts */
|
||||
$concepts = Concept::query();
|
||||
|
|
@ -51,9 +51,9 @@ class ConceptController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if (Concept::count() === 8) {
|
||||
return back()
|
||||
|
|
@ -73,9 +73,9 @@ class ConceptController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Concepts\StoreConceptRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreConceptRequest $request)
|
||||
public function store(StoreConceptRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$concept = new Concept();
|
||||
|
|
@ -106,9 +106,9 @@ class ConceptController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Concept $concept
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Concept $concept)
|
||||
public function edit(Concept $concept): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.concepts.edit', [
|
||||
'conceptModel' => $concept
|
||||
|
|
@ -120,9 +120,9 @@ class ConceptController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Concepts\UpdateConceptRequest $request
|
||||
* @param \App\Models\Concept $concept
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateConceptRequest $request, Concept $concept)
|
||||
public function update(UpdateConceptRequest $request, Concept $concept): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $concept) {
|
||||
$concept->fill(array_replace_recursive(
|
||||
|
|
@ -151,9 +151,9 @@ class ConceptController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Concept $concept
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Concept $concept)
|
||||
public function destroy(Concept $concept): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($concept->deleteOrFail()) {
|
||||
return redirect()
|
||||
|
|
|
|||
|
|
@ -6,20 +6,17 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Requests\Bo\Homes\UpdateHomeRequest;
|
||||
use App\Models\Home;
|
||||
use App\Models\Product;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
use HasPicture;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit()
|
||||
public function edit(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$homeModel = Home::query()->firstOrFail();
|
||||
$products = Product::query()->where('status', true)->orderBy('label', 'ASC')->get();
|
||||
|
|
@ -32,9 +29,9 @@ class HomeController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Homes\UpdateHomeRequest $request
|
||||
* @param \App\Models\Home $home
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateHomeRequest $request, Home $home)
|
||||
public function update(UpdateHomeRequest $request, Home $home): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $home) {
|
||||
$data = $request->validated();
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class NewsController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $news */
|
||||
$news = News::query();
|
||||
|
|
@ -52,9 +52,9 @@ class NewsController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.news.create');
|
||||
}
|
||||
|
|
@ -63,9 +63,9 @@ class NewsController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\News\StoreNewsRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreNewsRequest $request)
|
||||
public function store(StoreNewsRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$news = new News();
|
||||
|
|
@ -96,9 +96,9 @@ class NewsController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(News $news)
|
||||
public function edit(News $news): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.news.edit', [
|
||||
'newsModel' => $news
|
||||
|
|
@ -110,9 +110,9 @@ class NewsController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\News\UpdateNewsRequest $request
|
||||
* @param \App\Models\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateNewsRequest $request, News $news)
|
||||
public function update(UpdateNewsRequest $request, News $news): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $news) {
|
||||
$news->fill(array_replace_recursive(
|
||||
|
|
@ -141,9 +141,9 @@ class NewsController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\News $news
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(News $news)
|
||||
public function destroy(News $news): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($news->deleteOrFail()) {
|
||||
return redirect()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use App\Models\Product;
|
|||
use App\Models\Range;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -18,16 +17,15 @@ use Illuminate\Support\Str;
|
|||
class ProductController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \App\Http\Requests\ProductIndexFilterRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(ProductIndexFilterRequest $request)
|
||||
public function index(ProductIndexFilterRequest $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $product */
|
||||
$product = Product::query();
|
||||
|
|
@ -60,9 +58,9 @@ class ProductController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$rangeModels = Range::orderBy('label', 'ASC')->get();
|
||||
|
||||
|
|
@ -73,14 +71,14 @@ class ProductController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Products\StoreProductRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreProductRequest $request)
|
||||
public function store(StoreProductRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$product = new Product();
|
||||
$tmpNutrionnalValues = \collect($request->validated()['nutritionnal_values']);
|
||||
$tmpList = \collect($request->validated()['list']);
|
||||
$tmpNutrionnalValues = $request->validated()['nutritionnal_values'];
|
||||
$tmpList = $request->validated()['list'];
|
||||
$product->fill($request->validated());
|
||||
$product->nutritionnal_values = $tmpNutrionnalValues;
|
||||
$product->list = $tmpList;
|
||||
|
|
@ -106,9 +104,9 @@ class ProductController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \App\Models\Product $product
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Product $product)
|
||||
public function edit(Product $product): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$rangeModels = Range::orderBy('label', 'ASC')->get();
|
||||
|
||||
|
|
@ -123,13 +121,13 @@ class ProductController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Products\UpdateProductRequest $request
|
||||
* @param \App\Models\Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateProductRequest $request, Product $product)
|
||||
public function update(UpdateProductRequest $request, Product $product): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $product) {
|
||||
$tmpNutrionnalValues = \collect($request->validated()['nutritionnal_values']);
|
||||
$tmpList = \collect($request->validated()['list']);
|
||||
$tmpNutrionnalValues = $request->validated()['nutritionnal_values'];
|
||||
$tmpList = $request->validated()['list'];
|
||||
$product->fill($request->validated());
|
||||
$product->nutritionnal_values = $tmpNutrionnalValues;
|
||||
$product->list = $tmpList;
|
||||
|
|
@ -154,9 +152,9 @@ class ProductController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
public function destroy(Product $product): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($product) {
|
||||
$product->recipes()->detach();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\Bo\Ranges\UpdateRangeRequest;
|
|||
use App\Models\Range;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -16,16 +15,15 @@ use Illuminate\Support\Str;
|
|||
class RangeController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $range */
|
||||
$range = Range::query();
|
||||
|
|
@ -50,9 +48,9 @@ class RangeController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.ranges.create');
|
||||
}
|
||||
|
|
@ -61,9 +59,9 @@ class RangeController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Ranges\StoreRangeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreRangeRequest $request)
|
||||
public function store(StoreRangeRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$range = new Range();
|
||||
|
|
@ -90,9 +88,9 @@ class RangeController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Range $range)
|
||||
public function edit(Range $range): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.ranges.edit', ['rangeModel' => $range]);
|
||||
}
|
||||
|
|
@ -102,9 +100,9 @@ class RangeController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Ranges\UpdateRangeRequest $request
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateRangeRequest $request, Range $range)
|
||||
public function update(UpdateRangeRequest $request, Range $range): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $range) {
|
||||
$range->fill($request->validated());
|
||||
|
|
@ -124,9 +122,9 @@ class RangeController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Range $range
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Range $range)
|
||||
public function destroy(Range $range): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($range->deleteOrFail()) {
|
||||
return redirect()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use App\Models\Range;
|
|||
use App\Models\Recipe;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -17,16 +16,15 @@ use Illuminate\Support\Str;
|
|||
class RecipeController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $recipe */
|
||||
$recipe = Recipe::query();
|
||||
|
|
@ -51,9 +49,9 @@ class RecipeController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$rangeModels = Range::orderBy('order', 'ASC')->get();
|
||||
|
||||
|
|
@ -64,13 +62,13 @@ class RecipeController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Recipes\StoreRecipeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreRecipeRequest $request)
|
||||
public function store(StoreRecipeRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$recipe = new Recipe();
|
||||
$tmpIngredients = \collect($request->validated()['ingredients'])->sortKeys();
|
||||
$tmpIngredients = \collect($request->validated()['ingredients'])->sortKeys()->toArray();
|
||||
$recipe->fill($request->validated());
|
||||
$recipe->ingredients = $tmpIngredients;
|
||||
|
||||
|
|
@ -95,9 +93,9 @@ class RecipeController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Recipe $recipe
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Recipe $recipe)
|
||||
public function edit(Recipe $recipe): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$rangeModels = Range::orderBy('order', 'ASC')->get();
|
||||
|
||||
|
|
@ -112,12 +110,12 @@ class RecipeController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Recipes\UpdateRecipeRequest $request
|
||||
* @param \App\Models\Recipe $recipe
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateRecipeRequest $request, Recipe $recipe)
|
||||
public function update(UpdateRecipeRequest $request, Recipe $recipe): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $recipe) {
|
||||
$tmpIngredients = \collect($request->validated()['ingredients'])->sortKeys();
|
||||
$tmpIngredients = \collect($request->validated()['ingredients'])->sortKeys()->toArray();
|
||||
$recipe->fill($request->validated());
|
||||
$recipe->ingredients = $tmpIngredients;
|
||||
|
||||
|
|
@ -142,9 +140,9 @@ class RecipeController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Recipe $recipe
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Recipe $recipe)
|
||||
public function destroy(Recipe $recipe): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($recipe) {
|
||||
$recipe->products()->detach();
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ class SliderController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $sliders */
|
||||
$sliders = Slider::query();
|
||||
|
|
@ -49,9 +49,9 @@ class SliderController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.sliders.create');
|
||||
}
|
||||
|
|
@ -60,9 +60,9 @@ class SliderController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Sliders\StoreSliderRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreSliderRequest $request)
|
||||
public function store(StoreSliderRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$slider = new Slider();
|
||||
|
|
@ -89,9 +89,9 @@ class SliderController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Slider $slider)
|
||||
public function edit(Slider $slider): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.sliders.edit', [
|
||||
'sliderModel' => $slider
|
||||
|
|
@ -103,9 +103,9 @@ class SliderController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Sliders\UpdateSliderRequest $request
|
||||
* @param \App\Models\Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateSliderRequest $request, Slider $slider)
|
||||
public function update(UpdateSliderRequest $request, Slider $slider): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $slider) {
|
||||
$slider->fill($request->validated());
|
||||
|
|
@ -131,9 +131,9 @@ class SliderController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Slider $slider)
|
||||
public function destroy(Slider $slider): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($slider->deleteOrFail()) {
|
||||
return redirect()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class StaticPageController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param App\Models\StaticPage $static_page
|
||||
* @param \App\Models\StaticPage $static_page
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(StaticPage $static_page): \Illuminate\Contracts\View\View
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use App\Models\StoreType;
|
|||
use App\Models\StoreRegion;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -18,16 +17,15 @@ use Illuminate\Support\Str;
|
|||
class StoreController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $store */
|
||||
$store = Store::query();
|
||||
|
|
@ -52,9 +50,9 @@ class StoreController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$typeModels = StoreType::orderBy('name', 'ASC')->get();
|
||||
$regionModels = StoreRegion::orderBy('name', 'ASC')->get();
|
||||
|
|
@ -66,9 +64,9 @@ class StoreController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Stores\StoreStoreRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreStoreRequest $request)
|
||||
public function store(StoreStoreRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$store = new Store();
|
||||
|
|
@ -95,9 +93,9 @@ class StoreController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \App\Models\Store $store
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Store $store)
|
||||
public function edit(Store $store): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$typeModels = StoreType::orderBy('name', 'ASC')->get();
|
||||
$regionModels = StoreRegion::orderBy('name', 'ASC')->get();
|
||||
|
|
@ -113,9 +111,9 @@ class StoreController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\Stores\UpdateStoreRequest $request
|
||||
* @param \App\Models\Store $store
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateStoreRequest $request, Store $store)
|
||||
public function update(UpdateStoreRequest $request, Store $store): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $store) {
|
||||
$store->fill($request->validated());
|
||||
|
|
@ -140,9 +138,9 @@ class StoreController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Store $store
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Store $store)
|
||||
public function destroy(Store $store): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($store->deleteOrFail()) {
|
||||
return redirect()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\Bo\StoreGroups\UpdateStoreGroupRequest;
|
|||
use App\Models\StoreGroup;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -16,16 +15,15 @@ use Illuminate\Support\Str;
|
|||
class StoreGroupController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $storeGroup */
|
||||
$storeGroup = StoreGroup::query();
|
||||
|
|
@ -50,9 +48,9 @@ class StoreGroupController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.storegroups.create');
|
||||
}
|
||||
|
|
@ -61,9 +59,9 @@ class StoreGroupController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\StoreGroups\StoreStoreGroupRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreStoreGroupRequest $request)
|
||||
public function store(StoreStoreGroupRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$storeGroup = new StoreGroup();
|
||||
|
|
@ -90,9 +88,9 @@ class StoreGroupController extends Controller
|
|||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \App\Models\StoreGroup $storegroup
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(StoreGroup $storegroup)
|
||||
public function edit(StoreGroup $storegroup): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.storegroups.edit', ['storegroupModel' => $storegroup]);
|
||||
}
|
||||
|
|
@ -102,9 +100,9 @@ class StoreGroupController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\StoreGroups\UpdateStoreGroupRequest $request
|
||||
* @param \App\Models\StoreGroup $storegroup
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateStoreGroupRequest $request, StoreGroup $storegroup)
|
||||
public function update(UpdateStoreGroupRequest $request, StoreGroup $storegroup): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $storegroup) {
|
||||
$storegroup->fill($request->validated());
|
||||
|
|
@ -129,9 +127,9 @@ class StoreGroupController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\StoreGroup $storegroup
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(StoreGroup $storegroup)
|
||||
public function destroy(StoreGroup $storegroup): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
foreach ($storegroup->storeRegions as $region) {
|
||||
foreach ($region->stores as $store) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use App\Models\StoreRegion;
|
|||
use App\Models\StoreGroup;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -17,16 +16,15 @@ use Illuminate\Support\Str;
|
|||
class StoreRegionController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $storeregion */
|
||||
$storeregion = StoreRegion::query();
|
||||
|
|
@ -51,9 +49,9 @@ class StoreRegionController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$storegroupModels = StoreGroup::orderBy('order', 'ASC')->get();
|
||||
|
||||
|
|
@ -64,9 +62,9 @@ class StoreRegionController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\StoreRegions\StoreStoreRegionRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreStoreRegionRequest $request)
|
||||
public function store(StoreStoreRegionRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$storeregion = new StoreRegion();
|
||||
|
|
@ -93,9 +91,9 @@ class StoreRegionController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\StoreRegion $storeregion
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(StoreRegion $storeregion)
|
||||
public function edit(StoreRegion $storeregion): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$storegroupModels = StoreGroup::orderBy('order', 'ASC')->get();
|
||||
|
||||
|
|
@ -110,10 +108,12 @@ class StoreRegionController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\StoreRegions\UpdateStoreRegionRequest $request
|
||||
* @param \App\Models\StoreRegion $storeregion
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateStoreRegionRequest $request, StoreRegion $storeregion)
|
||||
{
|
||||
public function update(
|
||||
UpdateStoreRegionRequest $request,
|
||||
StoreRegion $storeregion
|
||||
): \Illuminate\Http\RedirectResponse {
|
||||
return DB::transaction(function () use ($request, $storeregion) {
|
||||
$storeregion->fill($request->validated());
|
||||
|
||||
|
|
@ -138,9 +138,9 @@ class StoreRegionController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\StoreRegion $storeregion
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(StoreRegion $storeregion)
|
||||
public function destroy(StoreRegion $storeregion): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
foreach ($storeregion->stores as $store) {
|
||||
$store->deleteOrFail();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\Bo\StoreTypes\UpdateStoreTypeRequest;
|
|||
use App\Models\StoreType;
|
||||
use App\Traits\Controllers\UpdateModelStatus;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -16,16 +15,15 @@ use Illuminate\Support\Str;
|
|||
class StoreTypeController extends Controller
|
||||
{
|
||||
use ChangesModelOrder;
|
||||
use HasPicture;
|
||||
use UpdateModelStatus;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $storetype */
|
||||
$storetype = StoreType::query();
|
||||
|
|
@ -50,9 +48,9 @@ class StoreTypeController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create()
|
||||
public function create(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.storetypes.create');
|
||||
}
|
||||
|
|
@ -61,9 +59,9 @@ class StoreTypeController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\StoreTypes\StoreStoreTypeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreStoreTypeRequest $request)
|
||||
public function store(StoreStoreTypeRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$storetype = new StoreType();
|
||||
|
|
@ -90,9 +88,9 @@ class StoreTypeController extends Controller
|
|||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\StoreType $storetype
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(StoreType $storetype)
|
||||
public function edit(StoreType $storetype): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.storetypes.edit', [
|
||||
'storetypeModel' => $storetype,
|
||||
|
|
@ -104,9 +102,9 @@ class StoreTypeController extends Controller
|
|||
*
|
||||
* @param \App\Http\Requests\Bo\StoreTypes\UpdateStoreTypeRequest $request
|
||||
* @param \App\Models\StoreType $storetype
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(UpdateStoreTypeRequest $request, StoreType $storetype)
|
||||
public function update(UpdateStoreTypeRequest $request, StoreType $storetype): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $storetype) {
|
||||
$storetype->fill($request->validated());
|
||||
|
|
@ -132,9 +130,9 @@ class StoreTypeController extends Controller
|
|||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\StoreType $storetype
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(StoreType $storetype)
|
||||
public function destroy(StoreType $storetype): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
foreach ($storetype->stores as $store) {
|
||||
$store->deleteOrFail();
|
||||
|
|
|
|||
|
|
@ -109,10 +109,7 @@ class Controller extends BaseController
|
|||
Session::remove("$rName.sort_way");
|
||||
}
|
||||
if (request()->sort_col and request()->sort_way and Schema::hasColumn($table, request()->sort_col)) {
|
||||
if (
|
||||
!isset($ignore) or
|
||||
(isset($ignore) and !in_array(request()->sort_col, $ignore))
|
||||
) {
|
||||
if (!in_array(request()->input('sort_col'), $ignore)) {
|
||||
$query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way);
|
||||
}
|
||||
} elseif (Schema::hasColumn($table, 'order')) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class Authenticate extends Middleware
|
|||
}
|
||||
return route('login');
|
||||
}
|
||||
abort(401);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ChangeOrderRequest extends FormRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'direction' => $this->action === 'up' ? true : false
|
||||
'direction' => $this->direction === 'up' ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,6 @@ class ChangeOrderRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'action' => 'required|string|in:up,down',
|
||||
'direction' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class StoreConceptRequest extends UpdateMiniCrudRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug(strip_tags($this->name))
|
||||
'slug' => Str::slug(strip_tags($this->input('name')))
|
||||
]);
|
||||
$this->mergePicture('picture');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,13 @@ class StoreNewsRequest extends UpdateMiniCrudRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug(strip_tags($this->name)),
|
||||
'status' => $this->status ? true : false,
|
||||
'publish_at' => $this->publish_at ? \str_replace('T', ' ', $this->publish_at) : null,
|
||||
'unpublish_at' => $this->unpublish_at ? \str_replace('T', ' ', $this->unpublish_at) : null,
|
||||
'locales' => \collect($this->locales)->filter()->unique()->all()
|
||||
'slug' => Str::slug(strip_tags($this->input('name'))),
|
||||
'status' => $this->boolean('status'),
|
||||
'publish_at' => $this->input('publish_at') ? \str_replace('T', ' ', $this->input('publish_at')) : null,
|
||||
'unpublish_at' => $this->input('unpublish_at') ?
|
||||
\str_replace('T', ' ', $this->input('unpublish_at')) :
|
||||
null,
|
||||
'locales' => \collect($this->input('locales'))->filter()->unique()->all()
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ class StoreProductRequest extends FormRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug(strip_tags($this->label)),
|
||||
'status' => $this->status ? true : false,
|
||||
'list' => $this->list ?? [],
|
||||
'nutritionnal_values' => $this->nutritionnal_values ?? [],
|
||||
'certifications' => \collect($this->certifications)->all(),
|
||||
'slug' => Str::slug(strip_tags($this->input('label'))),
|
||||
'status' => $this->boolean('status'),
|
||||
'list' => $this->input('list') ?? [],
|
||||
'nutritionnal_values' => $this->input('nutritionnal_values') ?? [],
|
||||
'certifications' => \collect($this->input('certifications'))->all(),
|
||||
]);
|
||||
$this->mergePicture('picture');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class StoreRangeRequest extends FormRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug(strip_tags($this->label)),
|
||||
'status' => $this->status ? true : false,
|
||||
'slug' => Str::slug(strip_tags($this->input('label'))),
|
||||
'status' => $this->boolean('status'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class StoreRecipeRequest extends FormRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'slug' => Str::slug(strip_tags($this->name)),
|
||||
'status' => $this->status ? true : false,
|
||||
'slug' => Str::slug(strip_tags($this->input('name'))),
|
||||
'status' => $this->boolean('status'),
|
||||
]);
|
||||
$this->mergePicture('picture');
|
||||
$this->mergePicture('picture_thumbnail');
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ class StoreSliderRequest extends FormRequest
|
|||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'link_new_tab' => $this->link_new_tab ? true : false,
|
||||
'status' => $this->status ? true : false,
|
||||
'publish_at' => $this->publish_at ? \str_replace('T', ' ', $this->publish_at) : null,
|
||||
'unpublish_at' => $this->unpublish_at ? \str_replace('T', ' ', $this->unpublish_at) : null,
|
||||
'locales' => \collect($this->locales)->filter()->unique()->all()
|
||||
'link_new_tab' => $this->boolean('link_new_tab'),
|
||||
'status' => $this->boolean('status'),
|
||||
'publish_at' => $this->input('publish_at') ? \str_replace('T', ' ', $this->input('publish_at')) : null,
|
||||
'unpublish_at' => $this->input('unpublish_at') ?
|
||||
\str_replace('T', ' ', $this->input('unpublish_at')) :
|
||||
null,
|
||||
'locales' => \collect($this->input('locales'))->filter()->unique()->all()
|
||||
]);
|
||||
$this->mergePicture('picture');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ abstract class UpdateMiniCrudRequest extends FormRequest
|
|||
"data.$iptName.value" => [
|
||||
function (string $attribute, $value, callable $fail) use ($sizes) {
|
||||
if ($value) {
|
||||
return ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ class SlidersStatusUpdate
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$slidersToPublish = Slider::where('publish_at', '<=', Carbon::now()->toDateTime())
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\Slider> */
|
||||
$slidersToPublish = Slider::query()->where('publish_at', '<=', Carbon::now()->toDateTime())
|
||||
->whereNotNull('publish_at')
|
||||
->where('status', false)->get();
|
||||
Log::debug(__CLASS__ . " sliders to publish " . $slidersToPublish->count());
|
||||
|
|
@ -28,7 +29,9 @@ class SlidersStatusUpdate
|
|||
$slider->status = true;
|
||||
$slider->saveOrFail();
|
||||
}
|
||||
$slidersToUnPublish = Slider::where('unpublish_at', '<=', Carbon::now()->toDateTime())
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\Slider> */
|
||||
$slidersToUnPublish = Slider::query()->where('unpublish_at', '<=', Carbon::now()->toDateTime())
|
||||
->whereNotNull('unpublish_at')
|
||||
->where('status', true)->get();
|
||||
Log::debug(__CLASS__ . " sliders to unpublish " . $slidersToPublish->count());
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class ExceptionsHelper
|
|||
$traceStr .= self::handleArgs($stack);
|
||||
}
|
||||
$traceStr .= ")\n";
|
||||
} elseif (isset($stack['function'])) {
|
||||
} else {
|
||||
$traceStr .= "{$stack['function']}(";
|
||||
if (isset($stack['args'])) {
|
||||
$traceStr .= self::handleArgs($stack);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class FileStorageHelper
|
|||
);
|
||||
|
||||
return str_replace('/private/', '', $newPath);
|
||||
}//end if
|
||||
} //end if
|
||||
if (\is_object($file) and $file instanceof \SplFileInfo) {
|
||||
/** @var \SplFileInfo $file */
|
||||
$filename = $filename ?: $file->getBaseName();
|
||||
|
|
@ -309,7 +309,6 @@ class FileStorageHelper
|
|||
$private ? 'app/private/modelfiles' : 'app/public/modelfiles',
|
||||
$tableName,
|
||||
$filename,
|
||||
$private
|
||||
);
|
||||
$filename = self::getFileUniqueName($folderPath, $filename);
|
||||
return "{$folderPath}/{$filename}";
|
||||
|
|
@ -404,7 +403,7 @@ class FileStorageHelper
|
|||
$filename = Str::of($filename)->ltrim('.-');
|
||||
// * Optional beautification
|
||||
if ($beautify) {
|
||||
$filename = static::beautifyFilename($filename);
|
||||
$filename = self::beautifyFilename($filename);
|
||||
}
|
||||
// * Maximize filename length to 255 bytes http://serverfault.com/a/9548/44086
|
||||
/** @var string */
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ class ToolboxHelper
|
|||
public static function getClassesUsingNamespace(string $namespace): array
|
||||
{
|
||||
return collect(File::files(\app_path(Str::of($namespace)->replaceFirst('\App', ''))))
|
||||
->filter(fn (SplFileInfo $splFileInfo) => $splFileInfo->getExtension() === 'php')
|
||||
->map(fn (SplFileInfo $splFileInfo) => Str::of($splFileInfo->getBasename())
|
||||
->replace('.' . $splFileInfo->getExtension(), '')->prepend("{$namespace}\\"))->all();
|
||||
->filter(fn (SplFileInfo $splFileInfo) => $splFileInfo->getExtension() === 'php')
|
||||
->map(fn (SplFileInfo $splFileInfo) => Str::of($splFileInfo->getBasename())
|
||||
->replace('.' . $splFileInfo->getExtension(), '')->prepend("{$namespace}\\"))->all();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,11 +204,10 @@ class ToolboxHelper
|
|||
$url = $match;
|
||||
try {
|
||||
$request = Request::create($url);
|
||||
// If a route is match then it do not throws exception.
|
||||
if (
|
||||
\parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST) &&
|
||||
$routes->match($request)
|
||||
) {
|
||||
// Assert route matches existing routes.
|
||||
$routes->match($request);
|
||||
// ? Is url internal ?
|
||||
if (\parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST)) {
|
||||
// Removes the matched url.
|
||||
throw ValidationException::withMessages([
|
||||
$field => trans(
|
||||
|
|
@ -234,14 +233,14 @@ class ToolboxHelper
|
|||
* @param array|string $replace
|
||||
* @param array|string $subject
|
||||
* @param integer $count
|
||||
* @return array|string
|
||||
* @return array|string|false
|
||||
*/
|
||||
public static function mbReplace(
|
||||
array|string $search,
|
||||
array|string $replace,
|
||||
array|string $subject,
|
||||
int &$count = 0
|
||||
): array|string {
|
||||
): array|string|false {
|
||||
if (!is_array($search) && is_array($replace)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -318,9 +317,12 @@ class ToolboxHelper
|
|||
public static function getOriginal(Model $model, string $attribute): mixed
|
||||
{
|
||||
if (\in_array('Spatie\Translatable\HasTranslations', \class_uses_recursive($model))) {
|
||||
// @phpstan-ignore-next-line
|
||||
return $model->getTranslation(
|
||||
$attribute,
|
||||
// @phpstan-ignore-next-line
|
||||
$model->getLocale(),
|
||||
// @phpstan-ignore-next-line
|
||||
$model->useFallbackLocale()
|
||||
);
|
||||
}
|
||||
|
|
@ -390,55 +392,55 @@ class ToolboxHelper
|
|||
/**
|
||||
* Convert deeply an object to array
|
||||
*
|
||||
* @param array|object $input
|
||||
* @param mixed $input
|
||||
* @return array
|
||||
* @throws \RuntimeException If $input var is a scalar value.
|
||||
*/
|
||||
public static function objectToArray($input): array
|
||||
public static function objectToArray(mixed $input): array
|
||||
{
|
||||
// Only process if it's an object or array being passed to the function.
|
||||
if (is_object($input) or is_array($input)) {
|
||||
$ret = (array)$input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
self::objectToArray($item) : $item;
|
||||
}
|
||||
return $ret;
|
||||
} else {
|
||||
if (!(is_object($input) or is_array($input))) {
|
||||
throw new \RuntimeException('Cannot handle $input of type ' . \gettype($input));
|
||||
}
|
||||
$ret = (array)$input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
self::objectToArray($item) : $item;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert deeply an array to object
|
||||
*
|
||||
* @param array|object $input
|
||||
* @param mixed $input
|
||||
* @return object
|
||||
* @throws \RuntimeException If $input var is a scalar value.
|
||||
*/
|
||||
public static function arrayToObject($input): object
|
||||
public static function arrayToObject(mixed $input): object
|
||||
{
|
||||
// Only process if it's an object or array being passed to the function.
|
||||
if (is_object($input) or is_array($input)) {
|
||||
$ret = (object)$input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
self::arrayToObject($item) : $item;
|
||||
}
|
||||
return $ret;
|
||||
} else {
|
||||
if (!(is_object($input) or is_array($input))) {
|
||||
throw new \RuntimeException('Cannot handle $input of type ' . \gettype($input));
|
||||
}
|
||||
$ret = (object)$input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
self::arrayToObject($item) : $item;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate picture
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string|null $value
|
||||
* @param callback $fail
|
||||
* @param callable $fail
|
||||
* @param object $sizes
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -461,7 +463,7 @@ class ToolboxHelper
|
|||
'attribute' => $attribute
|
||||
]));
|
||||
}
|
||||
if (!($dimensions = \getimagesize($fileFullPath)) or !isset($dimensions[0]) or !isset($dimensions[1])) {
|
||||
if (!($dimensions = \getimagesize($fileFullPath))) {
|
||||
$fail(trans(':attribute impossible de valider les dimensions', [
|
||||
'attribute' => $attribute
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -46,10 +46,9 @@ class ContactMessageReceived extends Mailable
|
|||
'no-reply@nature-and-respect.com',
|
||||
'Kontaktformular'
|
||||
),
|
||||
to: new Address(
|
||||
to: [
|
||||
'contact@nature-and-respect.com',
|
||||
'contact@nature-and-respect.com'
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class Concept extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'seo_title',
|
||||
|
|
@ -65,7 +65,7 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'data' => 'object',
|
||||
|
|
@ -75,7 +75,7 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* The translatable columns.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = [
|
||||
'data',
|
||||
|
|
@ -137,10 +137,10 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
self::setSlug($model);
|
||||
ToolboxHelper::assertNoInternalBoUrls('description', $model->description);
|
||||
|
|
@ -150,11 +150,11 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* Set the slug.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function setSlug(Model $model)
|
||||
private static function setSlug(self $model)
|
||||
{
|
||||
$model->slug = Str::slug($model->name);
|
||||
}
|
||||
|
|
@ -162,10 +162,10 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
@ -203,11 +203,13 @@ class Concept extends Model implements SeoInterface
|
|||
string $imgAlt = '',
|
||||
string $imgTitle = ''
|
||||
) {
|
||||
$color = $color ?: \collect(ColorsEnum::cases())->random()->value;
|
||||
$data = [];
|
||||
/** @var \App\Enums\Concepts\ColorsEnum */
|
||||
$defaultColor = \collect(ColorsEnum::cases())->random();
|
||||
$color = $color ?: $defaultColor->value;
|
||||
$data = [];
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
$data = self::emptyDataBloc(
|
||||
$i,
|
||||
\strval($i),
|
||||
$data,
|
||||
$title,
|
||||
$color,
|
||||
|
|
@ -319,7 +321,7 @@ class Concept extends Model implements SeoInterface
|
|||
/**
|
||||
* Transfotrm to seoModel
|
||||
*
|
||||
* @return \App\Objects\SeoItem
|
||||
* @return \Uwil\Seo\Laravel\Objects\SeoItem
|
||||
*/
|
||||
public function toSeoItem(): SeoItem
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Home extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'part2_product1_id',
|
||||
|
|
@ -61,7 +61,7 @@ class Home extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'part2_list' => 'array',
|
||||
|
|
@ -116,10 +116,10 @@ class Home extends Model implements SeoInterface
|
|||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
ToolboxHelper::assertNoInternalBoUrls('part1_text_1', $model->part1_text_1);
|
||||
ToolboxHelper::assertNoInternalBoUrls('part1_text_2', $model->part1_text_2);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class News extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'seo_title',
|
||||
|
|
@ -58,7 +58,7 @@ class News extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'data' => 'object',
|
||||
|
|
@ -94,22 +94,22 @@ class News extends Model implements SeoInterface
|
|||
{
|
||||
static::creating(function (self $model) {
|
||||
// * ASSERTIONS
|
||||
static::assertTitleIsUnique($model->title);
|
||||
self::assertTitleIsUnique($model->title);
|
||||
ToolboxHelper::assertNoInternalBoUrls('content', $model->content);
|
||||
|
||||
// * TRANSFORMATIONS
|
||||
$model->slug = Str::slug($model->title);
|
||||
self::setSlug($model);
|
||||
$model->content = FileStorageHelper::storeModelFilesFromHtml($model, $model->content);
|
||||
$model->makeStatusSense();
|
||||
self::setOrder($model);
|
||||
});
|
||||
static::updating(function (self $model) {
|
||||
// * ASSERTIONS
|
||||
static::assertTitleIsUnique($model->title);
|
||||
self::assertTitleIsUnique($model->title);
|
||||
ToolboxHelper::assertNoInternalBoUrls('content', $model->content);
|
||||
|
||||
// * TRANSFORMATIONS
|
||||
$model->slug = Str::slug($model->title);
|
||||
self::setSlug($model);
|
||||
$model->content = FileStorageHelper::storeModelFilesFromHtml($model, $model->content);
|
||||
$model->makeStatusSense();
|
||||
});
|
||||
|
|
@ -216,22 +216,22 @@ class News extends Model implements SeoInterface
|
|||
/**
|
||||
* Set the slug.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function setSlug(Model $model)
|
||||
private static function setSlug(self $model)
|
||||
{
|
||||
$model->slug = Str::slug($model->name);
|
||||
$model->slug = Str::slug($model->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ class News extends Model implements SeoInterface
|
|||
) {
|
||||
$data = [];
|
||||
$data = self::emptyDataBloc(
|
||||
1,
|
||||
'1',
|
||||
$data,
|
||||
$img,
|
||||
$imgAlt,
|
||||
|
|
@ -275,7 +275,7 @@ class News extends Model implements SeoInterface
|
|||
);
|
||||
for ($i = 2; $i <= 3; $i++) {
|
||||
$data = self::emptyDataBloc(
|
||||
$i,
|
||||
strval($i),
|
||||
$data,
|
||||
$img,
|
||||
$imgAlt,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Product extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'range_id',
|
||||
|
|
@ -63,7 +63,7 @@ class Product extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'certifications' => 'array',
|
||||
|
|
@ -123,10 +123,10 @@ class Product extends Model implements SeoInterface
|
|||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
self::setSlug($model);
|
||||
if (is_array($model->list)) {
|
||||
|
|
@ -146,11 +146,11 @@ class Product extends Model implements SeoInterface
|
|||
/**
|
||||
* Set the slug.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function setSlug(Model $model)
|
||||
private static function setSlug(self $model)
|
||||
{
|
||||
$model->slug = Str::slug($model->label);
|
||||
}
|
||||
|
|
@ -172,10 +172,10 @@ class Product extends Model implements SeoInterface
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Range extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'seo_title',
|
||||
|
|
@ -47,7 +47,7 @@ class Range extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'picto' => PictoEnum::class,
|
||||
|
|
@ -89,11 +89,11 @@ class Range extends Model implements SeoInterface
|
|||
/**
|
||||
* Set the slug.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function setSlug(Model $model)
|
||||
private static function setSlug(self $model)
|
||||
{
|
||||
$model->slug = Str::slug($model->label);
|
||||
}
|
||||
|
|
@ -101,10 +101,10 @@ class Range extends Model implements SeoInterface
|
|||
/**
|
||||
* Common methods function
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
self::setSlug($model);
|
||||
}
|
||||
|
|
@ -126,10 +126,10 @@ class Range extends Model implements SeoInterface
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ class Range extends Model implements SeoInterface
|
|||
/**
|
||||
* Transfotrm to seoModel
|
||||
*
|
||||
* @return \App\Objects\SeoItem
|
||||
* @return \Uwil\Seo\Laravel\Objects\SeoItem
|
||||
*/
|
||||
public function toSeoItem(): SeoItem
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Uwil\Seo\Laravel\Traits\SeoTrait;
|
|||
* @property string $slug
|
||||
* @property string $picture
|
||||
* @property string $picture_thumbnail
|
||||
* @property string $ingredients
|
||||
* @property array $ingredients
|
||||
* @property string $teaser
|
||||
* @property string $steps
|
||||
* @property \App\Enums\Recipes\DifficultyEnum $difficulty
|
||||
|
|
@ -38,7 +38,7 @@ class Recipe extends Model implements SeoInterface
|
|||
use SeoTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'range_id',
|
||||
|
|
@ -67,10 +67,10 @@ class Recipe extends Model implements SeoInterface
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'ingredients' => 'json',
|
||||
'ingredients' => 'array',
|
||||
'difficulty' => DifficultyEnum::class
|
||||
];
|
||||
|
||||
|
|
@ -130,18 +130,16 @@ class Recipe extends Model implements SeoInterface
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
if (is_array($model->ingredients)) {
|
||||
foreach ($model->ingredients as $itemIngredients) {
|
||||
if (isset($itemIngredients['header'])) {
|
||||
ToolboxHelper::assertNoInternalBoUrls('ingredients', $itemIngredients['header']);
|
||||
}
|
||||
ToolboxHelper::assertNoInternalBoUrls('ingredients', \strval($itemIngredients['value']));
|
||||
foreach ($model->ingredients as $itemIngredients) {
|
||||
if (isset($itemIngredients['header'])) {
|
||||
ToolboxHelper::assertNoInternalBoUrls('ingredients', $itemIngredients['header']);
|
||||
}
|
||||
ToolboxHelper::assertNoInternalBoUrls('ingredients', \strval($itemIngredients['value']));
|
||||
}
|
||||
ToolboxHelper::assertNoInternalBoUrls('steps', $model->steps);
|
||||
ToolboxHelper::assertNoInternalBoUrls('tips', $model->tips);
|
||||
|
|
@ -152,11 +150,11 @@ class Recipe extends Model implements SeoInterface
|
|||
/**
|
||||
* Set the slug.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function setSlug(Model $model)
|
||||
private static function setSlug(self $model)
|
||||
{
|
||||
$model->slug = Str::slug($model->name);
|
||||
}
|
||||
|
|
@ -164,10 +162,10 @@ class Recipe extends Model implements SeoInterface
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,20 +10,20 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property boolean $type
|
||||
* @property string $title
|
||||
* @property string $subtitle
|
||||
* @property string $description
|
||||
* @property string $link
|
||||
* @property string $link_title
|
||||
* @property boolean $link_new_tab
|
||||
* @property string $picture
|
||||
* @property boolean $status
|
||||
* @property integer $order
|
||||
* @property string $unpublish_at
|
||||
* @property string $publish_at
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property \App\Enums\Sliders\TypeEnum $type
|
||||
* @property string $title
|
||||
* @property string $subtitle
|
||||
* @property string $description
|
||||
* @property string $link
|
||||
* @property string $link_title
|
||||
* @property boolean $link_new_tab
|
||||
* @property string $picture
|
||||
* @property boolean $status
|
||||
* @property integer $order
|
||||
* @property string|null $unpublish_at
|
||||
* @property string|null $publish_at
|
||||
* @property Carbon\Carbon $created_at
|
||||
* @property Carbon\Carbon $updated_at
|
||||
*/
|
||||
class Slider extends Model
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ class Slider extends Model
|
|||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type',
|
||||
|
|
@ -72,7 +72,7 @@ class Slider extends Model
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'type' => TypeEnum::class,
|
||||
|
|
@ -117,10 +117,10 @@ class Slider extends Model
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
if ($model->link) {
|
||||
ToolboxHelper::assertNoInternalBoUrls('link', $model->link);
|
||||
|
|
@ -132,10 +132,10 @@ class Slider extends Model
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class StaticPage extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'seo_title',
|
||||
|
|
@ -67,14 +67,14 @@ class StaticPage extends Model
|
|||
{
|
||||
static::creating(function (self $model) {
|
||||
// * ASSERTIONS
|
||||
static::assertTitleIsUnique($model->title);
|
||||
self::assertTitleIsUnique($model->title);
|
||||
|
||||
// * CHANGES
|
||||
$model->slug = Str::slug($model->title);
|
||||
});
|
||||
static::updating(function (self $model) {
|
||||
// * ASSERTIONS
|
||||
static::assertTitleIsUnique($model->title, $model->id);
|
||||
self::assertTitleIsUnique($model->title, $model->id);
|
||||
|
||||
// * CHANGES
|
||||
$model->slug = Str::slug($model->title);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class Store extends Model
|
|||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type_id',
|
||||
|
|
@ -42,7 +42,7 @@ class Store extends Model
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'latitude' => 'float',
|
||||
|
|
@ -68,10 +68,10 @@ class Store extends Model
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class StoreGroup extends Model
|
|||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
|
@ -59,10 +59,10 @@ class StoreGroup extends Model
|
|||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
|
||||
}
|
||||
|
|
@ -70,10 +70,10 @@ class StoreGroup extends Model
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,15 @@ class StoreRegion extends Model
|
|||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'group_id',
|
||||
'name',
|
||||
'picture',
|
||||
'order',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
// * EVENTS
|
||||
|
|
@ -60,10 +61,10 @@ class StoreRegion extends Model
|
|||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
|
||||
}
|
||||
|
|
@ -71,10 +72,10 @@ class StoreRegion extends Model
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ class StoreType extends Model
|
|||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'order',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
// * EVENTS
|
||||
|
|
@ -58,10 +59,10 @@ class StoreType extends Model
|
|||
/**
|
||||
* Set order after the last element of the list.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function setOrder(Model $model): void
|
||||
private static function setOrder(self $model): void
|
||||
{
|
||||
$model->order = \intval(self::query()->max('order')) + 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class User extends Authenticatable
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'firstname',
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class TranslationServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Gather provided langs checking from files
|
||||
*
|
||||
* @return \Illuminate\Support\Collection<string, string>
|
||||
* @return \Illuminate\Support\Collection<int, string>
|
||||
*/
|
||||
private function collectLocalesStrings(): Collection
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,59 +3,56 @@
|
|||
namespace App\Traits\Controllers;
|
||||
|
||||
use App\Http\Requests\Bo\ChangeOrderRequest;
|
||||
use App\Traits\Models\IsCachedAsCollection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait ChangesModelOrder
|
||||
{
|
||||
/**
|
||||
* Change order
|
||||
*
|
||||
* ! requires x64 server + order column as unique integer
|
||||
* Change order.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\ChangeOrderRequest $request
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \RuntimeException Si le nom du parametre de la route ne correspond pas au model utilisé.
|
||||
*/
|
||||
public function changeOrder(ChangeOrderRequest $request, Model $model): RedirectResponse
|
||||
public function changeOrder(ChangeOrderRequest $request, Model $model): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request, $model) {
|
||||
$params = collect(request()->route()->parameterNames);
|
||||
$className = Str::ucfirst(Str::lower($params->get($params->count() - 2)));
|
||||
$className = "\\App\\Models\\$className";
|
||||
|
||||
if (!class_exists($className)) {
|
||||
throw new \RuntimeException("The $className class doesn't exist.");
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Model|null */
|
||||
$model = $className::query()->where($model->getRouteKeyName(), $model->getRouteKey())->first();
|
||||
|
||||
if (!$model) {
|
||||
return back()->with('error', trans('crud.messages.order_not_changed'));
|
||||
}
|
||||
|
||||
return DB::transaction(function () use ($request, $className, $model) {
|
||||
/** @var \Illuminate\Database\Eloquent\Model|null */
|
||||
$tmp = (\get_class($model))::where('order', $request->direction ? '<' : '>', $model->order)
|
||||
$tmp = $className::query()->where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
|
||||
->orderBy('order', $request->direction ? 'DESC' : 'ASC')->first();
|
||||
|
||||
if (!$tmp) {
|
||||
return back()->with('bo.error', trans('L\'ordre n\'a pas pu être modifié'));
|
||||
return back()->with('error', trans('crud.messages.order_not_changed'));
|
||||
}
|
||||
$oldOrder = $model->order;
|
||||
$newOrder = $tmp->order;
|
||||
|
||||
// * Silent update timestamps.
|
||||
$tmp->timestamps = false;
|
||||
$model->timestamps = false;
|
||||
$newOrder = $tmp->getOriginal('order');
|
||||
// Didn't use ->update() because it didn't work with Models which use MiniCrudModel.
|
||||
$tmp->fill(['order' => $model->getOriginal('order')]);
|
||||
$tmp->save();
|
||||
$model->fill(['order' => $newOrder]);
|
||||
$model->save();
|
||||
|
||||
$saveOk = false;
|
||||
Session::flash('success', trans('crud.messages.order_changed'));
|
||||
|
||||
// ! Fake value to prevent unique SQL key to trigger.
|
||||
$tmp->order = 4294967295;
|
||||
$saveOk = $tmp->saveQuietly();
|
||||
$model->order = $newOrder;
|
||||
$saveOk = $model->saveQuietly() & $saveOk;
|
||||
$tmp->order = $oldOrder;
|
||||
$saveOk = $tmp->saveQuietly() & $saveOk;
|
||||
if (\in_array(IsCachedAsCollection::class, class_uses_recursive(\get_class($model)))) {
|
||||
$model::removeCached();
|
||||
}
|
||||
if (!$saveOk) {
|
||||
throw ValidationException::withMessages([
|
||||
'error' => \trans('L\'ordre n\'a pas pu être modifié')
|
||||
]);
|
||||
}
|
||||
Session::flash('bo.success', trans('L\'ordre a été modifié'));
|
||||
return back();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,7 @@ trait UpdateModelStatus
|
|||
*/
|
||||
public function changePublished(Model $model)
|
||||
{
|
||||
$model->status = !$model->status;
|
||||
$model->saveOrFail();
|
||||
|
||||
if (!$model->saveOrFail()) {
|
||||
return redirect()->back()->with('error', __('The status could not be changed'));
|
||||
}
|
||||
$model->update(['status' => !$model->getOriginal('status')]);
|
||||
return redirect()->back()->with('success', __('The status has been changed'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@ namespace App\Traits\Enums;
|
|||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
trait BaseEnum
|
||||
{
|
||||
// * GENERIC METHODS
|
||||
|
||||
/**
|
||||
* Get enum value
|
||||
* Get enum value.
|
||||
*
|
||||
* @return string|integer
|
||||
*/
|
||||
|
|
@ -21,7 +19,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enum label
|
||||
* Get enum label.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -31,7 +29,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enum name
|
||||
* Get enum name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -43,7 +41,7 @@ trait BaseEnum
|
|||
// * STATIC FETCH METHODS
|
||||
|
||||
/**
|
||||
* Get enum labels
|
||||
* Get enum labels.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
|
|
@ -65,7 +63,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enum values
|
||||
* Get enum values.
|
||||
*
|
||||
* @return array<integer|string>
|
||||
*/
|
||||
|
|
@ -79,7 +77,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enums
|
||||
* Get enums.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -89,7 +87,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get enums
|
||||
* Get enums.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -118,30 +116,36 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch enum using value
|
||||
* Fetch enum using value.
|
||||
*
|
||||
* @param \App\Traits\Enums\BaseEnum|integer|string $value
|
||||
* @return \App\Traits\Enums\BaseEnum|null
|
||||
* @param self|integer|string $value
|
||||
* @param string $field
|
||||
* @return self|null
|
||||
*/
|
||||
public static function make(self|int|string $value): self|null
|
||||
public static function make(self|int|string $value, string $field = 'value'): self|null
|
||||
{
|
||||
if ($field === "label") {
|
||||
$enumLabels = array_change_key_case(array_flip(self::toLabels()), CASE_LOWER);
|
||||
$value = (isset($enumLabels[strtolower($value)])) ? $enumLabels[strtolower($value)] : false;
|
||||
$field = 'name';
|
||||
}
|
||||
return !\is_object($value) ?
|
||||
\collect(self::cases())->keyBy('value')->get($value) : $value;
|
||||
\collect(self::cases())->keyBy($field)->get($value) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if 2 enum are equals
|
||||
* Test if 2 enum are equals.
|
||||
*
|
||||
* @param object ...$others
|
||||
* @return boolean
|
||||
* @throws \Error If provided element are not enums taht extends BaseEnum.
|
||||
* @throws \Error If provided element are not enums that extends BaseEnum.
|
||||
*/
|
||||
public function equals(object ...$others): bool
|
||||
{
|
||||
foreach ($others as $other) {
|
||||
if (!\in_array(BaseEnum::class, \class_uses_recursive($other))) {
|
||||
throw new \Error(__METHOD__ .
|
||||
' requires $enum to use ' . BaseEnum::class);
|
||||
' requires $enum to use ' . BaseEnum::class);
|
||||
}
|
||||
if (
|
||||
get_class($this) === get_class($other)
|
||||
|
|
@ -154,7 +158,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Serialize to json
|
||||
* Serialize to json.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -167,7 +171,7 @@ trait BaseEnum
|
|||
// * CACHE
|
||||
|
||||
/**
|
||||
* Get cache array
|
||||
* Get cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @return array
|
||||
|
|
@ -182,7 +186,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cache array
|
||||
* Set cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @param array $items
|
||||
|
|
@ -198,7 +202,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Init cache if needed
|
||||
* Init cache if needed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -219,7 +223,7 @@ trait BaseEnum
|
|||
// * PRIVATE
|
||||
|
||||
/**
|
||||
* Fetch the LABELS constant if exists
|
||||
* Fetch the LABELS constant if exists.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
|
|
@ -235,7 +239,7 @@ trait BaseEnum
|
|||
}
|
||||
|
||||
/**
|
||||
* Get custom constants
|
||||
* Get custom constants.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,9 +36,13 @@ trait HasTranslations
|
|||
|
||||
// * Store Uploaded file
|
||||
if (\is_object($value) and $value instanceof \Illuminate\Http\UploadedFile) {
|
||||
$storeAsPrivate = (\is_array($this->privatePictures) and
|
||||
\in_array($key, $this->privatePictures)) ? true : false;
|
||||
$value = FileStorageHelper::storeFile($this, $value, true, null, $storeAsPrivate);
|
||||
if (\property_exists($this, 'privatePictures')) {
|
||||
$storeAsPrivate = (\is_array($this->privatePictures) and
|
||||
\in_array($key, $this->privatePictures)) ? true : false;
|
||||
} else {
|
||||
$storeAsPrivate = false;
|
||||
}
|
||||
$value = FileStorageHelper::storeFile($this, $value, true, null, $storeAsPrivate);
|
||||
}
|
||||
|
||||
// If the attribute is translatable and not already translated, set a
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Cache;
|
|||
/**
|
||||
* ! Use this only on limited elements, (not on tags, or products, or posts for ex.)
|
||||
*
|
||||
* @property private static array $cacheConditions Eloquent condition to cache elements (to be used in where statement).
|
||||
* @property array<string,string|integer|float|boolean> $cacheConditions
|
||||
* Eloquent condition to cache elements (to be used in where statement).
|
||||
*/
|
||||
trait IsCachedAsCollection
|
||||
{
|
||||
|
|
@ -18,7 +19,7 @@ trait IsCachedAsCollection
|
|||
* Get all available instances from cache.
|
||||
* If cache was reset, it will fetch them from DB.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
* @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection<(int|string), mixed>
|
||||
*/
|
||||
public static function getCached(): Collection
|
||||
{
|
||||
|
|
@ -52,10 +53,11 @@ trait IsCachedAsCollection
|
|||
{
|
||||
$conditions = [];
|
||||
if (property_exists(get_called_class(), 'cacheConditions')) {
|
||||
$conditions = collect(static::${'cacheConditions'})->all();
|
||||
$conditions = collect(get_called_class()::${'cacheConditions'})->all();
|
||||
}
|
||||
Cache::put(static::getCacheKeyName(), static::queryCached(static::query())
|
||||
->where($conditions)->get());
|
||||
->where($conditions)->get()
|
||||
->pipe(fn (Collection $collection) => \call_user_func([self::class, 'filterQuery'], $collection)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,6 +71,17 @@ trait IsCachedAsCollection
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change query for cached elements
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $results
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected static function filterQuery(Collection $results): Collection
|
||||
{
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class basename
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ trait MiniCrudModel
|
|||
* Fill the model with an array of attributes.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @phpstan-ignore-next-line
|
||||
* @return void
|
||||
* @throws \Illuminate\Database\Eloquent\MassAssignmentException If fill prop is not allowed.
|
||||
* @phpcs:disable Squiz.Commenting.FunctionComment.EmptyThrows
|
||||
|
|
@ -62,7 +63,6 @@ trait MiniCrudModel
|
|||
*/
|
||||
public function minicrudUpdated()
|
||||
{
|
||||
/** @var array */
|
||||
foreach ($this->data as $index => $input) {
|
||||
switch ($input['inputType']) {
|
||||
case InputType::text->value:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ trait HasPicture
|
|||
$name => [
|
||||
!$nullable ? 'required' : 'nullable',
|
||||
function (string $attribute, $value, callable $fail) use ($sizes) {
|
||||
return ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
@ -101,7 +101,7 @@ trait HasPicture
|
|||
"{$name}Validate.*" => [
|
||||
'required',
|
||||
function (string $attribute, $value, callable $fail) use ($sizes) {
|
||||
return $this->validatePicture($attribute, $value, $fail, $sizes);
|
||||
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class RecipeCard extends Component
|
|||
/**
|
||||
* Recipe model
|
||||
*
|
||||
* @var \App\Recipe
|
||||
* @var \App\Models\Recipe
|
||||
*/
|
||||
public $recipe;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class RecipeCard extends Component
|
|||
*/
|
||||
public function __construct(int $id)
|
||||
{
|
||||
$this->recipe = Recipe::where('id', $id)->first();
|
||||
$this->recipe = Recipe::query()->where('id', $id)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class RecipeCardSmall extends Component
|
|||
/**
|
||||
* Recipe model
|
||||
*
|
||||
* @var \App\Recipe
|
||||
* @var \App\Models\Recipe
|
||||
*/
|
||||
public $recipe;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ class RecipeCardSmall extends Component
|
|||
*/
|
||||
public function __construct(int $id)
|
||||
{
|
||||
$this->recipe = Recipe::where('id', $id)->first();
|
||||
$this->recipe = Recipe::query()->where('id', $id)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class RecipeProductStoerer extends Component
|
|||
/**
|
||||
* product variable
|
||||
*
|
||||
* @var \App\Product
|
||||
* @var \App\Models\Product
|
||||
*/
|
||||
public $product;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ class RecipeProductStoerer extends Component
|
|||
*/
|
||||
public function __construct(int $id)
|
||||
{
|
||||
$this->product = Product::where('id', $id)->first();
|
||||
$this->product = Product::query()->where('id', $id)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class RecipeWidget extends Component
|
|||
/**
|
||||
* recipes variable
|
||||
*
|
||||
* @var \App\Recipe
|
||||
* @var \Illuminate\Database\Eloquent\Collection<\App\Models\Recipe>
|
||||
*/
|
||||
private $recipes;
|
||||
|
||||
|
|
@ -43,10 +43,10 @@ class RecipeWidget extends Component
|
|||
}
|
||||
if ($id != null) {
|
||||
$this->id = $id;
|
||||
$this->recipes = Recipe::where('status', '1')
|
||||
$this->recipes = Recipe::query()->where('status', '1')
|
||||
->where('id', '!=', $this->id)->inRandomOrder()->limit($this->limit)->get();
|
||||
} else {
|
||||
$this->recipes = Recipe::where('status', '1')->inRandomOrder()->limit($this->limit)->get();
|
||||
$this->recipes = Recipe::query()->where('status', '1')->inRandomOrder()->limit($this->limit)->get();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
"fakerphp/faker": "^1.9.1",
|
||||
"kitloong/laravel-migrations-generator": "^6.8",
|
||||
"krlove/eloquent-model-generator": "dev-l10-compatibility",
|
||||
"larastan/larastan": "^2.6",
|
||||
"laravel-lang/common": "^3.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
|
|
|
|||
248
composer.lock
generated
248
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "78349105dc2b9635384edb9678eeb2fb",
|
||||
"content-hash": "5cbd8714f1b33e1181e89d0f6807e88a",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
|
|
@ -10396,6 +10396,102 @@
|
|||
},
|
||||
"time": "2023-01-30T20:15:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "larastan/larastan",
|
||||
"version": "v2.6.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/larastan/larastan.git",
|
||||
"reference": "6c5e8820f3db6397546f3ce48520af9d312aed27"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/larastan/larastan/zipball/6c5e8820f3db6397546f3ce48520af9d312aed27",
|
||||
"reference": "6c5e8820f3db6397546f3ce48520af9d312aed27",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"illuminate/console": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/container": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/contracts": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/database": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/http": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/pipeline": "^9.47.0 || ^10.0.0",
|
||||
"illuminate/support": "^9.47.0 || ^10.0.0",
|
||||
"php": "^8.0.2",
|
||||
"phpmyadmin/sql-parser": "^5.6.0",
|
||||
"phpstan/phpstan": "~1.10.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"nikic/php-parser": "^4.15.2",
|
||||
"orchestra/testbench": "^7.19.0 || ^8.0.0",
|
||||
"phpunit/phpunit": "^9.5.27"
|
||||
},
|
||||
"suggest": {
|
||||
"orchestra/testbench": "Using Larastan for analysing a package needs Testbench"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"NunoMaduro\\Larastan\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nuno Maduro",
|
||||
"email": "enunomaduro@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel",
|
||||
"keywords": [
|
||||
"PHPStan",
|
||||
"code analyse",
|
||||
"code analysis",
|
||||
"larastan",
|
||||
"laravel",
|
||||
"package",
|
||||
"php",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/larastan/larastan/issues",
|
||||
"source": "https://github.com/larastan/larastan/tree/v2.6.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.paypal.com/paypalme/enunomaduro",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/canvural",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/nunomaduro",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/nunomaduro",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-29T12:13:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel-lang/attributes",
|
||||
"version": "v2.4.0",
|
||||
|
|
@ -11335,6 +11431,94 @@
|
|||
},
|
||||
"time": "2022-02-21T01:04:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpmyadmin/sql-parser",
|
||||
"version": "5.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpmyadmin/sql-parser.git",
|
||||
"reference": "011fa18a4e55591fac6545a821921dd1d61c6984"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/011fa18a4e55591fac6545a821921dd1d61c6984",
|
||||
"reference": "011fa18a4e55591fac6545a821921dd1d61c6984",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"symfony/polyfill-mbstring": "^1.3",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"conflict": {
|
||||
"phpmyadmin/motranslator": "<3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbench/phpbench": "^1.1",
|
||||
"phpmyadmin/coding-standard": "^3.0",
|
||||
"phpmyadmin/motranslator": "^4.0 || ^5.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.9.12",
|
||||
"phpstan/phpstan-phpunit": "^1.3.3",
|
||||
"phpunit/php-code-coverage": "*",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||
"psalm/plugin-phpunit": "^0.16.1",
|
||||
"vimeo/psalm": "^4.11",
|
||||
"zumba/json-serializer": "~3.0.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance",
|
||||
"phpmyadmin/motranslator": "Translate messages to your favorite locale"
|
||||
},
|
||||
"bin": [
|
||||
"bin/highlight-query",
|
||||
"bin/lint-query",
|
||||
"bin/sql-parser",
|
||||
"bin/tokenize-query"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\SqlParser\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "The phpMyAdmin Team",
|
||||
"email": "developers@phpmyadmin.net",
|
||||
"homepage": "https://www.phpmyadmin.net/team/"
|
||||
}
|
||||
],
|
||||
"description": "A validating SQL lexer and parser with a focus on MySQL dialect.",
|
||||
"homepage": "https://github.com/phpmyadmin/sql-parser",
|
||||
"keywords": [
|
||||
"analysis",
|
||||
"lexer",
|
||||
"parser",
|
||||
"query linter",
|
||||
"sql",
|
||||
"sql lexer",
|
||||
"sql linter",
|
||||
"sql parser",
|
||||
"sql syntax highlighter",
|
||||
"sql tokenizer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpmyadmin/sql-parser/issues",
|
||||
"source": "https://github.com/phpmyadmin/sql-parser"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.phpmyadmin.net/donate/",
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-20T20:34:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.23.1",
|
||||
|
|
@ -11382,6 +11566,68 @@
|
|||
},
|
||||
"time": "2023-08-03T16:32:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.57",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan-shim": "*"
|
||||
},
|
||||
"bin": [
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||
"source": "https://github.com/phpstan/phpstan-src"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ondrejmirtes",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/phpstan",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-24T11:51:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "10.1.4",
|
||||
|
|
|
|||
10
phpstan.neon
Normal file
10
phpstan.neon
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
includes:
|
||||
- vendor/larastan/larastan/extension.neon
|
||||
|
||||
parameters:
|
||||
|
||||
paths:
|
||||
- app/
|
||||
|
||||
# Level 9 is the highest level
|
||||
level: 5
|
||||
|
|
@ -33,12 +33,20 @@ return [
|
|||
],
|
||||
|
||||
'messages' => [
|
||||
'has_been_created' => ':model wurde erstellt',
|
||||
'cannot_be_created' => ':model kann nicht erstellt werden',
|
||||
'has_been_updated' => ':model wurde aktualisiert',
|
||||
'cannot_be_updated' => ':model kann nicht aktualisiert werden',
|
||||
'has_been_deleted' => ':model wurde gelöscht',
|
||||
'cannot_be_deleted' => ':mode kann nicht gelöscht werden'
|
||||
'has_been_created' => ':model wurde erstellt',
|
||||
'cannot_be_created' => ':model kann nicht erstellt werden',
|
||||
'has_been_updated' => ':model wurde aktualisiert',
|
||||
'cannot_be_updated' => ':model kann nicht aktualisiert werden',
|
||||
'has_been_deleted' => ':model wurde gelöscht',
|
||||
'cannot_be_deleted' => ':model kann nicht gelöscht werden',
|
||||
'order_changed' => 'Die Reihenfolge wurde geändert!',
|
||||
'order_not_changed' => 'Die Reihenfolge wurde nicht geändert!',
|
||||
'publish_status_saved' => 'Änderung des Veröffentlichungsstatus erfolgreich!',
|
||||
'right' => 'Sie haben keine Rechte, um auf diesen Teil zuzugreifen!',
|
||||
'theme_updated' => 'Das Thema wurde aktualisiert!',
|
||||
'user_unpublished' => 'Sie können Ihr eigenes Konto nicht unveröffentlicht lassen!',
|
||||
|
||||
|
||||
],
|
||||
|
||||
'minicrud' => [
|
||||
|
|
|
|||
|
|
@ -33,12 +33,20 @@ return [
|
|||
],
|
||||
|
||||
'messages' => [
|
||||
'has_been_created' => ':model has been created',
|
||||
'cannot_be_created' => ':model cannot be created',
|
||||
'has_been_updated' => ':model has been updated',
|
||||
'cannot_be_updated' => ':model cannot be updated',
|
||||
'has_been_deleted' => ':model has been deleted',
|
||||
'cannot_be_deleted' => ':model cannot be deleted'
|
||||
'has_been_created' => ':model has been created',
|
||||
'cannot_be_created' => ':model cannot be created',
|
||||
'has_been_updated' => ':model has been updated',
|
||||
'cannot_be_updated' => ':model cannot be updated',
|
||||
'has_been_deleted' => ':model has been deleted',
|
||||
'cannot_be_deleted' => ':model cannot be deleted',
|
||||
'order_changed' => 'The order has been changed!',
|
||||
'order_not_changed' => 'The order hasn\'t been changed!',
|
||||
'publish_status_saved' => 'Change of publication status successful!',
|
||||
'right' => 'You don\'t have the rights to access this part !',
|
||||
'theme_updated' => 'The theme has been updated !',
|
||||
'user_unpublished' => 'You cannot unpublished your own account !',
|
||||
|
||||
|
||||
],
|
||||
|
||||
'minicrud' => [
|
||||
|
|
|
|||
|
|
@ -1,65 +1,81 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($conceptModels->count())
|
||||
@foreach ($conceptModels as $conceptModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $conceptModel->name }}</td>
|
||||
<td class="align-middle">{{ $conceptModel->title }}</td>
|
||||
<td class="align-middle">{{ $conceptModel->subtitle }}</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.concepts.change-order', ['concept' => $conceptModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $conceptModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $conceptModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.concepts.change-order', ['concept' => $conceptModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $conceptModels->currentPage() === $conceptModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $conceptModels->currentPage() === $conceptModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $conceptModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.concepts.destroy', $conceptModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.concepts.edit', $conceptModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.concepts'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.concepts'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($conceptModels->count())
|
||||
@foreach ($conceptModels as $conceptModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $conceptModel->name }}</td>
|
||||
<td class="align-middle">{{ $conceptModel->title }}</td>
|
||||
<td class="align-middle">{{ $conceptModel->subtitle }}</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $conceptModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.concepts.change-order', ['concept' => $conceptModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $conceptModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $conceptModels->currentPage() === $conceptModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.concepts.change-order', ['concept' => $conceptModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $conceptModels->currentPage() === $conceptModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $conceptModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.concepts.destroy', $conceptModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.concepts.edit', $conceptModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.concepts'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.concepts'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.concepts') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="6">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.concepts')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,92 +1,93 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => [
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
],
|
||||
'mobileHide' => ['status']
|
||||
'mobileHide' => ['status'],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($newsListModels->count())
|
||||
@foreach ($newsListModels as $newsModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $newsModel->title }}</td>
|
||||
<td class="align-middle">{{ $newsModel->subtitle }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.news.change-published', $newsModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn btn-sm"
|
||||
title="{{ __($newsModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
@if($newsModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.news.change-order', ['news' => $newsModel, 'action' => 'up']) }}"
|
||||
method="POST"
|
||||
class="text-center @if($loop->first and $newsListModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $newsListModels->onFirstPage())) disabled @endif"
|
||||
title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.news.change-order', ['news' => $newsModel, 'action' => 'down']) }}"
|
||||
method="POST"
|
||||
class="text-center @if($loop->last and $newsListModels->currentPage() === $newsListModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn btn-sm @if($loop->last and $newsListModels->currentPage() === $newsListModels->lastPage()) disabled @endif"
|
||||
title="{{ __('Change the order of appearance downwards') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $newsModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.news.destroy', $newsModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.news.edit', $newsModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.news'))]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.news'))]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($newsListModels->count())
|
||||
@foreach ($newsListModels as $newsModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $newsModel->title }}</td>
|
||||
<td class="align-middle">{{ $newsModel->subtitle }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.news.change-published', $newsModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __($newsModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}">
|
||||
@if ($newsModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $newsListModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.news.change-order', ['news' => $newsModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $newsListModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $newsListModels->currentPage() === $newsListModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.news.change-order', ['news' => $newsModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $newsListModels->currentPage() === $newsListModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $newsModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.news.destroy', $newsModel->id) }}" method="POST"
|
||||
novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.news.edit', $newsModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.news'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.news'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.news') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="6">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.news')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,93 +1,91 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => [
|
||||
'label' => __('validation.attributes.label'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')
|
||||
'label' => __('validation.attributes.label'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
],
|
||||
'mobileHide' => ['status']
|
||||
'mobileHide' => ['status'],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($productModels->count())
|
||||
@foreach ($productModels as $productModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $productModel->label }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.products.change-published', $productModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn btn-sm"
|
||||
title="{{ __($productModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
@if($productModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.products.change-order', ['product' => $productModel, 'action' => 'up']) }}"
|
||||
method="POST"
|
||||
class="text-center @if($loop->first and $productModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn btn-sm @if(($loop->first and $productModels->onFirstPage())) disabled @endif"
|
||||
title="{{ __('Change the order of appearance upwards') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.products.change-order', ['product' => $productModel, 'action' => 'down']) }}"
|
||||
method="POST"
|
||||
class="text-center @if($loop->last and $productModels->currentPage() === $productModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
class="btn btn-sm @if($loop->last and $productModels->currentPage() === $productModels->lastPage()) disabled @endif"
|
||||
title="{{ __('Change the order of appearance downwards') }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $productModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.products.destroy', $productModel->id) }}"
|
||||
method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.products.edit', $productModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.products'))]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.products'))]) }}"
|
||||
data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($productModels->count())
|
||||
@foreach ($productModels as $productModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $productModel->label }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.products.change-published', $productModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __($productModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}">
|
||||
@if ($productModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $productModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.products.change-order', ['product' => $productModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $productModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $productModels->currentPage() === $productModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.products.change-order', ['product' => $productModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $productModels->currentPage() === $productModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $productModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.products.destroy', $productModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.products.edit', $productModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.products'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.products'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.products') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="5">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.products')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,74 +1,91 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'label' => __('validation.attributes.label'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'label' => __('validation.attributes.label'),
|
||||
'status' => __('validation.attributes.visibility'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($rangeModels->count())
|
||||
@foreach ($rangeModels as $rangeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $rangeModel->label }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.ranges.change-published', $rangeModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm" title="{{ __($rangeModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}" data-bs-toggle="tooltip">
|
||||
@if($rangeModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.ranges.change-order', ['range' => $rangeModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $rangeModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $rangeModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.ranges.change-order', ['range' => $rangeModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $rangeModels->currentPage() === $rangeModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $rangeModels->currentPage() === $rangeModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $rangeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.ranges.destroy', $rangeModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.ranges.edit', $rangeModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.ranges'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.ranges'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($rangeModels->count())
|
||||
@foreach ($rangeModels as $rangeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $rangeModel->label }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.ranges.change-published', $rangeModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __($rangeModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}">
|
||||
@if ($rangeModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $rangeModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.ranges.change-order', ['range' => $rangeModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $rangeModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $rangeModels->currentPage() === $rangeModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.ranges.change-order', ['range' => $rangeModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $rangeModels->currentPage() === $rangeModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $rangeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.ranges.destroy', $rangeModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.ranges.edit', $rangeModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.ranges'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.ranges'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.ranges') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="5">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.ranges')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,74 +1,91 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'status' => __('crud.minicrud.visibility_label'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'status' => __('crud.minicrud.visibility_label'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($recipeModels->count())
|
||||
@foreach ($recipeModels as $recipeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $recipeModel->name }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.recipes.change-published', $recipeModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm" title="{{ __($recipeModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}" data-bs-toggle="tooltip">
|
||||
@if($recipeModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.recipes.change-order', ['recipe' => $recipeModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $recipeModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $recipeModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.recipes.change-order', ['recipe' => $recipeModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $recipeModels->currentPage() === $recipeModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $recipeModels->currentPage() === $recipeModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $recipeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.recipes.destroy', $recipeModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.recipes.edit', $recipeModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.recipes'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.recipes'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($recipeModels->count())
|
||||
@foreach ($recipeModels as $recipeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $recipeModel->name }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.recipes.change-published', $recipeModel->id) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __($recipeModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}">
|
||||
@if ($recipeModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $recipeModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.recipes.change-order', ['recipe' => $recipeModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $recipeModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $recipeModels->currentPage() === $recipeModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.recipes.change-order', ['recipe' => $recipeModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $recipeModels->currentPage() === $recipeModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $recipeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.recipes.destroy', $recipeModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.recipes.edit', $recipeModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.recipes'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.recipes'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.recipes') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="5">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.recipes')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,76 +1,93 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'status' => __('crud.minicrud.visibility_label'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'title' => __('validation.attributes.title'),
|
||||
'subtitle' => __('validation.attributes.subtitle'),
|
||||
'status' => __('crud.minicrud.visibility_label'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [ 'cols' => $cols, 'mobileHide' => ['status']])
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($sliderModels->count())
|
||||
@foreach ($sliderModels as $sliderModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $sliderModel->title }}</td>
|
||||
<td class="align-middle">{{ $sliderModel->subtitle }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.sliders.change-published', $sliderModel) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm" title="{{ __($sliderModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}" data-bs-toggle="tooltip">
|
||||
@if($sliderModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.sliders.change-order', ['slider' => $sliderModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $sliderModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $sliderModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.sliders.change-order', ['slider' => $sliderModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $sliderModels->currentPage() === $sliderModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $sliderModels->currentPage() === $sliderModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $sliderModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.sliders.destroy', $sliderModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.sliders.edit', $sliderModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.sliders'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.sliders'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($sliderModels->count())
|
||||
@foreach ($sliderModels as $sliderModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $sliderModel->title }}</td>
|
||||
<td class="align-middle">{{ $sliderModel->subtitle }}</td>
|
||||
<td class="d-none d-lg-table-cell text-center align-middle">
|
||||
<form action="{{ route('bo.sliders.change-published', $sliderModel) }}" method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __($sliderModel->status ? __('crud.helpers.unpublish') : __('crud.helpers.publish')) }}">
|
||||
@if ($sliderModel->status)
|
||||
<i class="fs-6 text-success fa-solid fa-circle-check"></i>
|
||||
@else
|
||||
<i class="fs-6 text-danger fa-regular fa-circle-xmark"></i>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $sliderModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.sliders.change-order', ['slider' => $sliderModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $sliderModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $sliderModels->currentPage() === $sliderModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.sliders.change-order', ['slider' => $sliderModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $sliderModels->currentPage() === $sliderModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $sliderModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.sliders.destroy', $sliderModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.sliders.edit', $sliderModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.sliders'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.sliders'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.sliders') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="5">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.sliders')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,61 +1,77 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [ 'cols' => $cols, 'mobileHide' => ['status']])
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($storeGroupModels->count())
|
||||
@foreach ($storeGroupModels as $storeGroupModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeGroupModel->name }}</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.storegroups.change-order', ['storegroup' => $storeGroupModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $storeGroupModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $storeGroupModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.storegroups.change-order', ['storegroup' => $storeGroupModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $storeGroupModels->currentPage() === $storeGroupModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $storeGroupModels->currentPage() === $storeGroupModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $storeGroupModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.storegroups.destroy', $storeGroupModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.storegroups.edit', $storeGroupModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storegroups'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storegroups'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($storeGroupModels->count())
|
||||
@foreach ($storeGroupModels as $storeGroupModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeGroupModel->name }}</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $storeGroupModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storegroups.change-order', ['storegroup' => $storeGroupModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $storeGroupModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $storeGroupModels->currentPage() === $storeGroupModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storegroups.change-order', ['storegroup' => $storeGroupModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $storeGroupModels->currentPage() === $storeGroupModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $storeGroupModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.storegroups.destroy', $storeGroupModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.storegroups.edit', $storeGroupModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storegroups'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storegroups'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storegroups') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="4">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storegroups')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,61 +1,77 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [ 'cols' => $cols, 'mobileHide' => ['status']])
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($storeRegionModels->count())
|
||||
@foreach ($storeRegionModels as $storeRegionModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeRegionModel->name }}</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.storeregions.change-order', ['storeregion' => $storeRegionModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $storeRegionModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $storeRegionModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.storeregions.change-order', ['storeregion' => $storeRegionModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $storeRegionModels->currentPage() === $storeRegionModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $storeRegionModels->currentPage() === $storeRegionModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $storeRegionModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.storeregions.destroy', $storeRegionModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.storeregions.edit', $storeRegionModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storeregions'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storeregions'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($storeRegionModels->count())
|
||||
@foreach ($storeRegionModels as $storeRegionModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeRegionModel->name }}</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $storeRegionModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storeregions.change-order', ['storeregion' => $storeRegionModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $storeRegionModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $storeRegionModels->currentPage() === $storeRegionModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storeregions.change-order', ['storeregion' => $storeRegionModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $storeRegionModels->currentPage() === $storeRegionModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $storeRegionModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.storeregions.destroy', $storeRegionModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.storeregions.edit', $storeRegionModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storeregions'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storeregions'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storeregions') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="4">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storeregions')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,79 +1,95 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'state' => __('validation.attributes.state'),
|
||||
'type_id' => __('validation.attributes.type'),
|
||||
'street' => __('validation.attributes.street'),
|
||||
'zipcode' => __('validation.attributes.postal_code'),
|
||||
'city' => __('validation.attributes.city'),
|
||||
'region_id' => __('validation.attributes.region'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'state' => __('validation.attributes.state'),
|
||||
'type_id' => __('validation.attributes.type'),
|
||||
'street' => __('validation.attributes.street'),
|
||||
'zipcode' => __('validation.attributes.postal_code'),
|
||||
'city' => __('validation.attributes.city'),
|
||||
'region_id' => __('validation.attributes.region'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [ 'cols' => $cols, 'mobileHide' => ['status']])
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($storeModels->count())
|
||||
@foreach ($storeModels as $storeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeModel->state }}</td>
|
||||
<td class="align-middle">
|
||||
<a href="{{ route('bo.storetypes.edit', ['storetype' => $storeModel->storeType])}}">
|
||||
{{ $storeModel->storeType->name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ $storeModel->street }}</td>
|
||||
<td class="align-middle">{{ $storeModel->zipcode }}</td>
|
||||
<td class="align-middle">{{ $storeModel->city }}</td>
|
||||
<td class="align-middle">
|
||||
<a href="{{ route('bo.storeregions.edit', ['storeregion' => $storeModel->storeRegion])}}">
|
||||
{{ $storeModel->storeRegion->name }}
|
||||
</a>
|
||||
</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.stores.change-order', ['store' => $storeModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $storeModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $storeModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.stores.change-order', ['store' => $storeModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $storeModels->currentPage() === $storeModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $storeModels->currentPage() === $storeModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $storeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.stores.destroy', $storeModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.stores.edit', $storeModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.stores'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.stores'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($storeModels->count())
|
||||
@foreach ($storeModels as $storeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeModel->state }}</td>
|
||||
<td class="align-middle">
|
||||
<a href="{{ route('bo.storetypes.edit', ['storetype' => $storeModel->storeType]) }}">
|
||||
{{ $storeModel->storeType->name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ $storeModel->street }}</td>
|
||||
<td class="align-middle">{{ $storeModel->zipcode }}</td>
|
||||
<td class="align-middle">{{ $storeModel->city }}</td>
|
||||
<td class="align-middle">
|
||||
<a href="{{ route('bo.storeregions.edit', ['storeregion' => $storeModel->storeRegion]) }}">
|
||||
{{ $storeModel->storeRegion->name }}
|
||||
</a>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $storeModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.stores.change-order', ['store' => $storeModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $storeModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $storeModels->currentPage() === $storeModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.stores.change-order', ['store' => $storeModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $storeModels->currentPage() === $storeModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $storeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.stores.destroy', $storeModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.stores.edit', $storeModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.stores'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.stores'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="9" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.stores') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="9">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.stores')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,61 +1,77 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table fix-action m-0">
|
||||
<table class="fix-action m-0 table">
|
||||
<thead>
|
||||
@php
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at')];
|
||||
$cols = [
|
||||
'name' => __('validation.attributes.name'),
|
||||
'order' => __('validation.attributes.order'),
|
||||
'updated_at' => __('validation.attributes.updated_at'),
|
||||
];
|
||||
@endphp
|
||||
@include('bo.modules.table-col-sorter', [ 'cols' => $cols, 'mobileHide' => ['status']])
|
||||
@include('bo.modules.table-col-sorter', ['cols' => $cols, 'mobileHide' => ['status']])
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($storeTypeModels->count())
|
||||
@foreach ($storeTypeModels as $storeTypeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeTypeModel->name }}</td>
|
||||
@php $routeName = request()->route()->getName(); @endphp
|
||||
@if(empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form action="{{ route('bo.storetypes.change-order', ['storetype' => $storeTypeModel, 'action' => 'up']) }}" method="POST" class="text-center @if($loop->first and $storeTypeModels->onFirstPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if(($loop->first and $storeTypeModels->onFirstPage())) disabled @endif" title="{{ __('Change the order of appearance upwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('bo.storetypes.change-order', ['storetype' => $storeTypeModel, 'action' => 'down']) }}" method="POST" class="text-center @if($loop->last and $storeTypeModels->currentPage() === $storeTypeModels->lastPage()) invisible @endif">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm @if($loop->last and $storeTypeModels->currentPage() === $storeTypeModels->lastPage()) disabled @endif" title="{{ __('Change the order of appearance downwards') }}" data-bs-toggle="tooltip">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span class="badge bg-warning text-dark text-wrap">{{ $storeTypeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form action="{{ route('bo.storetypes.destroy', $storeTypeModel->id) }}" method="POST" class="btn-group confirmDeleteJS" novalidate>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('bo.storetypes.edit', $storeTypeModel->id) }}" title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storetypes'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storetypes'))]) }}" data-bs-toggle="tooltip">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@if ($storeTypeModels->count())
|
||||
@foreach ($storeTypeModels as $storeTypeModel)
|
||||
<tr>
|
||||
<td class="align-middle">{{ $storeTypeModel->name }}</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
@if (empty(request()->search) and empty($noOrder) and Session::get("$routeName.sort_col") === 'order')
|
||||
<td class="d-flex">
|
||||
<form class="@if ($loop->first and $storeTypeModels->onFirstPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storetypes.change-order', ['storetype' => $storeTypeModel, 'direction' => 'up']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->first and $storeTypeModels->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance upwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form class="@if ($loop->last and $storeTypeModels->currentPage() === $storeTypeModels->lastPage()) invisible @endif text-center"
|
||||
action="{{ route('bo.storetypes.change-order', ['storetype' => $storeTypeModel, 'direction' => 'down']) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
<button class="btn btn-sm @if ($loop->last and $storeTypeModels->currentPage() === $storeTypeModels->lastPage()) disabled @endif" data-bs-toggle="tooltip"
|
||||
type="submit" title="{{ __('Change the order of appearance downwards') }}">
|
||||
<i class="fas fa-arrow-alt-circle-down"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
@endif
|
||||
<td class="align-middle">
|
||||
<span
|
||||
class="badge bg-warning text-dark text-wrap">{{ $storeTypeModel->updated_at->formatLocalized('%d/%m/%Y à %H:%M') }}</span>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<form class="btn-group confirmDeleteJS" action="{{ route('bo.storetypes.destroy', $storeTypeModel->id) }}"
|
||||
method="POST" novalidate>
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.storetypes.edit', $storeTypeModel->id) }}"
|
||||
title="{{ __('crud.helpers.update_model', ['model' => Str::singular(__('models.classes.storetypes'))]) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip"
|
||||
title="{{ __('crud.helpers.delete_model', ['model' => Str::singular(__('models.classes.storetypes'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storetypes') ])}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center" colspan="4">
|
||||
<span class="h3">{{ __('crud.helpers.no_results', ['models' => __('models.classes.storetypes')]) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ Route::prefix('bo')
|
|||
Route::resource('sliders', SliderController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:description']);
|
||||
Route::post('/sliders/{slider}/change-order', [SliderController::class, 'changeOrder'])
|
||||
Route::post('/sliders/{slider}/change-order/{direction}', [SliderController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('sliders.change-order');
|
||||
Route::post('/sliders/{slider}/change-published', [SliderController::class, 'changePublished'])
|
||||
->name('sliders.change-published');
|
||||
|
|
@ -71,7 +72,8 @@ Route::prefix('bo')
|
|||
Route::resource('news', NewsController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:content']);
|
||||
Route::post('/news/{news}/change-order', [NewsController::class, 'changeOrder'])
|
||||
Route::post('/news/{news}/change-order/{direction}', [NewsController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('news.change-order');
|
||||
Route::post('/news/{news}/change-published', [NewsController::class, 'changePublished'])
|
||||
->name('news.change-published');
|
||||
|
|
@ -80,12 +82,14 @@ Route::prefix('bo')
|
|||
Route::resource('concepts', ConceptController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:description,data']);
|
||||
Route::post('/concepts/{concept}/change-order', [ConceptController::class, 'changeOrder'])
|
||||
Route::post('/concepts/{concept}/change-order/{direction}', [ConceptController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('concepts.change-order');
|
||||
|
||||
// * RANGES
|
||||
Route::resource('ranges', RangeController::class)->except(['show']);
|
||||
Route::post('/ranges/{range}/change-order', [RangeController::class, 'changeOrder'])
|
||||
Route::post('/ranges/{range}/change-order/{direction}', [RangeController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('ranges.change-order');
|
||||
Route::post('/ranges/{range}/change-published', [RangeController::class, 'changePublished'])
|
||||
->name('ranges.change-published');
|
||||
|
|
@ -94,7 +98,8 @@ Route::prefix('bo')
|
|||
Route::resource('products', ProductController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:description,marinade']);
|
||||
Route::post('/products/{product}/change-order', [ProductController::class, 'changeOrder'])
|
||||
Route::post('/products/{product}/change-order/{direction}', [ProductController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('products.change-order');
|
||||
Route::post('/products/{product}/change-published', [ProductController::class, 'changePublished'])
|
||||
->name('products.change-published');
|
||||
|
|
@ -103,36 +108,51 @@ Route::prefix('bo')
|
|||
Route::resource('recipes', RecipeController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:steps,tips']);
|
||||
Route::post('/recipes/{recipe}/change-order', [RecipeController::class, 'changeOrder'])
|
||||
Route::post('/recipes/{recipe}/change-order/{direction}', [RecipeController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('recipes.change-order');
|
||||
Route::post('/recipes/{recipe}/change-published', [RecipeController::class, 'changePublished'])
|
||||
->name('recipes.change-published');
|
||||
|
||||
// * STORES
|
||||
Route::resource('stores', StoreController::class)->except(['show']);
|
||||
Route::post('/stores/{store}/change-order', [StoreController::class, 'changeOrder'])
|
||||
Route::post('/stores/{store}/change-order/{direction}', [StoreController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('stores.change-order');
|
||||
|
||||
// * STORE GROUPS
|
||||
Route::resource('storegroups', StoreGroupController::class)->except(['show']);
|
||||
Route::post('/storegroups/{storegroup}/change-order', [StoreGroupController::class, 'changeOrder'])
|
||||
Route::post(
|
||||
'/storegroups/{storegroup}/change-order/{direction}',
|
||||
[StoreGroupController::class, 'changeOrder']
|
||||
)
|
||||
->where('direction', 'up|down')
|
||||
->name('storegroups.change-order');
|
||||
|
||||
// * STORE REGIONS
|
||||
Route::resource('storeregions', StoreRegionController::class)->except(['show']);
|
||||
Route::post('/storeregions/{storeregion}/change-order', [StoreRegionController::class, 'changeOrder'])
|
||||
Route::post(
|
||||
'/storeregions/{storeregion}/change-order/{direction}',
|
||||
[StoreRegionController::class, 'changeOrder']
|
||||
)
|
||||
->where('direction', 'up|down')
|
||||
->name('storeregions.change-order');
|
||||
|
||||
// * STORE TYPES
|
||||
Route::resource('storetypes', StoreTypeController::class)->except(['show']);
|
||||
Route::post('/storetypes/{storetype}/change-order', [StoreTypeController::class, 'changeOrder'])
|
||||
Route::post(
|
||||
'/storetypes/{storetype}/change-order/{direction}',
|
||||
[StoreTypeController::class, 'changeOrder']
|
||||
)
|
||||
->where('direction', 'up|down')
|
||||
->name('storetypes.change-order');
|
||||
|
||||
// * SLIDERS
|
||||
Route::resource('sliders', SliderController::class)->except(['show'])
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:description']);
|
||||
Route::post('/sliders/{slider}/change-order', [SliderController::class, 'changeOrder'])
|
||||
Route::post('/sliders/{slider}/change-order/{direction}', [SliderController::class, 'changeOrder'])
|
||||
->where('direction', 'up|down')
|
||||
->name('sliders.change-order');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue