Added brandAvantages CRUD

This commit is contained in:
Noah Lancien 2024-03-29 09:38:01 +01:00
parent 69a4927371
commit 9675228e3b
30 changed files with 1322 additions and 11 deletions

View file

@ -0,0 +1,183 @@
<?php
namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\BrandAdvantages\StoreBrandAdvantageRequest;
use App\Http\Requests\Bo\BrandAdvantages\UpdateBrandAdvantageRequest;
use App\Models\BrandAdvantage;
use App\Traits\Controllers\ChangesModelOrder;
use App\Traits\Controllers\UpdateModelPublished;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class BrandAdvantageController extends Controller
{
use UpdateModelPublished;
use ChangesModelOrder;
/**
* Create the controller instance.
*/
public function __construct()
{
$this->authorizeResource(BrandAdvantage::class);
}
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request): \Illuminate\Contracts\View\View
{
/** @var \Illuminate\Database\Eloquent\Builder $brandAdvantageModels */
$brandAdvantageModels = BrandAdvantage::query();
/** @var string $search Search field */
$search = $request->search;
if ($search) {
$this->searchQuery(
$brandAdvantageModels,
$search,
null,
'title',
'sustitle',
'text',
);
}
$searchFields = str(\implode(', ', [
trans('validation.attributes.title'),
trans('validation.custom.sustitle'),
trans('validation.attributes.text'),
]))->ucfirst();
/** Sort columns with a query */
$this->sortQuery($brandAdvantageModels);
/** Custom pagination */
$brandAdvantageModels = $this->paginate($brandAdvantageModels);
return view('bo.pages.brand_advantages.index', compact('brandAdvantageModels', 'search', 'searchFields'));
}
/**
* Show a specific resource.
*
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Contracts\View\View
*/
public function show(BrandAdvantage $brandAdvantage): \Illuminate\Contracts\View\View
{
return view('bo.pages.brand_advantages.show', ['brandAdvantageModel' => $brandAdvantage]);
}
/**
* Show the form for creating a new resource.
*
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Contracts\View\View
*/
public function create(BrandAdvantage $brandAdvantage): \Illuminate\Contracts\View\View
{
return view('bo.pages.brand_advantages.create', ['brandAdvantageModel' => $brandAdvantage]);
}
/**
* Store a newly created resource in storage.
*
* @param \App\Http\Requests\Bo\BrandAdvantages\StoreBrandAdvantageRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(StoreBrandAdvantageRequest $request): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request) {
$brandAdvantage = new BrandAdvantage();
$brandAdvantage->fill($request->validated());
if ($brandAdvantage->saveOrFail()) {
return redirect()->route('bo.brand_advantages.edit', $brandAdvantage)
->with('success', __('crud.messages.has_been_created', [
'model' => str(trans_choice('models.classes.brand_advantage', '1'))->ucfirst()
]));
}
return redirect()->back()
->with('error', __('crud.messages.cannot_be_created', [
'model' => str(trans_choice('models.classes.brand_advantage', 1))->ucfirst()
]));
});
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Contracts\View\View
*/
public function edit(BrandAdvantage $brandAdvantage): \Illuminate\Contracts\View\View
{
return view('bo.pages.brand_advantages.edit', ['brandAdvantageModel' => $brandAdvantage]);
}
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\Bo\BrandAdvantages\UpdateBrandAdvantageRequest $request
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateBrandAdvantageRequest $request, BrandAdvantage $brandAdvantage): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $brandAdvantage) {
$brandAdvantage->fill($request->validated());
if ($brandAdvantage->saveOrFail()) {
return redirect()->route('bo.brand_advantages.edit', $brandAdvantage)
->with('success', __('crud.messages.has_been_updated', [
'model' => str(trans_choice('models.classes.brand_advantage', '1'))->ucfirst()
]));
}
return redirect()->route('bo.brand_advantages.edit', $brandAdvantage)
->with('error', __('crud.messages.cannot_be_updated', [
'model' => str(trans_choice('models.classes.brand_advantage', 1))->ucfirst()
]));
});
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(BrandAdvantage $brandAdvantage): \Illuminate\Http\RedirectResponse
{
/** @var array<string,string> */
$previousQueries = [];
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
if ($brandAdvantage->deleteOrFail()) {
return redirect()->route('bo.brand_advantages.index', $previousQueries)
->with('success', __('crud.messages.has_been_deleted', [
'model' => str(trans_choice('models.classes.brand_advantage', 1))->ucfirst()
]));
}
return redirect()->back()
->with('error', __('crud.messages.cannot_be_deleted', [
'model' => str(__('models.classebrand_advantage'))->ucfirst()
]));
}
/**
* Duplicate the specified resource.
*
* @param \App\Models\BrandAdvantage $brandAdvantage
* @return \Illuminate\Contracts\View\View
*/
public function duplicate(BrandAdvantage $brandAdvantage): \Illuminate\Contracts\View\View
{
return $this->create($brandAdvantage->replicate());
}
}

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Fo;
use App\Enums\StaticPageType;
use App\Http\Controllers\Controller;
use App\Models\BrandAdvantage;
use App\Models\Profession;
use App\Models\StaticPage;
@ -53,8 +54,9 @@ class StaticPageController extends Controller
*/
public function recruitment(StaticPage $staticPageModel)
{
$staticPageModel = StaticPage::query()->where('type', StaticPageType::recruitment)->first();
$professionModels = Profession::query()->where('published', true)->take(5)->get();
return view('fo.pages.recruitment', compact('staticPageModel', 'professionModels'));
$staticPageModel = StaticPage::query()->where('type', StaticPageType::recruitment)->first();
$professionModels = Profession::query()->where('published', true)->take(5)->get();
$brandAdvantageModels = BrandAdvantage::query()->where('published', true)->orderBy('order')->get();
return view('fo.pages.recruitment', compact('staticPageModel', 'professionModels', 'brandAdvantageModels'));
}
}

View file

@ -0,0 +1,78 @@
<?php
namespace App\Http\Requests\Bo\BrandAdvantages;
use App\Models\BrandAdvantage;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StoreBrandAdvantageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('create', BrandAdvantage::class);
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation(): void
{
$this->merge([
'published' => $this->boolean('published'),
'is_large' => $this->boolean('published'),
]);
$this->mergePicture('picto');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = [
'title' => 'required|string|between:3,255',
'sustitle' => 'required|string|between:3,255',
'picto_alt' => 'required|string|between:3,255',
'picto_title' => 'required|string|between:3,255',
'text' => 'sometimes|nullable|string|between:3,165',
'is_large' => 'required|boolean',
'published' => 'required|boolean',
];
return \array_merge(
$rules,
$this->pictureRules('picto', 150, 150, 150, 150, false),
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'title' => trans('validation.attributes.title'),
'sustitle' => trans('validation.custom.sustitle'),
'picto' => trans('validation.custom.picto'),
'picto_alt' => trans('validation.custom.alt_attribute'),
'picto_title' => trans('validation.custom.title_attribute'),
'text' => trans('validation.attributes.text'),
'is_large' => trans('validation.custom.is_large'),
'published' => trans('validation.custom.publication')
];
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace App\Http\Requests\Bo\BrandAdvantages;
use Illuminate\Support\Facades\Gate;
class UpdateBrandAdvantageRequest extends StoreBrandAdvantageRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('update', $this->route('brand_advantage'));
}
}

View file

@ -464,4 +464,22 @@ class FileStorageHelper
$filename = trim($filename, '.-');
return $filename;
}
/**
* Remove all model files for the given Model.
*
* @param Model $model
* @return void
*/
public static function removeModelFiles(Model $model): void
{
$tableName = $model::query()->getModel()->getTable();
if (!empty(Storage::disk('public')->allFiles("modelfiles/{$tableName}"))) {
Storage::disk('public')->deleteDirectory("modelfiles/{$tableName}");
}
if (!empty(Storage::disk('private')->allFiles("modelfiles/{$tableName}"))) {
Storage::disk('private')->deleteDirectory("modelfiles/{$tableName}");
}
}
}

View file

@ -0,0 +1,125 @@
<?php
namespace App\Models;
use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Session;
/**
* @property string $title Title.
* @property string $sustitle Sustitle.
* @property string $picto Path of the pictogram.
* @property string $picto_alt Pictogram alt attribute.
* @property string $picto_title Pictogram title attribute.
* @property string $text Text.
* @property boolean $is_large Should the block be small or large ?
* @property int $order Order.
* @property boolean $published Publish status.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/
class BrandAdvantage extends Model
{
use ActivityLog;
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'title',
'sustitle',
'picto',
'picto_alt',
'picto_title',
'text',
'is_large',
'order',
'published',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'is_large' => 'bool',
'published' => 'bool',
];
/**
* Perform any actions required after the model boots.
*
* @return void
*/
protected static function booted(): void
{
static::creating(function (self $model) {
self::setOrder($model);
self::manageFields($model);
});
static::updating(function (self $model) {
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picto');
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picto');
});
}
// * METHODS
/**
* Manage model fields.
*
* @param self $model
* @return void
*/
private static function manageFields(self $model): void
{
$model->picto = FileStorageHelper::storeFile($model, $model->picto, true);
if ($model->isMaxReached() && $model->isPublishStatusUpdated() && $model->published) {
$model->published = false;
session()->flash('error', __('9 avantages sont déjà publiés. Pour publier cet élément, veuillez en dépublier 1.'));
}
}
/**
* Set order after the last element of the list.
*
* @param self $model
* @return void
*/
private static function setOrder(self $model): void
{
$model->order = \intval(self::query()->max('order')) + 1;
}
/**
* Check if the limit of publishable models is reached.
*
* @return bool
*/
public function isMaxReached(): bool
{
return self::query()->where('published', true)->count() >= 9 ? true : false;
}
/**
* Check if the publish status of the model is different from the original.
*
* @return bool
*/
public function isPublishStatusUpdated(): bool
{
return \boolval($this->getOriginal('published')) !== $this->published ? true : false;
}
}

View file

@ -0,0 +1,122 @@
<?php
namespace App\Policies;
use App\Enums\Users\RoleEnum;
use App\Models\BrandAdvantage;
use App\Models\User;
use App\Policies\Rules\UserStaticRules;
class BrandAdvantagePolicy
{
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function viewAny(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function view(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function create(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function update(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function delete(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function restore(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function forceDelete(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can duplicate the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function duplicate(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can publish/unpublish the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function changePublished(User $authUser, BrandAdvantage $brandAdvantageModel): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin) &&
(!$brandAdvantageModel->isMaxReached() || $brandAdvantageModel->published);
}
/**
* Determine whether the user can change the order of the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function changeOrder(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
}

View file

@ -3,6 +3,7 @@
namespace App\Providers;
use App\Models\Profession;
use App\Models\BrandAdvantage;
use App\Models\User;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
@ -44,6 +45,7 @@ class RouteServiceProvider extends ServiceProvider
Route::model('user', User::class);
Route::model('profession', Profession::class);
Route::model('brand_advantage', BrandAdvantage::class);
}
/**

View file

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class BrandAdvantageFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'title' => fake()->text(10),
'sustitle' => fake()->text(10),
'picto_alt' => fake()->text(255),
'picto_title' => fake()->text(255),
'text' => fake()->text(165),
'is_large' => fake()->boolean(25),
'published' => fake()->boolean(75),
];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('brand_advantages', function (Blueprint $table) {
$table->id();
$table->string('title')->comment('Brand advantage title');
$table->string('sustitle')->nullable()->comment('Brand advantage sustitle');
$table->string('picto')->comment('Brand advantage pictogram');
$table->string('picto_alt')->comment('Pictogram alt attribute');
$table->string('picto_title')->comment('Pictogram title attribute');
$table->string('text')->nullable()->comment('Brand advantage text');
$table->boolean('is_large')->comment('Brand advantage block width');
$table->integer('order')->comment('Brand advantage order');
$table->boolean('published')->comment('Brand advantage publish status');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('brand_advantages');
}
};

View file

@ -0,0 +1,29 @@
<?php
namespace Database\Seeders\Development;
use App\Lib\Helpers\FileStorageHelper;
use App\Models\BrandAdvantage;
use Illuminate\Database\Seeder;
class BrandAdvantageSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
FileStorageHelper::removeModelFiles(new BrandAdvantage());
BrandAdvantage::factory(9)->make()->each(function (BrandAdvantage $brandAdvantageModel) {
$brandAdvantageModel->picto = FileStorageHelper::storeFile(
new BrandAdvantage(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/brand_advantages/default-picture-150x150.png'
))
);
$brandAdvantageModel->save();
});
}
}

View file

@ -3,6 +3,7 @@
namespace Database\Seeders;
use Database\Seeders\Development\ProfessionSeeder;
use Database\Seeders\Development\BrandAdvantageSeeder;
use Database\Seeders\Development\UserSeeder;
use Illuminate\Database\Seeder;
@ -17,7 +18,8 @@ class DevelopmentSeeder extends Seeder
{
$this->call([
UserSeeder::class,
ProfessionSeeder::class
ProfessionSeeder::class,
BrandAdvantageSeeder::class,
]);
}
}

View file

@ -3,13 +3,14 @@
return [
'actions' => [
'list' => 'list',
'view' => 'view',
'show' => 'view',
'create' => 'create',
'duplicate' => 'duplicate',
'update' => 'update',
'duplicate' => 'duplicate',
'delete' => 'delete',
'save' => 'save',
'edit' => 'edit',
'view' => 'overview',
],
'helpers' => [

View file

@ -3,13 +3,14 @@
return [
'actions' => [
'list' => 'liste',
'view' => 'voir',
'show' => 'voir',
'create' => 'créer',
'duplicate' => 'dupliquer',
'update' => 'éditer',
'duplicate' => 'dupliquer',
'delete' => 'supprimer',
'save' => 'sauvegarder',
'edit' => 'mettre à jour',
'view' => 'aperçu',
],
'helpers' => [

View file

@ -5,6 +5,7 @@ return [
'user' => 'utilisateur',
'activity_log' => 'journal d\'activité|journaux d\'activité',
'static_page' => 'page statique|pages statiques',
'brand_advantage' => 'avantage de la marque|avantages de la marque',
'profession' => 'profession',
]
];

View file

@ -241,5 +241,10 @@ return [
'video_id' => 'ID de la vidéo',
'vimeo_video_id' => 'ID de la vidéo viméo',
'youtube_video_id' => 'ID de la vidéo youtube',
'picto' => 'pictogramme',
'alt_attribute' => 'attribut alt',
'title_attribute' => 'attribut title',
'sustitle' => 'sous-titre',
'is_large' => 'Doit être large'
],
];

View file

@ -39,6 +39,7 @@ import {
faSearchMinus,
faSearchPlus,
faSyncAlt,
faThumbsUp,
faTimes,
faTrash,
faUndoAlt,
@ -91,5 +92,6 @@ library.add(faHouse);
library.add(faArrowUpRightFromSquare);
library.add(faEllipsisVertical);
library.add(faUserTie);
library.add(faThumbsUp);
dom.watch();

View file

@ -27,6 +27,15 @@
])>
<i class="fa-solid fa-user-tie"></i>&nbsp;{{ str(__('models.classes.profession'))->title() }}
</a>
{{-- BRAND ADVANTAGES --}}
<a data-bs-toggle="tooltip" href="{{ route('bo.brand_advantages.index') }}"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.brand_advantage', '*')]) }}" role="button"
@class([
'btn btn-primary w-100 mt-1',
'fw-bold active' => request()->routeIs('bo.brand_advantages.*'),
])>
<i class="fa-solid fa-thumbs-up"></i>&nbsp;{{ str(trans_choice('models.classes.brand_advantage', '*'))->title() }}
</a>
</div>
</nav>
@endauth

View file

@ -2,7 +2,7 @@
@can('changeOrder', $model)
<div class="d-flex justify-content-center align-items-center">
<form @class(['invisible' => $loop->first and $models->onFirstPage()])
action="{{ route('bo.' . $routeName . '.change-order', [str($routeName)->singular() => $model, 'direction' => 'up']) }}"
action="{{ route('bo.' . $routeName . '.change-order', [str($routeName)->singular()->value => $model, 'direction' => 'up']) }}"
method="POST">
@csrf
@method('PATCH')
@ -17,7 +17,7 @@
'invisible' =>
$loop->last and $models->currentPage() === $models->lastPage(),
])
action="{{ route('bo.' . $routeName . '.change-order', [str($routeName)->singular() => $model, 'direction' => 'down']) }}"
action="{{ route('bo.' . $routeName . '.change-order', [str($routeName)->singular()->value => $model, 'direction' => 'down']) }}"
method="POST">
@csrf
@method('PATCH')

View file

@ -0,0 +1,36 @@
@extends('bo.layout', ['brParam' => $brandAdvantageModel])
@section('title', __('Création d\'un :model', ['model' => trans_choice('models.classes.brand_advantage', 1)]))
@section('description', __('Création d\'un tout nouveau :model', ['model' => trans_choice('models.classes.brand_advantage', 1)]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
<div class="d-flex align-items-start flex-row">
<a class="btn btn-primary text-decoration-none m-0" data-bs-toggle="tooltip" href="{{ route('bo.brand_advantages.index') }}"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.brand_advantage', 1)]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $brandAdvantageModel])
</div>
<div class="mb-md-0 mb-2">
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.brand_advantage', 1)]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
</div>
</div>
<form action="{{ route('bo.brand_advantages.store') }}" method="POST" enctype="multipart/form-data">
@csrf
@include('bo.pages.brand_advantages.form')
@include('bo.partials.script-button-clone')
<div class="row mt-3">
<div class="col text-center">
<button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.brand_advantage', 1)]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
</div>
</div>
</form>
@endsection

View file

@ -0,0 +1,61 @@
@extends('bo.layout', ['brParam' => $brandAdvantageModel])
@section('title', __('Édition d\'un :model', ['model' => trans_choice('models.classes.brand_advantage', '1')]))
@section('description', __('Édition d\'un :model déjà existant', ['model' => trans_choice('models.classes.brand_advantage', '1')]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
<div class="d-flex align-items-start flex-row">
<a class="btn btn-primary text-decoration-none m-0" data-bs-toggle="tooltip" href="{{ route('bo.brand_advantages.index') }}"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.brand_advantage', '*')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $brandAdvantageModel])
</div>
<div class="mb-md-0 mb-2">
<form class="btn-group confirmDeleteTS" action="{{ route('bo.brand_advantages.destroy', $brandAdvantageModel) }}" method="POST"
novalidate>
@can('view', $brandAdvantageModel)
<a class="btn btn-warning" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.show', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.view'))->ucfirst() }}">
<i class="fa-solid fa-eye"></i>
</a>
@endcan
@can('duplicate', $brandAdvantageModel)
<a class="btn btn-secondary" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.duplicate', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}">
<i class="fa-solid fa-copy"></i>
</a>
@endcan
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.brand_advantage', '1')]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
@can('delete', $brandAdvantageModel)
@csrf
@method('DELETE')
<button class="btn btn-danger" data-bs-toggle="tooltip" type="submit" title="{{ str(__('crud.actions.delete'))->ucfirst() }}">
<i class="fa-solid fa-trash"></i>
</button>
@endcan
</form>
</div>
</div>
<form action="{{ route('bo.brand_advantages.update', $brandAdvantageModel) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
@include('bo.pages.brand_advantages.form')
@include('bo.partials.script-button-clone')
<div class="row">
<div class="col text-center">
<button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.brand_advantage', '1')]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
</div>
</div>
</form>
@endsection

View file

@ -0,0 +1,216 @@
<div class="row">
{{-- TITLE --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.attributes.title'))->ucfirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.varchar', [
'id' => 'brandAdvantageTitle',
'label' => str(
__(':field :inter:model', [
'field' => __('validation.attributes.title'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]))->ucfirst(),
'hasWordCounter' => true,
'name' => 'title',
'required' => true,
'model' => $brandAdvantageModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.attributes.title'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'min' => 3,
'max' => 255,
]),
'placeholder' => __('Un beau titre'),
])
</div>
</div>
</fieldset>
</div>
{{-- SUSTITLE --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.custom.sustitle'))->ucfirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.varchar', [
'id' => 'brandAdvantageSustitle',
'label' => str(
__(':field :inter:model', [
'field' => __('validation.custom.sustitle'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]))->ucfirst(),
'hasWordCounter' => true,
'name' => 'sustitle',
'required' => true,
'model' => $brandAdvantageModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.sustitle'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'min' => 3,
'max' => 255,
]),
'placeholder' => __('Un beau sous-titre'),
])
</div>
</div>
</fieldset>
</div>
{{-- TEXT --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.attributes.text'))->ucfirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.varchar', [
'id' => 'brandAdvantageText',
'label' => str(
__(':field :inter:model', [
'field' => __('validation.attributes.text'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]))->ucfirst(),
'hasWordCounter' => true,
'name' => 'text',
'required' => true,
'model' => $brandAdvantageModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.attributes.text'),
'inter' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'min' => 3,
'max' => 165,
]),
'placeholder' => __('Un beau texte'),
])
</div>
</div>
</fieldset>
</div>
{{-- PICTO --}}
<div class="col-12 pb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.custom.picto'))->ucfirst() }}</legend>
<div class="row mb-3">
{{-- PICTO_ALT --}}
<div class="col-12 col-lg-6 m-lg-0 mb-3">
@include('bo.partials.inputs.varchar', [
'id' => 'productPictoAlt',
'label' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => str(__('validation.custom.alt_attribute'))->ucfirst(),
'inter1' => __('validation.custom.of_the.male'),
'field2' => __('validation.custom.picto'),
'inter2' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'hasWordCounter' => true,
'name' => 'picto_alt',
'required' => true,
'model' => $brandAdvantageModel ?? null,
'helper' => __('crud.minicrud.picture_alt_helper'),
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => str(__('validation.custom.alt_attribute'))->ucfirst(),
'inter1' => __('validation.custom.of_the.male'),
'field2' => __('validation.custom.picto'),
'inter2' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
])
</div>
{{-- PICTO_TITLE --}}
<div class="col-12 col-lg-6 mb-3">
@include('bo.partials.inputs.varchar', [
'id' => 'productPictoTitle',
'label' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => str(__('validation.custom.title_attribute'))->ucfirst(),
'inter1' => __('validation.custom.of_the.male'),
'field2' => __('validation.custom.picto'),
'inter2' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'hasWordCounter' => true,
'name' => 'picto_title',
'required' => true,
'model' => $brandAdvantageModel ?? null,
'helper' => __('crud.minicrud.picture_title_helper'),
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
'field1' => str(__('validation.custom.title_attribute'))->ucfirst(),
'inter1' => __('validation.custom.of_the.male'),
'field2' => __('validation.custom.picto'),
'inter2' => __('validation.custom.of_the.vowel'),
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
])
</div>
{{-- PICTO --}}
<div class="col-12">
@include('bo.partials.inputs.varchar-picture', [
'id' => 'productPicto',
'name' => 'picto',
'width' => 150,
'height' => 150,
'model' => $brandAdvantageModel ?? null,
'helper' => __('crud.minicrud.dimensions_must_be', [
'widthpx' => '150px',
'heightpx' => '150px',
]),
'required' => true,
'preview' => true,
])
</div>
</div>
</fieldset>
</div>
{{-- IS_LARGE --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ __('Largeur de l\'élément') }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.tinyint-boolean', [
'id' => 'brandAdvantageIsLarge',
'name' => 'is_large',
'label' => __('Largeur de l\':model', [
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'helper' => __('Cocher pour indiquer que l\'affichage doit être large.'),
'model' => $brandAdvantageModel ?? null,
])
</div>
</div>
</fieldset>
</div>
{{-- STATUS --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ __('Visibilité') }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.tinyint-boolean', [
'id' => 'brandAdvantagePublished',
'name' => 'published',
'label' => __('État de publication de l\':model', [
'model' => trans_choice('models.classes.brand_advantage', '1'),
]),
'helper' => __('Deux réponses possibles : oui ou non.'),
'model' => $brandAdvantageModel ?? null,
])
</div>
</div>
</fieldset>
</div>
<div class="col-12 text-center">
<p><b>{{ __('* Champs obligatoires') }}</b></p>
</div>
</div>

View file

@ -0,0 +1,88 @@
<table class="table-hover table-fix-action m-0 table">
@if (count($brandAdvantageModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'title' => str(__('validation.attributes.title'))->ucfirst(),
'sustitle' => str(__('validation.custom.sustitle'))->ucfirst(),
'text' => str(__('validation.attributes.text'))->ucfirst(),
'order' => str(__('validation.custom.order'))->ucfirst(),
'published' => str(__('validation.custom.activated'))->ucfirst(),
'updated_at' => str(__('validation.attributes.updated_at'))->ucfirst(),
],
])
</thead>
<tbody>
@foreach ($brandAdvantageModels as $brandAdvantageModel)
<tr class="border-bottom">
<td class="text-center align-middle">{{ $brandAdvantageModel->title }}</td>
<td class="text-center align-middle">{{ $brandAdvantageModel->sustitle }}</td>
<td class="text-center align-middle">{{ $brandAdvantageModel->text }}</td>
@php
$routeName = request()->route()->getName();
@endphp
@if (empty(request()->search) && session()->get("$routeName.sort_col") === 'order')
@include('bo.modules.change-model-order', [
'routeName' => 'brand_advantages',
'model' => $brandAdvantageModel,
'models' => $brandAdvantageModels,
])
@endif
@include('bo.modules.change-published-status', [
'routeName' => 'brand_advantages',
'model' => $brandAdvantageModel,
])
<td class="text-center align-middle">
<span class="badge bg-secondary">{{ $brandAdvantageModel->updated_at->isoFormat('LLLL') }}</span>
</td>
<td class="text-end align-middle">
@canAny(['view', 'duplicate', 'update', 'delete'], $brandAdvantageModel)
<form class="btn-group confirmDeleteTS" action="{{ route('bo.brand_advantages.destroy', $brandAdvantageModel) }}"
method="POST" novalidate>
@can('view', $brandAdvantageModel)
<a class="btn btn-sm btn-warning" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.show', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.show'))->ucfirst() }}">
<i class="fa-solid fa-eye"></i>
</a>
@endcan
@can('duplicate', $brandAdvantageModel)
<a class="btn btn-sm btn-secondary" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.duplicate', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}">
<i class="fa-solid fa-copy"></i>
</a>
@endcan
@can('update', $brandAdvantageModel)
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.edit', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.update'))->ucfirst() }}">
<i class="fa-solid fa-pencil"></i>
</a>
@endcan
@can('delete', $brandAdvantageModel)
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip" type="submit"
title="{{ str(__('crud.actions.delete'))->ucfirst() }}">
<i class="fa-solid fa-trash"></i>
</button>
@endcan
</form>
@else
<span class="text-danger" data-bs-toggle="tooltip" title="{{ __('list.right') }}">
<i class="fa-solid fa-ban"></i>
</span>
@endcan
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="border-0">
{{ trans_choice('crud.other.no_model_found', 1, ['model' => trans_choice('models.classes.brand_advantage', '1')]) }}
</td>
</tr>
@endif
</table>

View file

@ -0,0 +1,21 @@
@extends('bo.layout')
@section('title', str(trans_choice('models.classes.brand_advantage', '1'))->ucfirst())
@section('description', __('Liste de tous les :model', ['model' => trans_choice('models.classes.brand_advantage', '*')]))
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
@include('modules.breadcrumbs.breadcrumb-body')
@can('create', \App\Models\BrandAdvantage::class)
<a class="btn btn-primary float-right" data-bs-toggle="tooltip" href="{{ route('bo.brand_advantages.create') }}"
title="{{ __('crud.helpers.create_model', ['model' => trans_choice('models.classes.brand_advantage', '1')]) }}">
<i class="fa-solid fa-plus"></i>
</a>
@endcan
</div>
@include('bo.modules.search-bar')
<div class="table-responsive mb-3">
@include('bo.pages.brand_advantages.index-list')
</div>
{{ $brandAdvantageModels->links() }}
@endsection

View file

@ -0,0 +1,132 @@
@extends('bo.layout', ['brParam' => $brandAdvantageModel])
@section('title', __('Édition d\'un :model', ['model' => trans_choice('models.classes.brand_advantage', '1')]))
@section('description', __('Édition d\'un :model déjà existant', ['model' => trans_choice('models.classes.brand_advantage', '1')]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
<div class="d-flex align-items-start flex-row">
<a class="btn btn-primary text-decoration-none m-0" data-bs-toggle="tooltip" href="{{ route('bo.brand_advantages.index') }}"
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.brand_advantage', '*')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $brandAdvantageModel])
</div>
<div class="btn-group mb-md-0 mb-2">
@canAny(['view', 'duplicate', 'update', 'delete'], $brandAdvantageModel)
<form class="btn-group confirmDeleteTS" action="{{ route('bo.brand_advantages.destroy', $brandAdvantageModel) }}" method="POST"
novalidate>
@can('duplicate', $brandAdvantageModel)
<a class="btn btn-secondary" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.duplicate', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}">
<i class="fa-solid fa-copy"></i>
</a>
@endcan
@can('update', $brandAdvantageModel)
<a class="btn btn-primary" data-bs-toggle="tooltip"
href="{{ route('bo.brand_advantages.edit', ['brand_advantage' => $brandAdvantageModel]) }}"
title="{{ str(__('crud.actions.update'))->ucfirst() }}">
<i class="fa-solid fa-pencil"></i>
</a>
@endcan
@can('delete', $brandAdvantageModel)
@csrf
@method('DELETE')
<button class="btn btn-danger" data-bs-toggle="tooltip" type="submit" title="{{ str(__('crud.actions.delete'))->ucfirst() }}">
<i class="fa-solid fa-trash"></i>
</button>
@endcan
</form>
@endcan
</div>
</div>
<div class="row">
<div class="col-12">
<div class="table-responsive mb-3">
<table class="table-hover m-0 table">
<tbody>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.attributes.title'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->title }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.sustitle'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->sustitle }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.attributes.text'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->text }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.picto'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
<img src="/{{ $brandAdvantageModel->picto }}" title="{{ $brandAdvantageModel->picto_title }}"
alt="{{ $brandAdvantageModel->picto_alt }}">
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.alt_attribute'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->picto_alt }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.title_attribute'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->picto_title }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.is_large'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->is_large ? __('Oui') : __('Non') }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">
{{ str(__('validation.custom.published'))->ucfirst() }}
</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->published ? __('Oui') : __('Non') }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.created_at'))->ucfirst() }}</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->created_at->isoFormat('LLLL') }}
</td>
</tr>
<tr class="border-bottom">
<td class="w-50 fw-bold text-center align-middle">{{ str(__('validation.attributes.updated_at'))->ucfirst() }}</td>
<td class="w-50 text-center align-middle">
{{ $brandAdvantageModel->updated_at->isoFormat('LLLL') }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endsection

View file

@ -53,4 +53,62 @@
</div>
</div>
</section>
{{-- REASONS TO JOIN US --}}
<section class="joinus mb-3">
<div class="line-border-large bg-tertiary py-5">
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="f-intro-head-h-base text-center">{{ __("Pourquoi nous rejoindre\u{00A0}?") }}</h1>
<p>{{ __('Lorem, ipsum dolor sit amet consectetur adipisicing elit. Excepturi commodi ipsa quas laudantium consequatur explicabo quasi voluptatum vitae dolorem dolores necessitatibus numquam, praesentium quod doloribus! Atque quisquam ullam modi exercitationem.') }}
</p>
</div>
</div>
<div class="row justify-content-center">
@foreach ($brandAdvantageModels as $brandAdvantageModel)
<div @class([
'col-12 my-3 bottom-left-shadow',
'col-md-6 col-lg-4' => !$brandAdvantageModel->is_large,
'col-lg-6' => $brandAdvantageModel->is_large,
])>
<div class="line-border-small h-100 hstack bg-white p-3">
<div class="row hstack py-2">
<div @class(['col-3', 'col-lg-4' => !$brandAdvantageModel->is_large])>
<img class="img-fluid" src="{{ asset($brandAdvantageModel->picto) }}"
title="{{ $brandAdvantageModel->picto_title }}" alt="{{ $brandAdvantageModel->picto_alt }}">
</div>
<div @class(['col-9', 'col-lg-8' => !$brandAdvantageModel->is_large])>
<p class="f-bourton-base fs-5 m-0">{{ $brandAdvantageModel->sustitle }}</p>
<p class="f-bourton-base fs-3 m-0">{{ $brandAdvantageModel->title }}</p>
<p class="m-0">{{ $brandAdvantageModel->text }}</p>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
{{-- <div class="row w-100 justify-content-center mx-auto overflow-hidden">
<div class="col-12">
<h1 class="f-intro-head-h-base text-center">{{ __('Pourquoi nous rejoindre ?') }}</h1>
</div>
<div class="col-12 col-xxl-10 position-relative mb-5 p-0">
@foreach ($brandAdvantageModels as $brandAdvantageModel)
<div class="swiper-slide">
@include('fo.partials.job-card', [
'title' => $professionModel->title,
'jobs_list' => $professionModel->jobs_list,
'picture' => [
'src' => asset($professionModel->picture),
'alt' => $professionModel->picture_alt,
'title' => $professionModel->picture_title,
],
'job_url' => $professionModel->job_url,
])
</div>
@endforeach
</div>
</div> --}}
</section>
@endsection

View file

@ -1,5 +1,5 @@
@if (count($breadcrumbs))
<ol class="breadcrumb justify-content-center w-100 m-0">
<ol class="breadcrumb w-100 m-0">
@foreach ($breadcrumbs as $breadcrumb)
@if ($breadcrumb->url && !$loop->last)
<li class="breadcrumb-item d-flex">

View file

@ -2,6 +2,7 @@
use App\Models\ActivityLog;
use App\Models\Profession;
use App\Models\BrandAdvantage;
use App\Models\StaticPage;
use App\Models\User;
use Diglactic\Breadcrumbs\Breadcrumbs;
@ -83,3 +84,28 @@ Breadcrumbs::for('bo.static_pages.edit', function (Generator $trail, StaticPage
$trail->parent('bo.static_pages.index');
$trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.static_pages.edit', $static_page));
});
// * BRAND_ADVANTAGE
Breadcrumbs::for('bo.brand_advantages.index', function (Generator $trail) {
$trail->push(
str(trans_choice('models.classes.brand_advantage', '*'))->ucfirst(),
route('bo.brand_advantages.index', ['sort_col' => 'updated_at', 'sort_way' => 'desc'])
);
});
Breadcrumbs::for('bo.brand_advantages.show', function (Generator $trail, BrandAdvantage $brand_advantage) {
$trail->parent('bo.brand_advantages.index');
$trail->push(Str::ucfirst(trans('crud.actions.view')), route('bo.brand_advantages.show', $brand_advantage));
});
Breadcrumbs::for('bo.brand_advantages.create', function (Generator $trail) {
$trail->parent('bo.brand_advantages.index');
$trail->push(str(trans('crud.actions.create'))->ucfirst(), route('bo.brand_advantages.create'));
});
Breadcrumbs::for('bo.brand_advantages.edit', function (Generator $trail, BrandAdvantage $brand_advantage) {
$trail->parent('bo.brand_advantages.index');
$trail->push(str(trans('crud.actions.edit'))->ucfirst(), route('bo.brand_advantages.edit', $brand_advantage));
});
Breadcrumbs::for('bo.brand_advantages.duplicate', function (Generator $trail, BrandAdvantage $brand_advantage) {
$trail->parent('bo.brand_advantages.index');
$trail->push(str(trans('crud.actions.duplicate'))->ucfirst());
});

View file

@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\Bo\ActivityLogController;
use App\Http\Controllers\Bo\BrandAdvantageController;
use App\Http\Controllers\Bo\DashboardController;
use App\Http\Controllers\Bo\ProfessionController;
use App\Http\Controllers\Bo\StaticPageController;
@ -60,6 +61,18 @@ Route::prefix('bo')
// * ACTIVITY LOGS.
Route::resource('activity_logs', ActivityLogController::class)->only(['index', 'show']);
});
// * BRAND_ADVANTAGES.
Route::resource('brand_advantages', BrandAdvantageController::class);
Route::patch('/brand_advantages/{brand_advantage}/change-order/{direction}', [
BrandAdvantageController::class, 'changeOrder'
])->where('direction', 'up|down')->name('brand_advantages.change-order');
Route::patch('/brand_advantages/{brand_advantage}/change-published', [
BrandAdvantageController::class, 'changePublished'
])->name('brand_advantages.change-published');
Route::get('/brand_advantages/{brand_advantage}/duplicate', [
BrandAdvantageController::class, 'duplicate'
])->name('brand_advantages.duplicate');
});
// * Others routes
Route::post('theme/set', [Controller::class, 'setTheme'])->name('theme.set');