Merge branch 'phpstan' into 'master'
phpstan See merge request ldc-web/projets/gen-game-web!25
This commit is contained in:
commit
37544c5632
61 changed files with 530 additions and 205 deletions
|
|
@ -38,7 +38,7 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra
|
|||
{
|
||||
// * Let laravel find a model
|
||||
$model = parent::retrieveByCredentials($credentials) ??
|
||||
static::retrieveTrashed($credentials);
|
||||
self::retrieveTrashed($credentials);
|
||||
|
||||
try {
|
||||
/** @var \LDC\LDCCRM\CrmApiV2 */
|
||||
|
|
@ -77,14 +77,14 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra
|
|||
*
|
||||
* @param UserContract $model
|
||||
* @param array $credentials
|
||||
* @return boolean
|
||||
* @return boolean|null
|
||||
* @throws \RuntimeException If model provided is not a Customer or connection to server fails.
|
||||
* @throws \LDC\LDCCRM\Exceptions\CrmException On CRM call error.
|
||||
* @throws \Exception On CRM call error.
|
||||
*/
|
||||
public function validateCredentials(UserContract $model, array $credentials)
|
||||
public function validateCredentials(UserContract $model, array $credentials): bool|null
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Model $model */
|
||||
/** @var \App\Models\Customer $model */
|
||||
if (\get_class($model) !== $this->usedModel) {
|
||||
throw new \RuntimeException('Cannot authenticate any thing else than ' . $this->usedModel);
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra
|
|||
*/
|
||||
private function createLocalCustomer(\LDC\LDCCRM\Models\Customer $crmCustomer): Model
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Model $model */
|
||||
/** @var \App\Models\Customer $model */
|
||||
$model = $this->usedModel::firstOrNew([
|
||||
'email' => $crmCustomer->email
|
||||
]);
|
||||
|
|
@ -173,7 +173,7 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra
|
|||
}
|
||||
}
|
||||
|
||||
/** @var \App\Models\Customer|null $customer */
|
||||
/** @var \App\Models\Customer|null $query */
|
||||
return $query->withTrashed()->first();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class ReactivateCustomerProvider extends EloquentUserProvider implements UserPro
|
|||
}
|
||||
}
|
||||
|
||||
/** @var \App\Models\Customer|null $customer */
|
||||
/** @var \App\Models\Customer|null $query */
|
||||
return $query->withTrashed()->first();
|
||||
}
|
||||
|
||||
|
|
@ -58,10 +58,9 @@ class ReactivateCustomerProvider extends EloquentUserProvider implements UserPro
|
|||
throw new \ErrorException('Cannot authenticate any thing else than ' . Customer::class);
|
||||
}
|
||||
|
||||
$plain = $credentials['password'];
|
||||
|
||||
/** @var \App\Models\Customer $customer */
|
||||
if ($this->hasher->check($plain, $customer->getAuthPassword())) {
|
||||
// @phpstan-ignore-next-line
|
||||
if ($this->hasher->check($credentials['password'], $customer->getAuthPassword())) {
|
||||
// * Restore customer
|
||||
return boolval($customer->restore());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ class AsDiscount implements CastsAttributes
|
|||
public function get($model, string $key, $value, array $attributes): Discount
|
||||
{
|
||||
// phpcs:enable
|
||||
/** @var string $class */
|
||||
/** @var array<integer|string> $data */
|
||||
$inputData = \json_decode($value, true);
|
||||
return Discount::make(...\array_values($inputData));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Ip implements CastsAttributes
|
|||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param array<string,mixed> $attributes
|
||||
* @return \TGet|null
|
||||
* @return \IPLib\Address\AddressInterface|null
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed
|
||||
*/
|
||||
|
|
@ -31,10 +31,10 @@ class Ip implements CastsAttributes
|
|||
/**
|
||||
* Transform the attribute to its underlying model values.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $key
|
||||
* @param \TSet|null $value
|
||||
* @param array<string,mixed> $attributes
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param string $key
|
||||
* @param \IPLib\Address\AddressInterface|string|null $value
|
||||
* @param array<string,mixed> $attributes
|
||||
* @return mixed
|
||||
* @throws \RuntimeException If value is not or instance of \IPLib\Address\AddressInterface.
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed
|
||||
|
|
|
|||
|
|
@ -21,42 +21,42 @@ class UserCreate extends Command
|
|||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $description = 'Create a backend admin user';
|
||||
|
||||
/**
|
||||
* The first name of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $first_name;
|
||||
|
||||
/**
|
||||
* The last name of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $last_name;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The role of the new user.
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $role;
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ class UserCreate extends Command
|
|||
$this->role = $tmp;
|
||||
} catch (ValidationException $e) {
|
||||
$this->error(sprintf(
|
||||
'Please choose from the selection',
|
||||
'Please choose from the selection %s',
|
||||
\implode(',', collect($e->errors())->flatten()->all())
|
||||
));
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ enum ActivityLogsEventEnum: int
|
|||
|
||||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::created->name => 'Création',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ enum StaticPageType: int
|
|||
|
||||
/**
|
||||
* Optionnal labels definition.
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::legals->name => 'Mentions légales',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ enum BootstrapThemeEnum: int
|
|||
|
||||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::light->name => 'Light',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ enum RoleEnum: int
|
|||
|
||||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::conceptor->name => 'Concepteur',
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ActivityLogController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param App\Models\ActivityLog $activity_log
|
||||
* @param \App\Models\ActivityLog $activity_log
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show(ActivityLog $activity_log): \Illuminate\Contracts\View\View
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class CodeController extends Controller
|
|||
/**
|
||||
* Run generate codes action
|
||||
*
|
||||
* @param \App\Http\Controllers\Bo\Codes\GenerateCodesRequest $request
|
||||
* @param \App\Http\Requests\Bo\Codes\GenerateCodesRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function generate(GenerateCodesRequest $request): \Illuminate\Http\RedirectResponse
|
||||
|
|
@ -92,10 +92,9 @@ class CodeController extends Controller
|
|||
return back()->with(
|
||||
'success',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
'L\'export des codes à commencé, un mail de notification sera envoyé à l\'adresse :email lorsque le traitement sera terminé.',
|
||||
[
|
||||
__('L\'export des codes à commencé, un mail de notification sera envoyé à l\'adresse :emaillorsque le traitement sera terminé.', [
|
||||
'email' => config('mail.admin')
|
||||
]
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class WinTimeElement extends \stdClass
|
|||
}
|
||||
|
||||
/**
|
||||
* @property \Carbon\Carbon $time
|
||||
* @property \Carbon\Carbon|\Carbon\CarbonInterface $time
|
||||
* Un jour dans le temps.
|
||||
* @property \Illuminate\Support\Collection<array-key,\App\Http\Controllers\Bo\WinTimeElement> $lots
|
||||
* Liste des lots tombant ce jour.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class ParticipationController extends Controller
|
|||
{
|
||||
$this->authorize('viewWinnerList', Participation::class);
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $rangeModels */
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $participationModels */
|
||||
$participationModels = Participation::query()->with(['customer', 'code', 'instantWin'])->whereHas('instantWin');
|
||||
|
||||
/** Sort columns with a query */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class UserController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param App\Models\User $user
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(User $user): \Illuminate\Contracts\View\View
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class Controller extends BaseController
|
|||
return $key;
|
||||
}
|
||||
}
|
||||
return $rand;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,7 +132,7 @@ class Controller extends BaseController
|
|||
return $query;
|
||||
}
|
||||
// Get models with relation's name/label.
|
||||
if (Str::endsWith($field, '_id') && $query->getModel()->has(Str::remove('_id', $field))) {
|
||||
if (Str::endsWith($field, '_id')) {
|
||||
$query->orWhereHas(Str::remove('_id', $field), function ($queryRelation) use ($field, $search) {
|
||||
if (Schema::hasColumn(Str::remove('_id', $field) . 's', 'name')) {
|
||||
$queryRelation->where('name', 'like', '%' . $search . '%');
|
||||
|
|
@ -159,12 +160,14 @@ class Controller extends BaseController
|
|||
*/
|
||||
protected function getSearchValue(Builder $query, string $search, string $field): string|array
|
||||
{
|
||||
$cast = $query->getModel()->getCasts()[$field] ?? null;
|
||||
if (
|
||||
count($query->getModel()->getCasts()) and // Check if the model has casts.
|
||||
isset($query->getModel()->getCasts()[$field]) and // Check if there is cast about specific field.
|
||||
enum_exists($query->getModel()->getCasts()[$field]) // Check if the cast is an enum.
|
||||
$cast and // Check if there is cast about specific field.
|
||||
enum_exists($cast) // Check if the cast is an enum.
|
||||
) {
|
||||
$cases = collect($query->getModel()->getCasts()[$field]::toArray());
|
||||
// @phpstan-ignore-next-line
|
||||
$cases = collect($cast::toArray());
|
||||
$enum = $cases->filter(function ($item) use ($search) {
|
||||
return preg_match('/' . Str::lower($search) . '/', Str::lower($item->label));
|
||||
});
|
||||
|
|
@ -199,10 +202,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()->sort_col, $ignore)) {
|
||||
$query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way);
|
||||
}
|
||||
} elseif (Schema::hasColumn($table, 'order')) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Controllers\Fo\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
|
@ -25,9 +24,9 @@ class ConfirmPasswordController extends Controller
|
|||
/**
|
||||
* Display the password confirmation view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
* @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function showConfirmForm(): View
|
||||
public function showConfirmForm(): \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if (Auth::guard('frontend')->check()) {
|
||||
return \response()->redirectToRoute('home');
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class LoginController extends Controller
|
|||
*/
|
||||
protected function authenticated(Request $request, Model $user): void
|
||||
{
|
||||
/** @var \App\Models\Customer $user */
|
||||
$user->last_connection = \now();
|
||||
$user->saveOrFail();
|
||||
Session::flash('info', trans('Vous êtes à présent connecté'));
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
|
|||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Contracts\Auth\StatefulGuard;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
|
@ -49,9 +48,9 @@ class ResetPasswordController extends Controller
|
|||
* If no token is present, display the link request form.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function showResetForm(Request $request): View
|
||||
public function showResetForm(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$token = $request->route()->parameter('token');
|
||||
|
||||
|
|
@ -63,16 +62,13 @@ class ResetPasswordController extends Controller
|
|||
/**
|
||||
* Reset the given user's password.
|
||||
*
|
||||
* @param mixed $customer
|
||||
* @param mixed $password
|
||||
* @param \App\Models\Customer $customer
|
||||
* @param string $password
|
||||
* @return void
|
||||
* @throws \Illuminate\Validation\ValidationException If something goes wrong.
|
||||
*/
|
||||
protected function resetPassword(mixed $customer, mixed $password): void
|
||||
protected function resetPassword(\App\Models\Customer $customer, string $password): void
|
||||
{
|
||||
/** @var \App\Models\Customer $customer */
|
||||
/** @var string $password */
|
||||
|
||||
/** @var \LDC\LDCCRM\CrmApiV2 */
|
||||
$crm = app('crmAPI');
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ class CustomerController extends Controller
|
|||
'error' => trans('Une erreur est survenue, veuillez réssayer plus tard')
|
||||
]);
|
||||
} //end try
|
||||
return back()->withInput()->withErrors(trans('Une erreur est survenue, merci de réessayer ultérieurement.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,8 +101,9 @@ class CustomerController extends Controller
|
|||
$customer = auth('frontend')->user();
|
||||
|
||||
$winningList = $customer->participations()
|
||||
->with(['instantWin', 'discount'])->where(fn (Builder $q) =>
|
||||
$q->whereHas('instantWin')->orWhereHas('discount'))->get();
|
||||
->with(['instantWin', 'discount'])->where(function (Builder $q) {
|
||||
$q->whereHas('instantWin')->orWhereHas('discount');
|
||||
})->get();
|
||||
|
||||
return view('theme::pages.participation.winning-participations', compact('winningList'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use App\Models\FaqQuestion;
|
|||
use App\Models\FaqTheme;
|
||||
use App\Models\Range;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class HomeController extends Controller
|
||||
|
|
@ -18,7 +16,7 @@ class HomeController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function home(): View
|
||||
public function home(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
if (!Gate::check('fo.gameEnabled')) {
|
||||
\session()->flash('warning', trans('Il manque des éléments pour que le jeu soit jouable'));
|
||||
|
|
@ -33,7 +31,7 @@ class HomeController extends Controller
|
|||
* @phpcs:ignore Squiz.Commenting.FunctionComment.EmptyThrows
|
||||
* @throws \Illuminate\Http\Exceptions\HttpResponseException
|
||||
*/
|
||||
public function showProducts(): View
|
||||
public function showProducts(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
// ? Show product list authorized ?
|
||||
if (!Gate::allows('fo.showProducts')) {
|
||||
|
|
@ -49,7 +47,7 @@ class HomeController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function showFaq(): View
|
||||
public function showFaq(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
// ? Show QA authorized ?
|
||||
if (!Gate::allows('fo.showFaq')) {
|
||||
|
|
@ -68,9 +66,9 @@ class HomeController extends Controller
|
|||
/**
|
||||
* Show the teaser page if it is activated
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function teaser(): View | RedirectResponse
|
||||
public function teaser(): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
/** @var \App\Models\Settings */
|
||||
$settings = app(Settings::class);
|
||||
|
|
@ -83,9 +81,9 @@ class HomeController extends Controller
|
|||
/**
|
||||
* Show the end game page if it is activated
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function endGame(): View | RedirectResponse
|
||||
public function endGame(): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
/** @var \App\Models\Settings */
|
||||
$settings = app(Settings::class);
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ class ParticipateController extends Controller
|
|||
$crmUser,
|
||||
$crm_customer_id,
|
||||
$settings->discounts_site,
|
||||
$discount->web_coupon_identifiant
|
||||
strval($discount->web_coupon_identifiant)
|
||||
);
|
||||
|
||||
if (Arr::get($result, 'status') === "OK") {
|
||||
|
|
@ -268,10 +268,10 @@ class ParticipateController extends Controller
|
|||
* Fetch Crm Customer
|
||||
*
|
||||
* @param \App\Models\Customer $customer
|
||||
* @return \LDC\LDCCRM\Models\Customer
|
||||
* @return \LDC\LDCCRM\Models\Customer|\Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Http\Exceptions\HttpResponseException In case of failure or customer not activated.
|
||||
*/
|
||||
private function fetchCrmCustomer(Customer $customer): \LDC\LDCCRM\Models\Customer
|
||||
private function fetchCrmCustomer(Customer $customer): \LDC\LDCCRM\Models\Customer|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
try {
|
||||
$crmUser = $customer->api_data;
|
||||
|
|
@ -305,6 +305,7 @@ class ParticipateController extends Controller
|
|||
// * Retenter ?
|
||||
back()->with('error', trans('Une erreur est survenue, veuillez réssayer.'))->throwResponse();
|
||||
} //end try
|
||||
return back()->withErrors(trans('Une erreur est survenue, merci de réessayer ultérieurement.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustHosts::class,
|
||||
|
|
@ -26,7 +26,7 @@ class Kernel extends HttpKernel
|
|||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
|
|
@ -52,7 +52,7 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ class UpdateBannedIpRequest extends StoreBannedIpRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
/** @var \App\Models\BannedIp */
|
||||
$ipToBanModel = $this->route('banned_ip');
|
||||
return [
|
||||
'ip' => [
|
||||
'required', 'ip',
|
||||
Rule::unique('banned_ips', 'ip')
|
||||
->ignore($this->route('banned_ip')->ip, 'ip')
|
||||
->ignore($ipToBanModel->ip, 'ip')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Requests\Bo\Codes;
|
||||
|
||||
use App\Models\Code;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ class UpdateProductRequest extends StoreProductRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
/** @var \App\Models\Product */
|
||||
$productModel = $this->route('product');
|
||||
return array_merge(parent::rules(), [
|
||||
'ean_code' => [
|
||||
'required',
|
||||
'numeric',
|
||||
Rule::unique('products', 'ean_code')->ignore($this->route('product')->id),
|
||||
Rule::unique('products', 'ean_code')->ignore($productModel->id),
|
||||
'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/',
|
||||
],
|
||||
]);
|
||||
|
|
|
|||
42
app/Http/Requests/Bo/UpdateChangeOrderRequest.php
Normal file
42
app/Http/Requests/Bo/UpdateChangeOrderRequest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateChangeOrderRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'direction' => $this->route('direction') === 'up' ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'direction' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Requests\Bo\Users;
|
||||
|
||||
use App\Enums\Users\RoleEnum;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Validation\Rules\Enum;
|
||||
|
|
|
|||
|
|
@ -25,14 +25,16 @@ class UpdateUserRequest extends StoreUserRequest
|
|||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
/** @var \App\Models\User */
|
||||
$userModel = $this->route('user');
|
||||
$this->merge([
|
||||
'published' => $this->boolean('published'),
|
||||
'password' => $this->input(
|
||||
'password',
|
||||
) ?? $this->route('user')->password,
|
||||
) ?? $userModel->password,
|
||||
'password_confirmation' => $this->input(
|
||||
'password_confirmation'
|
||||
) ?? $this->route('user')->password
|
||||
) ?? $userModel->password
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -43,11 +45,13 @@ class UpdateUserRequest extends StoreUserRequest
|
|||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
/** @var \App\Models\User */
|
||||
$userModel = $this->route('user');
|
||||
return array_merge(parent::rules(), [
|
||||
'email' => [
|
||||
'required',
|
||||
'email:rfc,strict,dns,spoof,filter',
|
||||
Rule::unique('users', 'email')->ignore($this->route('user')->getRouteKey())
|
||||
Rule::unique('users', 'email')->ignore($userModel->getRouteKey())
|
||||
],
|
||||
'password' => [
|
||||
'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8)
|
||||
|
|
|
|||
|
|
@ -100,17 +100,17 @@ class ParticipateRequest extends FormRequest
|
|||
'unique_code' => [
|
||||
'required',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
function (string $attribute, $value, callable $fail) use ($settings) {
|
||||
function (string $attribute, $value, callable $fail) {
|
||||
// ? Le Code unique est resolved ?
|
||||
if ($value === false or !\is_object($value) or \get_class($value) !== Code::class) {
|
||||
$fail(trans('Code unique incorrect, veuillez réessayer.'));
|
||||
return;
|
||||
}
|
||||
/** @var \App\Models\Code $value */
|
||||
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = auth('frontend')->user();
|
||||
|
||||
/** @var \App\Models\Code $value */
|
||||
// * Check si l'utilisateur n'a pas déjà utilisé ce code.
|
||||
$query = Participation::query()
|
||||
->whereHas('code', fn (Builder $q) => $q->where('id', $value->id))
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ use Illuminate\Support\Arr;
|
|||
/**
|
||||
* Ligne de Coupon stocké dans settings
|
||||
*
|
||||
* @property-read integer $web_coupon_identifiant EAN 13 format (Mais ne représente pas un EAN 13),
|
||||
* @property integer $web_coupon_identifiant EAN 13 format (Mais ne représente pas un EAN 13),
|
||||
* Format utilisé dans MesBr.
|
||||
* @property-read integer $percentage Pourcentage de chance de gagner le lot nombre de 1 à 100.
|
||||
* @property-read integer $face_value Valeur faciale en centimes.
|
||||
* @property-read string $valid_on Text valable sur.. (duplicat de ce qui est inscrit dans MesBr)
|
||||
* @property integer $percentage Pourcentage de chance de gagner le lot nombre de 1 à 100.
|
||||
* @property integer $face_value Valeur faciale en centimes.
|
||||
* @property string $valid_on Text valable sur.. (duplicat de ce qui est inscrit dans MesBr)
|
||||
* Pour affichage sur la page de gain est dans le mail.
|
||||
* @property-read string $picture Image locale du Coupon.
|
||||
* @property string $picture Image locale du Coupon.
|
||||
* @package App\Lib\Inputs
|
||||
*/
|
||||
class Discount extends \stdClass implements Jsonable, Arrayable, \JsonSerializable
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ class FileStorageHelper
|
|||
$private ? 'app/private/modelfiles' : 'app/public/modelfiles',
|
||||
$tableName,
|
||||
$filename,
|
||||
$private
|
||||
);
|
||||
$filename = self::getFileUniqueName($folderPath, $filename);
|
||||
return "{$folderPath}/{$filename}";
|
||||
|
|
@ -418,7 +417,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 */
|
||||
|
|
|
|||
|
|
@ -220,11 +220,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(
|
||||
|
|
@ -250,14 +249,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;
|
||||
}
|
||||
|
|
@ -334,9 +333,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()
|
||||
);
|
||||
}
|
||||
|
|
@ -406,55 +408,54 @@ 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
|
||||
*/
|
||||
|
|
@ -477,7 +478,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
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -3,18 +3,17 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\ActivityLogs\ActivityLogsEventEnum;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* @property string $model Target model.
|
||||
* @property string $model_id Id of the target model.
|
||||
* @property string $event Event of this activity (ActivityLogsEventEnum).
|
||||
* @property string $data Changes.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
* @property string $model Target model.
|
||||
* @property string $model_id Id of the target model.
|
||||
* @property \App\Enums\ActivityLogs\ActivityLogsEventEnum $event Event of this activity (ActivityLogsEventEnum).
|
||||
* @property array $data Changes.
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
||||
*
|
||||
* @property-read \App\Models\User $user User BelongsTo relation.
|
||||
*/
|
||||
|
|
@ -82,19 +81,20 @@ class ActivityLog extends Model
|
|||
$activity->model_id = $model->getKey();
|
||||
$activity->event = $eventEnum;
|
||||
$activity->data = static::getChangedColumns($activity, $model, $eventEnum);
|
||||
$activity->created_at = Carbon::now();
|
||||
// @phpstan-ignore-next-line
|
||||
$activity->created_at = now();
|
||||
$activity->saveOrFail();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get old, new columns that has changed.
|
||||
*
|
||||
* @param \self $activity
|
||||
* @param self $activity
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param \App\Enums\ActivityLogs\ActivityLogsEventEnum $eventEnum
|
||||
* @return array|null
|
||||
* @return array
|
||||
*/
|
||||
public static function getChangedColumns(self $activity, Model $model, ActivityLogsEventEnum $eventEnum): array|null
|
||||
public static function getChangedColumns(self $activity, Model $model, ActivityLogsEventEnum $eventEnum): array
|
||||
{
|
||||
$modelClassName = $activity->model_class;
|
||||
/** Get type of each fields of the target model */
|
||||
|
|
@ -109,10 +109,11 @@ class ActivityLog extends Model
|
|||
return Schema::getColumnType($targetModel->getTable(), $fieldIndex);
|
||||
})->toArray();
|
||||
// phpcs:enable
|
||||
/** Return old, new and type of values changed */
|
||||
return ($eventEnum === ActivityLogsEventEnum::updated) ?
|
||||
array_intersect_key($targetModelTypes, $model->getChanges()) : [];
|
||||
}
|
||||
/** Return old, new and type of values changed */
|
||||
return ($eventEnum === ActivityLogsEventEnum::updated) ?
|
||||
array_intersect_key($targetModelTypes, $model->getChanges()) : null;
|
||||
return [];
|
||||
}
|
||||
|
||||
// * RELATIONS
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ class BannedIp extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = ['ip'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'ip' => Ip::class
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ use Kwaadpepper\Serial\SerialCaster;
|
|||
* @property-read string|null $code_unique The unique code
|
||||
* @property-read boolean $has_been_used_too_many_times Has this code been used too many times ?
|
||||
*
|
||||
* @method public static function intToSerial($int) Generate a serial from an int.
|
||||
* @method public static function serialToInt($serial) Get an int from a serial.
|
||||
* @method static mixed intToSerial($int) Generate a serial from an int.
|
||||
* @method static mixed serialToInt($serial) Get an int from a serial.
|
||||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations
|
||||
* Associated participations.
|
||||
|
|
@ -36,7 +36,7 @@ class Code extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code_exported',
|
||||
|
|
@ -46,7 +46,7 @@ class Code extends Model
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string,string>
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'code_exported' => 'bool',
|
||||
|
|
@ -91,13 +91,13 @@ class Code extends Model
|
|||
/**
|
||||
* Generate code_unique attribute
|
||||
*
|
||||
* @return string|null
|
||||
* @return \Illuminate\Database\Eloquent\Casts\Attribute
|
||||
*/
|
||||
public function codeUnique(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function (): ?string {
|
||||
if (!$this->id or !\is_integer($this->id) or $this->id < 1) {
|
||||
if (!$this->id or $this->id < 1) {
|
||||
return null;
|
||||
}
|
||||
return self::intToSerial($this->id);
|
||||
|
|
@ -120,7 +120,7 @@ class Code extends Model
|
|||
*
|
||||
* @param integer $int
|
||||
* @return string The serial
|
||||
* @throws SerialCasterException If an error happens du to config.
|
||||
* @throws \Kwaadpepper\Serial\Exceptions\SerialCasterException If an error happens du to config.
|
||||
*/
|
||||
public static function intToSerial(int $int): string
|
||||
{
|
||||
|
|
@ -137,7 +137,8 @@ class Code extends Model
|
|||
*
|
||||
* @param string $serial
|
||||
* @return integer The ID represented
|
||||
* @throws SerialCasterException If an error happens due to config or wrong serial is given.
|
||||
* @throws \Kwaadpepper\Serial\Exceptions\SerialCasterException If an error happens due to config or
|
||||
* wrong serial is given.
|
||||
*/
|
||||
public static function serialToInt(string $serial): int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use LDC\LDCCRM\Models\Customer as CrmCustomer;
|
|||
* @property string $email Email.
|
||||
* @property string $hashcode Hashcode.
|
||||
* @property string $remember_token Remember token.
|
||||
* @property \LDC\LDCCRM\Models\Customer api_data
|
||||
* @property \LDC\LDCCRM\Models\Customer $api_data
|
||||
* @property \Carbon\Carbon|null $email_verified_at
|
||||
* @property \Carbon\Carbon|null $last_connection Date de derniere connexion, (pour les questions oblig CRM).
|
||||
* @property-read \Carbon\Carbon $created_at Created date.
|
||||
|
|
@ -69,10 +69,10 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
{
|
||||
// * EVENT CLOSURES.
|
||||
static::creating(function (self $model) {
|
||||
static::assertEmailIsUnique($model->id, $model->email);
|
||||
self::assertEmailIsUnique($model->id, $model->email);
|
||||
});
|
||||
static::updating(function (self $model) {
|
||||
static::assertEmailIsUnique($model->id, $model->email);
|
||||
self::assertEmailIsUnique($model->id, $model->email);
|
||||
});
|
||||
static::deleting(function () {
|
||||
throw new \RuntimeException('This cannot be done à cause de MesBr');
|
||||
|
|
@ -115,9 +115,9 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
*
|
||||
* ! Les comptes non activés depuis une semaine ou les comptes supprimés depuis une semaine.
|
||||
*
|
||||
* @return \Illuminate\Database\Query\Builder
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function prunable(): Builder
|
||||
public function prunable(): \Illuminate\Database\Eloquent\Builder
|
||||
{
|
||||
return static::query()->where(function (Builder $q) {
|
||||
$q->where('updated_at', '<=', now()->subWeek())
|
||||
|
|
@ -189,7 +189,7 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
return $this->api_data->activate() && parent::markEmailAsVerified();
|
||||
} catch (ApiErrorException $e) {
|
||||
if ($e->getApiError()->equals(ApiError::customerAlreadyActive())) {
|
||||
return true && parent::markEmailAsVerified();
|
||||
return parent::markEmailAsVerified();
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
}
|
||||
/** @var static|null $loggedCustomer */
|
||||
$loggedCustomer = \auth('frontend')->user();
|
||||
$isLogged = \optional($loggedCustomer)->id === $this->id and !\is_null($this->id);
|
||||
$isLogged = \optional($loggedCustomer)->id === $this->id and !empty($this->id);
|
||||
if ($isLogged) {
|
||||
\auth('frontend')->logout();
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
public function updateApiData(array $data): bool
|
||||
{
|
||||
// phpcs:enable
|
||||
/** @var \LDC\LDCCRM\Models\Customer */
|
||||
/** @var \LDC\LDCCRM\Models\Customer|null $crmCustomer */
|
||||
$crmCustomer = $this->api_data;
|
||||
if (!$crmCustomer) {
|
||||
throw new CrmException('CRM get Customer returned null');
|
||||
|
|
@ -308,10 +308,10 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
* Put customer crm part in cache
|
||||
*
|
||||
* @template T
|
||||
* @param string $uuid The customer uuid.
|
||||
* @param string $part_name The part name for the cache path.
|
||||
* @param \Closure(void):T $part The part to cache.
|
||||
* @param integer $ttl Time to live in seconds for the cache part.
|
||||
* @param string $uuid The customer uuid.
|
||||
* @param string $part_name The part name for the cache path.
|
||||
* @param \Closure():T $part The part to cache.
|
||||
* @param integer $ttl Time to live in seconds for the cache part.
|
||||
* @return T
|
||||
* @phpcs:disable Squiz.Commenting.FunctionComment.IncorrectTypeHint
|
||||
*/
|
||||
|
|
@ -351,7 +351,7 @@ class Customer extends Authenticatable implements MustVerifyEmail
|
|||
if ($this->hashcode) {
|
||||
return collect(array_merge(
|
||||
parent::toArray(),
|
||||
(array)$this->apiData
|
||||
(array)$this->api_data
|
||||
))->intersectByKeys([
|
||||
'email' => '',
|
||||
'firstname' => '',
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class FaqQuestion extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'question',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class FaqTheme extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
/**
|
||||
* InstantWin.
|
||||
*
|
||||
* @property \Illuminate\Support\Carbon $available_at When the instant win will be available.
|
||||
* @property \Carbon\Carbon $available_at When the instant win will be available.
|
||||
*
|
||||
* @property-read \App\Models\Prize $prize Associated prize.
|
||||
* @property-read \App\Models\Participation $participation Associated participation.
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Participation extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'barcode', 'ticket', 'sticker',
|
||||
|
|
@ -46,7 +46,7 @@ class Participation extends Model
|
|||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'ip' => Ip::class,
|
||||
|
|
@ -211,10 +211,10 @@ class Participation extends Model
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @param self $model
|
||||
* @return void
|
||||
*/
|
||||
private static function manageFields(Model $model)
|
||||
private static function manageFields(self $model)
|
||||
{
|
||||
if ($model->barcode) {
|
||||
$model->barcode = FileStorageHelper::storeFile($model, $model->barcode, true);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Prize extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'label',
|
||||
|
|
@ -112,7 +112,7 @@ class Prize extends Model
|
|||
/**
|
||||
* HasMany InstantWin relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function instantWins(): HasMany
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Product extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
|
@ -74,10 +74,10 @@ class Product extends Model
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Range extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
|
@ -60,10 +60,10 @@ class Range extends Model
|
|||
/**
|
||||
* Common methods function.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Settings extends Model
|
|||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
|
@ -80,7 +80,7 @@ class Settings extends Model
|
|||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'notify_prize_sent' => 'bool',
|
||||
|
|
|
|||
|
|
@ -56,14 +56,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);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class User extends Authenticatable
|
|||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function (self $model) {
|
||||
static::updatePassword($model);
|
||||
self::updatePassword($model);
|
||||
// * Prevent user elevation privileges
|
||||
throw_if(
|
||||
auth('backend')->user() and auth('backend')->user()->role->value() > $model->role->value(),
|
||||
|
|
@ -83,7 +83,7 @@ class User extends Authenticatable
|
|||
);
|
||||
});
|
||||
static::updating(function (self $model) {
|
||||
static::updatePassword($model);
|
||||
self::updatePassword($model);
|
||||
if (optional(auth('backend')->user())->getKey() === $model->getKey()) {
|
||||
\validator(
|
||||
['published' => $model->published],
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ResetPassword extends NotificationsResetPassword
|
|||
/**
|
||||
* The callback that should be used to create the reset password URL.
|
||||
*
|
||||
* @var \Closure|null
|
||||
* @var (\Closure(mixed, string): string)|null
|
||||
*/
|
||||
public static $createUrlCallback;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ class ParticipationPolicy
|
|||
fn (Builder $q) => $q->where('ip', app('clientIp'))
|
||||
)->count() < $settings->nb_participation_ip);
|
||||
}
|
||||
$playerCanParticipate = ($playerCanParticipateAccount && $playerCanParticipateIp) ? true : false;
|
||||
$playerCanParticipate = (!empty($playerCanParticipateAccount) && !empty($playerCanParticipateIp)) ?
|
||||
true :
|
||||
false;
|
||||
|
||||
// * Deny banned IP, Check did not participate too much
|
||||
return !(bool)BannedIp::getCached()
|
||||
|
|
@ -72,8 +74,9 @@ class ParticipationPolicy
|
|||
// * Recettage
|
||||
return true;
|
||||
}
|
||||
return (bool)$authUser->participations()->where(fn (Builder $q) =>
|
||||
$q->whereHas('instantWin')->orWhereHas('discount'))->count();
|
||||
return (bool)$authUser->participations()->where(function (Builder $q) {
|
||||
$q->whereHas('instantWin')->orWhereHas('discount');
|
||||
})->count();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,10 +97,12 @@ class ParticipationPolicy
|
|||
fn (Builder $q) =>
|
||||
$q->where('id', $authUser->id)
|
||||
)->where('id', $model->id)->whereHas('instantWin')
|
||||
->where(fn (Builder $q) => $q->whereNull(
|
||||
['sticker', 'ticket', 'barcode'],
|
||||
'or'
|
||||
))->exists();
|
||||
->where(function (Builder $q) {
|
||||
$q->whereNull(
|
||||
['sticker', 'ticket', 'barcode'],
|
||||
'or'
|
||||
);
|
||||
})->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ use App\Models\Product;
|
|||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -43,14 +45,14 @@ class AuthServiceProvider extends ServiceProvider
|
|||
Gate::define(
|
||||
'fo.showProducts',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
fn (User|Customer|null $user) => view()->exists('theme::pages.products') and
|
||||
fn (User|Customer|null $user) => View::exists('theme::pages.products') and
|
||||
(bool)Product::getCached()->count()
|
||||
);
|
||||
|
||||
Gate::define(
|
||||
'fo.showFaq',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
fn (User|Customer|null $user) => view()->exists('theme::pages.faq') and
|
||||
fn (User|Customer|null $user) => View::exists('theme::pages.faq') and
|
||||
(bool)FaqQuestion::getCached()->count()
|
||||
);
|
||||
|
||||
|
|
@ -64,7 +66,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
}
|
||||
);
|
||||
|
||||
$this->app->auth->provider('crm', function ($app, array $config) {
|
||||
Auth::provider('crm', function ($app, array $config) {
|
||||
return new CrmUserProvider($app['hash'], $config['model']);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class IsAdult implements ValidationRule
|
|||
$d = Carbon::createFromFormat('d/m/Y', $value);
|
||||
}
|
||||
// * Could not parse date.
|
||||
if (!$d) {
|
||||
if (!isset($d)) {
|
||||
throw new \RuntimeException("Could not parse date {$value} for attribute '{$attribute}'.");
|
||||
}
|
||||
if (!$d->lessThanOrEqualTo($MJ)) {
|
||||
|
|
|
|||
|
|
@ -37,18 +37,16 @@ trait ChangesModelOrder
|
|||
|
||||
return DB::transaction(function () use ($request, $className, $model) {
|
||||
/** @var \Illuminate\Database\Eloquent\Model|null */
|
||||
$tmp = $className::where('order', $request->direction ? '<' : '>', $model->order)
|
||||
$tmp = $className::where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
|
||||
->orderBy('order', $request->direction ? 'DESC' : 'ASC')->first();
|
||||
|
||||
if (!$tmp) {
|
||||
return back()->with('error', trans('crud.messages.order_not_changed'));
|
||||
}
|
||||
|
||||
$newOrder = $tmp->order;
|
||||
$tmp->order = $model->order;
|
||||
$model->order = $newOrder;
|
||||
$tmp->saveOrFail();
|
||||
$model->saveOrFail();
|
||||
$newOrder = $tmp->getOriginal('order');
|
||||
$tmp->update(['order' => $model->getOriginal('order')]);
|
||||
$model->update(['order' => $newOrder]);
|
||||
Session::flash('success', trans('crud.messages.order_changed'));
|
||||
|
||||
return back();
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ trait UpdateModelPublished
|
|||
*/
|
||||
public function changePublished(Model $model)
|
||||
{
|
||||
$model->published = !$model->published;
|
||||
$model->saveOrFail();
|
||||
$model->update(['published' => !$model->getOriginal('published')]);
|
||||
return redirect()->back()->with('success', trans(__('crud.messages.publish_status_saved')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,9 +118,9 @@ trait BaseEnum
|
|||
/**
|
||||
* Fetch enum using value.
|
||||
*
|
||||
* @param \App\Traits\Enums\BaseEnum|integer|string $value
|
||||
* @param string $field
|
||||
* @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, string $field = 'value'): self|null
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<self>
|
||||
* @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection<(int|string), mixed>
|
||||
*/
|
||||
public static function getCached(): Collection
|
||||
{
|
||||
|
|
@ -52,7 +53,7 @@ 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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "uwil/gen-game-web",
|
||||
"version": "2.2.7",
|
||||
"version": "2.2.8",
|
||||
"type": "project",
|
||||
"description": "Game generator",
|
||||
"support": {
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
"fakerphp/faker": "^1.9.1",
|
||||
"kitloong/laravel-migrations-generator": "^6.8",
|
||||
"krlove/eloquent-model-generator": "dev-l10-compatibility",
|
||||
"larastan/larastan": "^2.8",
|
||||
"laravel-lang/common": "^4.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
|
|
@ -103,4 +104,4 @@
|
|||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
253
composer.lock
generated
253
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": "fb04367922e600ae7eeebd46aa7521bc",
|
||||
"content-hash": "a19494fb3b2f363a386a09f439ba9d5b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "axlon/laravel-postal-code-validation",
|
||||
|
|
@ -9595,6 +9595,107 @@
|
|||
},
|
||||
"time": "2023-01-30T20:15:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "larastan/larastan",
|
||||
"version": "v2.8.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/larastan/larastan.git",
|
||||
"reference": "b7cc6a29c457a7d4f3de90466392ae9ad3e17022"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/larastan/larastan/zipball/b7cc6a29c457a7d4f3de90466392ae9ad3e17022",
|
||||
"reference": "b7cc6a29c457a7d4f3de90466392ae9ad3e17022",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"illuminate/console": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/container": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/contracts": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/database": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/http": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/pipeline": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"illuminate/support": "^9.52.16 || ^10.28.0 || ^11.0",
|
||||
"php": "^8.0.2",
|
||||
"phpmyadmin/sql-parser": "^5.8.2",
|
||||
"phpstan/phpstan": "^1.10.50"
|
||||
},
|
||||
"require-dev": {
|
||||
"nikic/php-parser": "^4.17.1",
|
||||
"orchestra/canvas": "^7.11.1 || ^8.11.0 || ^9.0.0",
|
||||
"orchestra/testbench": "^7.33.0 || ^8.13.0 || ^9.0.0",
|
||||
"phpunit/phpunit": "^9.6.13 || ^10.5"
|
||||
},
|
||||
"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": {
|
||||
"Larastan\\Larastan\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Can Vural",
|
||||
"email": "can9119@gmail.com"
|
||||
},
|
||||
{
|
||||
"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.8.1"
|
||||
},
|
||||
"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": "2024-01-08T09:11:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel-lang/attributes",
|
||||
"version": "2.5.1",
|
||||
|
|
@ -10666,6 +10767,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.24.3",
|
||||
|
|
@ -10713,6 +10902,68 @@
|
|||
},
|
||||
"time": "2023-11-18T20:15:32+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.8",
|
||||
|
|
|
|||
13
phpstan.neon
Normal file
13
phpstan.neon
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
includes:
|
||||
- vendor/larastan/larastan/extension.neon
|
||||
|
||||
parameters:
|
||||
|
||||
paths:
|
||||
- app/
|
||||
|
||||
excludePaths:
|
||||
- app/Lib/vendor/
|
||||
|
||||
# Level 9 is the highest level
|
||||
level: 5
|
||||
Loading…
Add table
Reference in a new issue