fix: 🚨 resolve some phpcs/phpstan errors
This commit is contained in:
parent
c47a5ad1fa
commit
e5df645adc
8 changed files with 17 additions and 21 deletions
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers\Club;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Club\Favorite\UpdateFavoriteRequest;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Product;
|
||||
use App\Lib\Helpers\CollectionHelper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ class FavoriteController extends Controller
|
|||
*/
|
||||
public function update(UpdateFavoriteRequest $request): \Illuminate\Http\JsonResponse
|
||||
{
|
||||
$customer = Customer::query()->where('id', $request->validated()['customer'])->first();
|
||||
$customer = Customer::query()->where('id', $request->validated()['customer'])->first();
|
||||
$currentFavorites = $customer->{$request->validated()['class']}->pluck('id');
|
||||
/** @var integer $newFavorites */
|
||||
$newFavorites = $request->validated()['model'];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use Illuminate\Support\Lottery;
|
|||
class MessageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show messagerie
|
||||
* Show messagerie.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
|
|
@ -32,7 +32,7 @@ class MessageController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch conversations and block list
|
||||
* Fetch conversations and block list.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
|
@ -56,6 +56,7 @@ class MessageController extends Controller
|
|||
// * Limit messages per conversations
|
||||
Lottery::odds(1, 20)
|
||||
->winner(fn() => collect($conversation['messages'])
|
||||
// @phpstan-ignore-next-line
|
||||
->sort($sortFn)
|
||||
->splice($messagesToKeepInConversations)
|
||||
->each(fn(Message $message) => $message->delete()))
|
||||
|
|
@ -71,7 +72,7 @@ class MessageController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Send a message to a user
|
||||
* Send a message to a club customer.
|
||||
*
|
||||
* @param \App\Http\Requests\Club\Messages\SendMessageRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
|
|
@ -97,7 +98,7 @@ class MessageController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Destroy a message
|
||||
* Destroy a club customer's message.
|
||||
*
|
||||
* @param \App\Http\Requests\Club\Messages\DeleteMessagesRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
|
|
@ -134,7 +135,7 @@ class MessageController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Block a customer to prevent him sending messages
|
||||
* Block a customer to prevent him sending messages.
|
||||
*
|
||||
* @param \App\Http\Requests\Club\Messages\BlockCustomerRequest $request
|
||||
* @param boolean $status
|
||||
|
|
@ -155,7 +156,7 @@ class MessageController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Mark notificaiton as read
|
||||
* Mark notificaiton as read.
|
||||
*
|
||||
* @param \App\Http\Requests\Club\Messages\MarkAsReadRequest $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
|
|
|
|||
|
|
@ -88,9 +88,6 @@ class StaticPageController extends Controller
|
|||
*/
|
||||
public function recruitment(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/**
|
||||
* @var Detection\MobileDetect
|
||||
*/
|
||||
$detect = new MobileDetect();
|
||||
$staticPageModel = StaticPage::query()->where('type', StaticPageType::recruitment)->first();
|
||||
$offerModels = Cache::rememberForever(
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class UpdateFavoriteRequest extends FormRequest
|
|||
'model' => 'required|integer|exists:' . $this->class . ',id',
|
||||
'class' => [
|
||||
'required',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
function ($attribute, $value, $fail) {
|
||||
if (!Schema::hasTable($value)) {
|
||||
$fail("La table '$value' n'existe pas dans la base de données.");
|
||||
|
|
|
|||
|
|
@ -373,7 +373,6 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
public static function cacheCrm(string $uuid, string $part_name, \Closure $part, int $ttl = 60 * 60)
|
||||
{
|
||||
// phpcs:enable
|
||||
// @phpstan-ignore-next-line
|
||||
return Cache::remember("customers.{$uuid}.{$part_name}", $ttl, $part);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,9 +180,6 @@ class News extends Model
|
|||
public static function getNewsViewsByNewsCategory(
|
||||
string|null $slug = null
|
||||
): \Illuminate\Contracts\Pagination\LengthAwarePaginator {
|
||||
/**
|
||||
* @var Detection\MobileDetect
|
||||
*/
|
||||
$detect = new MobileDetect();
|
||||
/** @var \App\Models\NewsCategory|null */
|
||||
$newsCategoryModel = !is_null($slug) && !empty($slug)
|
||||
|
|
@ -212,9 +209,6 @@ class News extends Model
|
|||
public static function getSocialViewsByFilter(
|
||||
string|null $slug = null
|
||||
): \Illuminate\Contracts\Pagination\LengthAwarePaginator {
|
||||
/**
|
||||
* @var Detection\MobileDetect
|
||||
*/
|
||||
$detect = new MobileDetect();
|
||||
/** @var \App\Models\NewsCategory|null */
|
||||
$socialCategory = !is_null($slug) && !empty($slug)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class ViewServiceProvider extends ServiceProvider
|
|||
|
||||
// * Inject some data for the bo menu.
|
||||
collect([
|
||||
['name' => 'customerModelsCount', 'value' => Customer::query()->get()->count()],
|
||||
['name' => 'customerModelsCount', 'value' => count(Customer::query()->get())],
|
||||
['name' => 'firstMeat', 'value' => Meat::query()->first()],
|
||||
['name' => 'firstRange', 'value' => Range::query()->first()],
|
||||
['name' => 'mainMenuRangeModels', 'value' => Range::query()->orderBy('slug', 'ASC')
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
@section('title', __('Création d\'un :model', ['model' => $condition ? __('validation.custom.demarche') : __('validation.custom.label')]))
|
||||
@section('description', __('Création d\'un tout nouveau :model', ['model' => $condition ? __('validation.custom.demarche') : __('validation.custom.label')]))
|
||||
@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">
|
||||
|
|
@ -13,7 +14,9 @@
|
|||
title="{{ __('crud.helpers.list_all', ['model' => $condition ? str(__('validation.custom.demarche'))->plural() : str(__('validation.custom.label'))->plural()]) }}">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => intval($approachModel->type ? $approachModel->type->value() : request()->approach_type)])
|
||||
@include('modules.breadcrumbs.breadcrumb-body', [
|
||||
'brParam' => intval($approachModel->type ? $approachModel->type->value() : request()->approach_type),
|
||||
])
|
||||
</div>
|
||||
<div class="mb-md-0 mb-2">
|
||||
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
|
||||
|
|
@ -22,7 +25,9 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('bo.approaches.store', intval($approachModel->type ? $approachModel->type->value() : request()->approach_type)) }}" method="POST" enctype="multipart/form-data">
|
||||
<form
|
||||
action="{{ route('bo.approaches.store', intval($approachModel->type ? $approachModel->type->value() : request()->approach_type)) }}"
|
||||
method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('bo.pages.approaches.form')
|
||||
@include('bo.partials.script-button-clone')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue