Merge branch 'claim_file' into 'develop'
fix: 🐛 use store base64 file method of laravel common to save claim file
See merge request ldc-web/projets/crm!39
This commit is contained in:
commit
b31f87bf8b
106 changed files with 527 additions and 790 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\ActivityLogs;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ActivityLogsEventEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ApiError: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ApiStatus: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ArcadiaMailType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ArcadiaOrderType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Claims;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ClaimMessageType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Claims;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ClaimResponseType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Claims;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ClaimStatus: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Claims;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ClaimType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum Country: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum CustomerExportType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Pagination;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum ItemsPerPaginationEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum QuestionType: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Theme;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum BootstrapThemeEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Enums\Users;
|
||||
|
||||
use App\Traits\Enums\BaseEnum;
|
||||
use Uwil\LaravelCommon\Traits\Enums\BaseEnum;
|
||||
|
||||
enum RoleEnum: int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class Handler extends ExceptionHandler
|
|||
// @codeCoverageIgnoreStart
|
||||
if (config('app.env') === 'testing') {
|
||||
// phpcs:ignore Squiz.PHP.DiscouragedFunctions.Found
|
||||
print_r((string)$e);
|
||||
print_r((string) $e);
|
||||
}
|
||||
return $this->getReponse($request, 500, \intval($e->getCode()), $e->getMessage());
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
|
@ -181,12 +181,12 @@ class Handler extends ExceptionHandler
|
|||
if (Helper::isRequestForApiV2($request)) {
|
||||
return (new V2ApiResponse(
|
||||
ApiStatus::KO,
|
||||
(object)array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
(object) array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
))->toResponse($request)->setStatusCode($httpCode);
|
||||
}
|
||||
return (new V4ApiResponse(
|
||||
ApiStatus::KO,
|
||||
(object)array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
(object) array_merge($data, ['message' => $message, 'code' => $apiCode]),
|
||||
))->toResponse($request)->setStatusCode($httpCode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function store(StoreCustomerRequest $request, Service $service): JsonResource
|
||||
{
|
||||
$data = (object)$request->validated();
|
||||
$data = (object) $request->validated();
|
||||
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = Customer::query()->where('email', $data->email)->firstOrCreate([
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use App\Http\Requests\Api\V4\SendClaimRequest;
|
|||
use App\Models\Claim;
|
||||
use App\Models\Service;
|
||||
use Illuminate\Support\Arr;
|
||||
use Uwil\LaravelCommon\Helpers\FileHelper;
|
||||
|
||||
class ClaimController extends Controller
|
||||
{
|
||||
|
|
@ -22,8 +23,8 @@ class ClaimController extends Controller
|
|||
public function store(SendClaimRequest $request, Service $service): \Illuminate\Http\JsonResponse
|
||||
{
|
||||
$claimModel = (new Claim())->fill(Arr::except($request->validated(), 'file'));
|
||||
if ($request->hasFile('file')) {
|
||||
$claimModel->file = $request->file('file')->store('claims/files');
|
||||
if ($request->filled('file')) {
|
||||
$claimModel->file = FileHelper::storeBase64File('claim', $request->file);
|
||||
}
|
||||
|
||||
if (!$claimModel->saveOrFail()) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function store(StoreCustomerRequest $request, Service $service): JsonResource
|
||||
{
|
||||
$data = (object)$request->validated();
|
||||
$data = (object) $request->validated();
|
||||
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = Customer::query()->where('email', $data->email)->firstOrCreate([
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ActivityLogsController extends Controller
|
|||
$this->sortQuery($query);
|
||||
|
||||
/** Custom pagination */
|
||||
$activitylogModels = $this->paginate($query);
|
||||
$activitylogModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.activity_logs.index', compact('activitylogModels', 'search', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,22 +32,22 @@ class AnswerController extends Controller
|
|||
/** @var \App\Models\Question $questionModel */
|
||||
$questionModel = $request->question;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $answers */
|
||||
$answers = Answer::query()->where('question_id', $questionModel->id);
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = Answer::query()->where('question_id', $questionModel->id);
|
||||
|
||||
if ($request->search) {
|
||||
$this->searchQuery(
|
||||
$answers,
|
||||
$query,
|
||||
$request->search,
|
||||
null,
|
||||
'answer',
|
||||
);
|
||||
}
|
||||
|
||||
$this->sortQuery($answers);
|
||||
$this->sortQuery($query);
|
||||
$searchFields = trans('Réponse');
|
||||
|
||||
$answerModels = $this->paginate($answers);
|
||||
$answerModels = $this->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.answers.index', compact('answerModels', 'questionModel', 'searchFields'));
|
||||
}
|
||||
|
|
@ -65,8 +65,8 @@ class AnswerController extends Controller
|
|||
$questionModel = $request->question;
|
||||
|
||||
return view('bo.pages.answers.create', [
|
||||
'answerModel' => $answer,
|
||||
'questionModel' => $questionModel
|
||||
'answerModel' => $answer,
|
||||
'questionModel' => $questionModel,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -81,9 +81,11 @@ class AnswerController extends Controller
|
|||
return DB::transaction(function () use ($request) {
|
||||
$answer = new Answer();
|
||||
$answer->fill($request->validated());
|
||||
$questionModel = $request->route()->parameter('question');
|
||||
$answer->question()->associate($questionModel->getKey());
|
||||
if ($answer->saveOrFail()) {
|
||||
return redirect()
|
||||
->route('bo.answers.edit', $answer)
|
||||
->route('bo.questions.answers.edit', ['question' => $questionModel, 'answer' => $answer])
|
||||
->with('success', trans(
|
||||
':model a été créé.',
|
||||
['model' => Str::singular(trans('models.classes.answers'))]
|
||||
|
|
@ -108,8 +110,8 @@ class AnswerController extends Controller
|
|||
public function edit(Question $question, Answer $answers): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.answers.edit', [
|
||||
'answerModel' => $answers,
|
||||
'questionModel' => $question
|
||||
'answerModel' => $answers,
|
||||
'questionModel' => $question,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class BrandController extends Controller
|
|||
$q->where('opt_in', true);
|
||||
}]);
|
||||
|
||||
$brandModels = $this->paginate($query);
|
||||
$brandModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.brands.index', compact('brandModels', 'searchFields'));
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ class BrandController extends Controller
|
|||
$models = CollectionHelper::paginateManually(
|
||||
Brand::getUserAssociatedBrands(),
|
||||
$this->jsonItemPerPagination,
|
||||
(int)$request->validated('page'),
|
||||
(int) $request->validated('page'),
|
||||
);
|
||||
return \response()->json($models);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ class ClaimController extends Controller
|
|||
/** @var \App\Models\User $userModel */
|
||||
$userModel = auth('backend')->user();
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $claimModels */
|
||||
$claimModels = Claim::query()
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = Claim::query()
|
||||
->when(
|
||||
$request->filled('brand'),
|
||||
fn($q) => $q->whereHas('brand', fn($q) => $q->where('id', $request->brand))
|
||||
|
|
@ -59,7 +59,7 @@ class ClaimController extends Controller
|
|||
$search = $request->search;
|
||||
if ($search) {
|
||||
$this->searchQuery(
|
||||
$claimModels,
|
||||
$query,
|
||||
$search,
|
||||
null,
|
||||
'reference',
|
||||
|
|
@ -76,10 +76,10 @@ class ClaimController extends Controller
|
|||
]);
|
||||
|
||||
/** Sort columns with a query */
|
||||
$this->sortQuery($claimModels);
|
||||
$this->sortQuery($query);
|
||||
|
||||
/** Custom pagination */
|
||||
$claimModels = $this->paginate($claimModels);
|
||||
$claimModels = $query->simplePaginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.claims.index', compact('claimModels', 'search', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class ClaimMailTemplateController extends Controller
|
|||
$this->sortQuery($query);
|
||||
$searchFields = trans('validation.custom.label');
|
||||
|
||||
$claimMailTemplateModels = $this->paginate($query);
|
||||
$claimMailTemplateModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.claim_mail_templates.index', compact('claimMailTemplateModels', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ClaimSubjectController extends Controller
|
|||
$this->sortQuery($query);
|
||||
$searchFields = trans('validation.custom.label');
|
||||
|
||||
$claimSubjectModels = $this->paginate($query);
|
||||
$claimSubjectModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.claim_subjects.index', compact('claimSubjectModels', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,11 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$modelClass = Customer::class;
|
||||
$modelTable = (new Customer())->getTable();
|
||||
$brands = Brand::select('id', 'name')->get();
|
||||
$columns = ['customer_infos.lastname', 'customer_infos.firstname'];
|
||||
$modelClass = Customer::class;
|
||||
$modelTable = (new Customer())->getTable();
|
||||
$questionModels = null;
|
||||
$answerModels = null;
|
||||
$searchFields = trans('Email, Prénom, Nom');
|
||||
|
||||
// Reset session sorts.
|
||||
if ($request->rstSrts) {
|
||||
|
|
@ -56,27 +57,26 @@ class CustomerController extends Controller
|
|||
$this->resetSessionFilters($modelTable);
|
||||
}
|
||||
|
||||
$query = $this->buildCustomerQuery();
|
||||
if ($request->filled('search') || Session::get("crud.$modelTable.search")) {
|
||||
$columns = ['customer_infos.lastname', 'customer_infos.firstname'];
|
||||
$query = $this->buildCustomerQuery();
|
||||
|
||||
// Apply filters.
|
||||
$questionModels = null;
|
||||
$answerModels = null;
|
||||
$this->applyBrandFilter($request, $query, $modelTable, $questionModels, $answerModels);
|
||||
$this->applySearchFilter($request, $query, $modelTable, $columns);
|
||||
$this->applySort($request, $query, $modelTable);
|
||||
// Apply filters.
|
||||
$this->applyBrandFilter($request, $query, $modelTable, $questionModels, $answerModels);
|
||||
$this->applySearchFilter($request, $query, $modelTable, $columns);
|
||||
$this->applySort($request, $query, $modelTable);
|
||||
|
||||
$customerModels = $this->paginate($query->with(['customer', 'brand']));
|
||||
$searchFields = trans('Email, Prénom, Nom');
|
||||
$customerModels = $query->with(['customer', 'brand'])->simplePaginate($this->getPagination());
|
||||
} //end if
|
||||
|
||||
return view('bo.pages.customers.index', compact(
|
||||
'modelClass',
|
||||
'modelTable',
|
||||
'customerModels',
|
||||
'brands',
|
||||
'searchFields',
|
||||
'questionModels',
|
||||
'answerModels',
|
||||
));
|
||||
return view('bo.pages.customers.index', [
|
||||
'modelClass' => $modelClass,
|
||||
'modelTable' => $modelTable,
|
||||
'customerModels' => $customerModels ?? collect(),
|
||||
'searchFields' => $searchFields,
|
||||
'questionModels' => $questionModels,
|
||||
'answerModels' => $answerModels,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -330,34 +330,35 @@ class CustomerController extends Controller
|
|||
?Collection &$questionModels,
|
||||
?Collection &$answerModels
|
||||
): void {
|
||||
if ($request->filled('brand') || Session::has("crud.$table.brand")) {
|
||||
$brand = $request->brand ?? Session::get("crud.$table.brand");
|
||||
Session::put("crud.$table.brand", $brand);
|
||||
$query->where('customer_infos.brand_id', $brand);
|
||||
$brand = $request->brand ?? Session::get("crud.$table.brand");
|
||||
if (!(int) $brand) {
|
||||
return;
|
||||
}
|
||||
Session::put("crud.$table.brand", $brand);
|
||||
$query->where('customer_infos.brand_id', $brand);
|
||||
|
||||
$questionModels = Question::getAllModelsFromBrand($brand);
|
||||
$questionModels = Question::getAllModelsFromBrand($brand);
|
||||
|
||||
if (($request->filled('question') || Session::has("crud.$table.question")) && $questionModels->count()) {
|
||||
$question = $request->question ?? Session::get("crud.$table.question");
|
||||
Session::put("crud.$table.question", $question);
|
||||
if (($request->filled('question') || Session::has("crud.$table.question")) && $questionModels->count()) {
|
||||
$question = $request->question ?? Session::get("crud.$table.question");
|
||||
Session::put("crud.$table.question", $question);
|
||||
|
||||
$answerModels = Answer::getAllAnswersFromQuestion($question);
|
||||
$questionAnswers = Question::find($question)?->answers->modelKeys() ?? [];
|
||||
$answerModels = Answer::getAllAnswersFromQuestion($question);
|
||||
$questionAnswers = Question::find($question)?->answers->modelKeys() ?? [];
|
||||
|
||||
$query->whereHas('customer.answers', fn($q) => $q->whereIn('answer_id', $questionAnswers));
|
||||
$query->whereHas('customer.answers', fn($q) => $q->whereIn('answer_id', $questionAnswers));
|
||||
|
||||
if (
|
||||
($request->filled('answer') || Session::has("crud.$table.answer"))
|
||||
&& $questionModels->count()
|
||||
&& $answerModels->count()
|
||||
) {
|
||||
$answer = $request->answer ?? Session::get("crud.$table.answer");
|
||||
Session::put("crud.$table.answer", $answer);
|
||||
if (
|
||||
($request->filled('answer') || Session::has("crud.$table.answer"))
|
||||
&& $questionModels->count()
|
||||
&& $answerModels->count()
|
||||
) {
|
||||
$answer = $request->answer ?? Session::get("crud.$table.answer");
|
||||
Session::put("crud.$table.answer", $answer);
|
||||
|
||||
$query->whereHas('customer.answers', fn($q) => $q->whereKey($answer));
|
||||
}
|
||||
$query->whereHas('customer.answers', fn($q) => $q->whereKey($answer));
|
||||
}
|
||||
} //end if
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -371,19 +372,17 @@ class CustomerController extends Controller
|
|||
*/
|
||||
private function applySearchFilter(Request $request, Builder &$query, string $table, array $columns): void
|
||||
{
|
||||
if ($request->filled('search') || Session::has("crud.$table.search")) {
|
||||
$search = $request->search ?? Session::get("crud.$table.search");
|
||||
Session::put("crud.$table.search", $search);
|
||||
$search = $request->search ?? Session::get("crud.$table.search");
|
||||
Session::put("crud.$table.search", $search);
|
||||
|
||||
$query->where(function ($q) use ($columns, $search) {
|
||||
foreach ($columns as $column) {
|
||||
$q->orWhere($column, 'LIKE', "%$search%");
|
||||
}
|
||||
$query->where(function ($q) use ($columns, $search) {
|
||||
foreach ($columns as $column) {
|
||||
$q->orWhere($column, 'LIKE', "%$search%");
|
||||
}
|
||||
|
||||
$q->orWhere('customers.email', 'LIKE', "%$search%")
|
||||
->orWhere('customer_logins.last_connection', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
$q->orWhere('customers.email', 'LIKE', "%$search%")
|
||||
->orWhere('customer_logins.last_connection', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class QuestionController extends Controller
|
|||
$query->with(['brand', 'answers']);
|
||||
|
||||
/** @var \Illuminate\Pagination\AbstractPaginator */
|
||||
$questionModels = $this->paginate($query);
|
||||
$questionModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.questions.index', compact('questionModels', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ServiceController extends Controller
|
|||
|
||||
$query->with(['brand']);
|
||||
|
||||
$serviceModels = $this->paginate($query);
|
||||
$serviceModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.services.index', compact('serviceModels', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,20 +29,23 @@ class SingleOptinController extends Controller
|
|||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$query = SingleOptin::query();
|
||||
$questionModels = null;
|
||||
$answerModels = null;
|
||||
$searchFields = trans('E-mail');
|
||||
|
||||
$this->applyBrandAndAnswerFilters($request, $query, $questionModels, $answerModels);
|
||||
$this->applySearch($request, $query);
|
||||
$this->sortQuery($query);
|
||||
if ($request->filled('search')) {
|
||||
$query = SingleOptin::query();
|
||||
|
||||
$query->with('brand');
|
||||
$singleoptinModels = $this->paginate($query);
|
||||
$searchFields = trans('E-mail');
|
||||
$this->applyBrandAndAnswerFilters($request, $query, $questionModels, $answerModels);
|
||||
$this->applySearch($request, $query);
|
||||
$this->sortQuery($query);
|
||||
|
||||
$query->with('brand');
|
||||
$singleoptinModels = $query->simplePaginate($this->getPagination());
|
||||
}
|
||||
|
||||
return view('bo.pages.singleoptins.index', [
|
||||
'singleoptinModels' => $singleoptinModels,
|
||||
'singleoptinModels' => $singleoptinModels ?? collect(),
|
||||
'searchFields' => $searchFields,
|
||||
'questionModels' => $questionModels,
|
||||
'answerModels' => $answerModels,
|
||||
|
|
@ -88,7 +91,7 @@ class SingleOptinController extends Controller
|
|||
?Collection &$questionModels,
|
||||
?Collection &$answerModels
|
||||
): void {
|
||||
if (!$request->filled('brand')) {
|
||||
if (!$request->filled('brand') || !(int) $request->brand) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class StatsController extends Controller
|
|||
}
|
||||
$w->insertOne($cols);
|
||||
}
|
||||
return response((string)$w, 200, [
|
||||
return response((string) $w, 200, [
|
||||
'Content-Encoding' => 'none',
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
|
|
@ -135,7 +135,7 @@ class StatsController extends Controller
|
|||
$dayAnswers->values()->all()
|
||||
));
|
||||
}
|
||||
return response((string)$w, 200, [
|
||||
return response((string) $w, 200, [
|
||||
'Content-Encoding' => 'none',
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ class UserController extends Controller
|
|||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $userModels */
|
||||
$userModels = User::query();
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $query */
|
||||
$query = User::query();
|
||||
|
||||
/** @var string $search Search field */
|
||||
$search = $request->search;
|
||||
if ($search) {
|
||||
$this->searchQuery(
|
||||
$userModels,
|
||||
$query,
|
||||
$search,
|
||||
null,
|
||||
'first_name',
|
||||
|
|
@ -57,10 +57,10 @@ class UserController extends Controller
|
|||
]);
|
||||
|
||||
/** Sort columns with a query */
|
||||
$this->sortQuery($userModels);
|
||||
$this->sortQuery($query);
|
||||
|
||||
/** Custom pagination */
|
||||
$userModels = $this->paginate($userModels);
|
||||
$userModels = $query->paginate($this->getPagination());
|
||||
|
||||
return view('bo.pages.users.index', compact('userModels', 'search', 'searchFields'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,16 +189,13 @@ class Controller extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* Customize pagination with cache or config (default).
|
||||
* Get the number of items per page.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param \App\Enums\Pagination\ItemsPerPaginationEnum|null $pagination
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
* @return integer
|
||||
*/
|
||||
protected function paginate(
|
||||
Builder $query,
|
||||
ItemsPerPaginationEnum $pagination = null
|
||||
): \Illuminate\Contracts\Pagination\LengthAwarePaginator {
|
||||
protected function getPagination(ItemsPerPaginationEnum $pagination = null): int
|
||||
{
|
||||
$currentRoutePath = Str::slug(request()->route()->getName());
|
||||
$cacheKey = "pagination.{$currentRoutePath}";
|
||||
$pagination = $pagination ?? ItemsPerPaginationEnum::twelve;
|
||||
|
|
@ -210,8 +207,7 @@ class Controller extends BaseController
|
|||
if (Cache::get($cacheKey) !== $pagination) {
|
||||
Cache::put($cacheKey, $pagination);
|
||||
}
|
||||
$query = $query->paginate($pagination);
|
||||
return $query;
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ class ApiResponse
|
|||
$status = intval($response->getStatusCode() / 100) == 2 ? ApiStatus::OK : ApiStatus::KO;
|
||||
|
||||
if (Helper::isRequestForApiV2($request)) {
|
||||
return $response->setData(new V2ApiResponse($status, (object)$data));
|
||||
return $response->setData(new V2ApiResponse($status, (object) $data));
|
||||
}
|
||||
return $response->setData(new V4ApiResponse($status, (object)$data));
|
||||
return $response->setData(new V4ApiResponse($status, (object) $data));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ abstract class UpdateMiniCrudRequest extends FormRequest
|
|||
}) : $input['dimensions'];
|
||||
|
||||
// * Adapt dimensions
|
||||
$sizes = (object)[
|
||||
$sizes = (object) [
|
||||
'minHeight' => $dim['height'],
|
||||
'maxHeight' => $dim['height'],
|
||||
'minWith' => $dim['width'],
|
||||
'maxWith' => $dim['width'],
|
||||
'minWith' => $dim['width'],
|
||||
'maxWith' => $dim['width'],
|
||||
];
|
||||
$rules = array_merge($rules, [
|
||||
"data.$iptName.value" => [
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ApiResponse extends JsonResource
|
|||
//phpcs:enable
|
||||
return [
|
||||
'status' => $this->status->value(),
|
||||
'data' => (array)($this->data ?? []),
|
||||
'data' => (array) ($this->data ?? []),
|
||||
'version' => '3.0.6'
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ApiResponse extends JsonResource
|
|||
//phpcs:enable
|
||||
return [
|
||||
'status' => $this->status->value(),
|
||||
'data' => (array)($this->data ?? []),
|
||||
'data' => (array) ($this->data ?? []),
|
||||
'version' => config('api.version')
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ class ToolboxHelper
|
|||
{
|
||||
// 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;
|
||||
$ret = (array) $input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
|
|
@ -392,7 +392,7 @@ class ToolboxHelper
|
|||
{
|
||||
// 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;
|
||||
$ret = (object) $input;
|
||||
foreach ($ret as &$item) {
|
||||
// Recursively process EACH element only if not scalar.
|
||||
$item = (is_object($item) or is_array($item)) ?
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ class ViewServiceProvider extends ServiceProvider
|
|||
// * FORCE BOOTSTRAP PAGINATOR (or custom if in front)
|
||||
// Early boot, request wont be filled as expected.
|
||||
if (collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo') {
|
||||
Paginator::defaultView('bo.modules.pagination');
|
||||
Paginator::defaultView('bo.modules.pagination.default');
|
||||
Paginator::defaultSimpleView('bo.modules.pagination.simple');
|
||||
} else {
|
||||
Paginator::useBootstrapFive();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,310 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits\Enums;
|
||||
|
||||
use Doctrine\Inflector\InflectorFactory;
|
||||
|
||||
trait BaseEnum
|
||||
{
|
||||
// * GENERIC METHODS
|
||||
/**
|
||||
* Get enum value.
|
||||
*
|
||||
* @return string|integer
|
||||
*/
|
||||
public function value(): string|int
|
||||
{
|
||||
return self::toValues()[$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum label.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function label(): string
|
||||
{
|
||||
return self::toLabels()[$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function name(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
// * STATIC FETCH METHODS
|
||||
|
||||
/**
|
||||
* Get enum labels.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function toLabels(): array
|
||||
{
|
||||
if (empty(self::getCache('labels'))) {
|
||||
$labels = self::getLabelsConstant();
|
||||
$array = [];
|
||||
\array_map(function ($enum) use (&$array, $labels) {
|
||||
if (!\is_null($labels) and !isset($labels[$enum->name])) {
|
||||
throw new \Error('Missing definition label ' . self::class . " for {$enum->name}");
|
||||
}
|
||||
$array = array_merge($array, [$enum->name => __(
|
||||
!\is_null($labels) ? $labels[$enum->name] : ucfirst($enum->name)
|
||||
)]);
|
||||
}, self::cases());
|
||||
self::setCache('labels', $array);
|
||||
}
|
||||
return self::getCache('labels');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enum values.
|
||||
*
|
||||
* @return array<integer|string>
|
||||
*/
|
||||
public static function toValues(): array
|
||||
{
|
||||
if (empty(self::getCache('values'))) {
|
||||
$array = [];
|
||||
\array_map(function ($enum) use (&$array) {
|
||||
$array = array_merge($array, [$enum->name => $enum->value]);
|
||||
}, self::cases());
|
||||
self::setCache('values', $array);
|
||||
}
|
||||
return self::getCache('values');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enums.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function all(): array
|
||||
{
|
||||
return self::cases();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enums.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function toArray(): array
|
||||
{
|
||||
if (empty(self::getCache('enums'))) {
|
||||
$definitions = self::getCustomDefinitions();
|
||||
$array = [];
|
||||
$inflector = InflectorFactory::create()->build();
|
||||
\array_map(function ($enum) use (&$array, $definitions, $inflector) {
|
||||
$baseArray = [
|
||||
'name' => $enum->name,
|
||||
'label' => $enum->label(),
|
||||
'value' => $enum->value,
|
||||
];
|
||||
foreach ($definitions as $index => $elements) {
|
||||
$index = $inflector->singularize(strtolower($index));
|
||||
if (!isset($elements[$enum->name])) {
|
||||
throw new \Error("Missing definition {$index} " . self::class . " for {$enum->name}");
|
||||
}
|
||||
$baseArray[$index] = $elements[$enum->name];
|
||||
}
|
||||
$array = array_merge($array, [$enum->name => (object)$baseArray]);
|
||||
}, self::cases());
|
||||
self::setCache('enums', $array);
|
||||
} //end if
|
||||
return self::getCache('enums');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch enum using value.
|
||||
*
|
||||
* @param \App\Traits\Enums\BaseEnum|integer|string $value
|
||||
* @param string $field
|
||||
* @return \App\Traits\Enums\BaseEnum|null
|
||||
*/
|
||||
public static function make(self|int|string $value, string $field = 'value'): self|null
|
||||
{
|
||||
return !\is_object($value) ? self::cases()[array_search($value, array_column(self::cases(), $field))] : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if 2 enum are equals.
|
||||
*
|
||||
* @param object ...$others
|
||||
* @return boolean
|
||||
* @throws \Error If provided element are not enums taht extends BaseEnum.
|
||||
*/
|
||||
public function equals(object ...$others): bool
|
||||
{
|
||||
foreach ($others as $other) {
|
||||
if (!\in_array(BaseEnum::class, $this->classUsesRecursive($other))) {
|
||||
throw new \Error(__METHOD__ .
|
||||
' requires $enum to use ' . BaseEnum::class);
|
||||
}
|
||||
if (
|
||||
get_class($this) === get_class($other)
|
||||
&& $this->value === $other->value
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to json.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
||||
// * CACHE
|
||||
|
||||
/**
|
||||
* Get cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @return array
|
||||
*/
|
||||
private static function getCache(string $index): array
|
||||
{
|
||||
self::initCache();
|
||||
if (!isset($GLOBALS[self::class]['props'][$index])) {
|
||||
$GLOBALS[self::class]['props'][$index] = [];
|
||||
}
|
||||
return $GLOBALS[self::class]['props'][$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cache array.
|
||||
*
|
||||
* @param string $index
|
||||
* @param array $items
|
||||
* @return void
|
||||
*/
|
||||
private static function setCache(string $index, array $items): void
|
||||
{
|
||||
self::initCache();
|
||||
if (!isset($GLOBALS[self::class]['props'][$index])) {
|
||||
$GLOBALS[self::class]['props'][$index] = [];
|
||||
}
|
||||
$GLOBALS[self::class]['props'][$index] = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init cache if needed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function initCache(): void
|
||||
{
|
||||
if (!isset($GLOBALS[self::class])) {
|
||||
$GLOBALS[self::class] = [
|
||||
'props' => [
|
||||
'enums' => [],
|
||||
'values' => [],
|
||||
'labels' => []
|
||||
],
|
||||
'customProps' => null
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// * PRIVATE
|
||||
|
||||
/**
|
||||
* Fetch the LABELS constant if exists.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private static function getLabelsConstant(): array|null
|
||||
{
|
||||
$class_name = self::class;
|
||||
try {
|
||||
$constant_reflex = new \ReflectionClassConstant($class_name, 'LABELS');
|
||||
return $constant_reflex->getValue();
|
||||
} catch (\ReflectionException $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom constants.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getCustomDefinitions(): array
|
||||
{
|
||||
// ? Has custom props in cache ?
|
||||
if (!isset($GLOBALS[self::class]) or \is_null($GLOBALS[self::class]['customProps'])) {
|
||||
$names = [];
|
||||
\array_map(function (self $enum) use (&$names) {
|
||||
$names = array_merge($names, [$enum->name => $enum]);
|
||||
}, self::cases());
|
||||
|
||||
$GLOBALS[self::class]['customProps'] = \array_filter(
|
||||
(new \ReflectionClass(self::class))->getConstants(),
|
||||
function (mixed $constant, string $key) use ($names) {
|
||||
if ($key === 'LABELS' or !\is_array($constant)) {
|
||||
return false;
|
||||
}
|
||||
return count(\array_filter(
|
||||
array_flip($constant),
|
||||
function (string $name) use ($names) {
|
||||
return array_key_exists($name, $names);
|
||||
}
|
||||
));
|
||||
},
|
||||
ARRAY_FILTER_USE_BOTH
|
||||
);
|
||||
} //end if
|
||||
return $GLOBALS[self::class]['customProps'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all traits used by a class, its parent classes and trait of their traits.
|
||||
*
|
||||
* @param object|string $class
|
||||
* @return array
|
||||
*/
|
||||
private function classUsesRecursive($class)
|
||||
{
|
||||
if (is_object($class)) {
|
||||
$class = get_class($class);
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach (array_reverse(class_parents($class) ?: []) + [$class => $class] as $class) {
|
||||
$results += $this->traitUsesRecursive($class);
|
||||
}
|
||||
|
||||
return array_unique($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all traits used by a trait and its traits.
|
||||
*
|
||||
* @param object|string $trait
|
||||
* @return array
|
||||
*/
|
||||
private function traitUsesRecursive($trait)
|
||||
{
|
||||
$traits = class_uses($trait) ?: [];
|
||||
|
||||
foreach ($traits as $trait) {
|
||||
$traits += $this->traitUsesRecursive($trait);
|
||||
}
|
||||
|
||||
return $traits;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ldc/ldccrm",
|
||||
"version": "4.1.4",
|
||||
"version": "4.1.5",
|
||||
"type": "project",
|
||||
"description": "LDC CRM",
|
||||
"license": "MIT",
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
"sentry/sentry-laravel": "^4.10",
|
||||
"uwil/admin-secure-laravel": "^3.0",
|
||||
"uwil/k8s-laravel": "^1.4",
|
||||
"uwil/laravel-common": "^3.4"
|
||||
"uwil/laravel-common": "^4.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "^7.2",
|
||||
|
|
|
|||
12
composer.lock
generated
12
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": "ee8bdd66e3ddef5e410f2b2a7d852c2b",
|
||||
"content-hash": "0009b353976d02e41558711de87179a6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "24slides/laravel-saml2",
|
||||
|
|
@ -7859,16 +7859,16 @@
|
|||
},
|
||||
{
|
||||
"name": "uwil/laravel-common",
|
||||
"version": "3.4.3",
|
||||
"version": "4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@lab.s-web.fr:ldc-web/projets/laravel-common.git",
|
||||
"reference": "e4d69be567729f0e32379b4ed1ed8cd0dc3746df"
|
||||
"reference": "01af52e206e690d511752e9f6a52c8b2c537ca8a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://lab.s-web.fr/api/v4/projects/215/packages/composer/archives/uwil/laravel-common.zip?sha=e4d69be567729f0e32379b4ed1ed8cd0dc3746df",
|
||||
"reference": "e4d69be567729f0e32379b4ed1ed8cd0dc3746df",
|
||||
"url": "https://lab.s-web.fr/api/v4/projects/215/packages/composer/archives/uwil/laravel-common.zip?sha=01af52e206e690d511752e9f6a52c8b2c537ca8a",
|
||||
"reference": "01af52e206e690d511752e9f6a52c8b2c537ca8a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -7876,7 +7876,7 @@
|
|||
"kwaadpepper/image-resizer": "^3.0",
|
||||
"laravel/framework": "~11|~12",
|
||||
"mews/purifier": "^3.4",
|
||||
"php": "~8.3",
|
||||
"php": "^8.3",
|
||||
"sentry/sentry-laravel": "^4.10"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool)env('APP_DEBUG', false),
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ return [
|
|||
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false),
|
||||
|
||||
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate.
|
||||
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
|
||||
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_TRACES_SAMPLE_RATE'),
|
||||
|
||||
'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +29,8 @@ class CreateUsersTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateFailedJobsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -30,8 +29,8 @@ class CreateFailedJobsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomers extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +25,8 @@ class CreateCustomers extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateBrands extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('brands', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +25,8 @@ class CreateBrands extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('brands');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerInfos extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_infos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -38,8 +37,8 @@ class CreateCustomerInfos extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_infos');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerLogin extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_login', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -30,8 +29,8 @@ class CreateCustomerLogin extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_login');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateSingleOptin extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('single_optin', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -27,8 +26,8 @@ class CreateSingleOptin extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('single_optin');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomerOptInHistory extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_opt_in_history', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -28,8 +27,8 @@ class CreateCustomerOptInHistory extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_opt_in_history');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('services', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +28,8 @@ class CreateServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('services');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateServicesStats extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('services_stats', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -29,8 +28,8 @@ class CreateServicesStats extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('services_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameServicesStatsTableToServiceStats extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('services_stats', 'service_stats');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameServicesStatsTableToServiceStats extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('service_stats', 'services_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameSingleOptinToSingleOptins extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('single_optin', 'single_optins');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameSingleOptinToSingleOptins extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('single_optins', 'single_optin');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameCustomerLoginToOptinToCustomerLogins extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('customer_login', 'customer_logins');
|
||||
}
|
||||
|
|
@ -22,8 +20,8 @@ class RenameCustomerLoginToOptinToCustomerLogins extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('customer_logins', 'customer_login');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
|
|
@ -39,7 +38,7 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
|
|
@ -60,4 +59,4 @@ class ChangeForeignKeysToCascadeOnCustomerDelete extends Migration
|
|||
});
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class RenameApiTokenOnServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('api_token', 'bearer_token');
|
||||
|
|
@ -25,11 +24,11 @@ class RenameApiTokenOnServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('bearer_token', 'api_token');
|
||||
$table->renameColumn('bearer_token_date', 'api_token_date');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,18 +2,16 @@
|
|||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class ReAddApiTokenToServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('api_token')->nullable()->after('bearer_token_date');
|
||||
|
|
@ -26,7 +24,7 @@ class ReAddApiTokenToServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('api_token');
|
||||
|
|
@ -35,4 +33,4 @@ class ReAddApiTokenToServicesTable extends Migration
|
|||
$table->dropColumn('api_token_date');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddBearerPwdToServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('bearer_pwd')->after('bearer_token');
|
||||
|
|
@ -23,10 +23,10 @@ class AddBearerPwdToServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('bearer_pwd');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNewcountryColumnToCustomerInfosTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->smallInteger('newcountry')->default(76)->after('country');
|
||||
|
|
@ -23,10 +23,10 @@ class AddNewcountryColumnToCustomerInfosTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->dropColumn('newcountry');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,19 +4,20 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQuestionsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('questions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('question');
|
||||
$table->tinyInteger('type'); // QuestionType
|
||||
// QuestionType.
|
||||
$table->tinyInteger('type');
|
||||
$table->foreignId('brand_id')->constrained('brands');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
@ -27,8 +28,8 @@ class CreateQuestionsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('questions');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAnswersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('answers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
|
@ -26,8 +26,8 @@ class CreateAnswersTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('answers');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAnswerTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customer_answer', function (Blueprint $table) {
|
||||
$table->foreignId('answer_id')->constrained('answers');
|
||||
|
|
@ -25,8 +25,8 @@ class CreateCustomerAnswerTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_answer');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use App\Models\Service;
|
|||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class HashApiKeysInServicesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
foreach (Service::all() as $service) {
|
||||
$service->bearer_token = Hash::make($service->bearer_token);
|
||||
|
|
@ -24,7 +24,8 @@ class HashApiKeysInServicesTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
|
|
@ -29,8 +29,8 @@ class CreateJobsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,32 +4,32 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBrandStatsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('brand_stats', function (Blueprint $table) {
|
||||
// Le nombre de comptes actifs (dernière connexion inférieure à 6 mois)
|
||||
// Le nombre de comptes actifs (dernière connexion inférieure à 6 mois).
|
||||
$table->unsignedInteger('active');
|
||||
|
||||
// Le nombre de comptes inactifs (dernière connexion supérieure à 6 mois)
|
||||
// Le nombre de comptes inactifs (dernière connexion supérieure à 6 mois).
|
||||
$table->unsignedInteger('inactive');
|
||||
|
||||
// Le nombre d’anciens comptes (date de création supérieure à 6 mois
|
||||
// Le nombre d’anciens comptes (date de création supérieure à 6 mois.
|
||||
$table->unsignedInteger('old_accounts');
|
||||
|
||||
// Le nombre de nouveaux comptes (date de création inférieure à 6 mois)
|
||||
// Le nombre de nouveaux comptes (date de création inférieure à 6 mois).
|
||||
$table->unsignedInteger('new_accounts');
|
||||
|
||||
// Le nombre de comptes total
|
||||
// Le nombre de comptes total.
|
||||
$table->unsignedInteger('total_accounts');
|
||||
|
||||
// Le nombre d’optins (single optin compris)
|
||||
// Le nombre d’optins (single optin compris).
|
||||
$table->unsignedInteger('total_opt_in');
|
||||
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
|
@ -45,8 +45,8 @@ class CreateBrandStatsTable extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('brand_stats');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RepairStatsJobs extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
$jobIDS = [];
|
||||
$page = 1;
|
||||
|
|
@ -44,8 +44,8 @@ class RepairStatsJobs extends Migration
|
|||
}
|
||||
$serviceStat->nb_calls += 1;
|
||||
$serviceStat->saveOrFail();
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
} //end foreach
|
||||
DB::table('jobs')->whereIn('id', $jobIDS)
|
||||
->delete();
|
||||
$jobIDS = [];
|
||||
|
|
@ -57,8 +57,8 @@ class RepairStatsJobs extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropApiTokenFromServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn('api_token');
|
||||
|
|
@ -24,11 +24,11 @@ class DropApiTokenFromServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('api_token')->nullable()->after('bearer_token_date');
|
||||
$table->timestamp('api_token_date')->after('api_token')->useCurrent();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetUniqueConstrainOnApiTokenOnServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->unique('bearer_token');
|
||||
|
|
@ -23,10 +23,10 @@ class SetUniqueConstrainOnApiTokenOnServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropUnique(['bearer_token']);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class IncreaseBearerPwdOnServices extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->string('bearer_pwd', 312)->change();
|
||||
|
|
@ -23,9 +23,9 @@ class IncreaseBearerPwdOnServices extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Dont revert this, could break things with truncated
|
||||
// columns, wont harm.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ParseCountryOnCustomerInfos extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
$perPage = 10000;
|
||||
$currentPage = 0;
|
||||
|
|
@ -56,8 +56,8 @@ class ParseCountryOnCustomerInfos extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -28,7 +28,7 @@ class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -39,4 +39,4 @@ class SetCustomerIdNullableOnCustomerAnswer extends Migration
|
|||
});
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CascadeDeleteQuestionAnswers extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
// * Add cascade delete
|
||||
Schema::table('answers', function (Blueprint $table) {
|
||||
|
|
@ -25,7 +25,7 @@ class CascadeDeleteQuestionAnswers extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * Undo cascade delete (restrict as default)
|
||||
Schema::table('answers', function (Blueprint $table) {
|
||||
|
|
@ -33,4 +33,4 @@ class CascadeDeleteQuestionAnswers extends Migration
|
|||
$table->foreign('question_id')->references('id')->on('questions');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CascadeDeleteCustomerAnswer extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
// * Add cascade delete
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -25,7 +25,7 @@ class CascadeDeleteCustomerAnswer extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * Undo cascade delete (restrict as default)
|
||||
Schema::table('customer_answer', function (Blueprint $table) {
|
||||
|
|
@ -33,4 +33,4 @@ class CascadeDeleteCustomerAnswer extends Migration
|
|||
$table->foreign('answer_id')->references('id')->on('answers');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AddChangeSingleOptinToUseHashcode extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('single_optins', function (Blueprint $table) {
|
||||
$table->uuid('hashcode')->comment('Single optin hashcode')->after('id');
|
||||
|
|
@ -37,7 +37,7 @@ class AddChangeSingleOptinToUseHashcode extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('single_optins', function (Blueprint $table) {
|
||||
$table->id()->after('hashcode');
|
||||
|
|
@ -46,4 +46,4 @@ class AddChangeSingleOptinToUseHashcode extends Migration
|
|||
$table->dropColumn('hashcode');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class EnhanceCustomerInfosHashcode extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('customer_infos', function (Blueprint $table) {
|
||||
$table->uuid('hashcode')
|
||||
|
|
@ -24,8 +24,8 @@ class EnhanceCustomerInfosHashcode extends Migration
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
public function down(): void
|
||||
{
|
||||
// * No need to undo that.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<file>database/seeders</file>
|
||||
<file>routes/</file>
|
||||
<file>tests/</file>
|
||||
<exclude-pattern type="relative">*/vendor/*</exclude-pattern>
|
||||
<rule ref="PSR1" />
|
||||
<rule ref="PSR12" />
|
||||
|
||||
|
|
@ -31,8 +32,7 @@
|
|||
<rule ref="Generic.Files.LineLength"/>
|
||||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
|
||||
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
|
||||
<rule ref="Generic.Functions.CallTimePassByReference"/>
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
|
||||
<rule ref="Generic.Metrics.NestingLevel"/>
|
||||
|
|
@ -46,9 +46,6 @@
|
|||
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
||||
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
||||
<rule ref="MySource.PHP.EvalObjectFactory"/>
|
||||
<rule ref="MySource.PHP.GetRequestData"/>
|
||||
<rule ref="MySource.PHP.AjaxNullComparison"/>
|
||||
<rule ref="PEAR.Classes.ClassDeclaration"/>
|
||||
<rule ref="PEAR.Commenting.InlineComment"/>
|
||||
<rule ref="PSR1.Classes.ClassDeclaration"/>
|
||||
|
|
@ -81,7 +78,7 @@
|
|||
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||
<rule ref="Squiz.Scope.MethodScope"/>
|
||||
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.MemberVarSpacing">
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ function setupFilterListener(selectId: string, paramKey: FilterKey): void {
|
|||
if (value !== "0") {
|
||||
const url = new URL(location.href);
|
||||
url.searchParams.set(paramKey, value);
|
||||
url.searchParams.set("page", "1");
|
||||
url.searchParams.delete("rstFltrs");
|
||||
url.searchParams.delete("rstSrts");
|
||||
location.assign(url.search);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import {
|
|||
faSyncAlt,
|
||||
faTimes,
|
||||
faTrash,
|
||||
faTriangleExclamation,
|
||||
faUndoAlt,
|
||||
faWandMagic,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
|
|
@ -92,6 +93,7 @@ library.add(
|
|||
faArrowUpRightFromSquare,
|
||||
faCommentSlash,
|
||||
faCommentDots,
|
||||
faTriangleExclamation,
|
||||
);
|
||||
|
||||
// Front
|
||||
|
|
|
|||
|
|
@ -2,26 +2,7 @@
|
|||
@php $pagination = intval(Cache::get('pagination.' . str(request()->route()->getName())->slug())); @endphp
|
||||
@if ($paginator->items())
|
||||
<nav class="pagination-custom d-flex justify-content-between align-items-center">
|
||||
{{-- SELECT ITEMS PER PAGE --}}
|
||||
<div class="dropup-center d-flex justify-content-center align-items-center input-group w-fit">
|
||||
<span class="btn-md input-group-text" data-bs-tooltip="tooltip" title="{{ __('pagination.paginate_list') }}">
|
||||
<i class="fa-solid fa-list-ul"></i>
|
||||
</span>
|
||||
<button class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" type="button" aria-expanded="false">
|
||||
{{ $pagination }}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@foreach (\App\Enums\Pagination\ItemsPerPaginationEnum::toArray() as $itemsPerPaginationEnum)
|
||||
<li>
|
||||
<a class="dropdown-item user-select-none @if ($pagination === $itemsPerPaginationEnum->value) active @endif text-center"
|
||||
href="{{ request()->fullUrlWithQuery(['page' => 1, 'pagination' => $itemsPerPaginationEnum->value]) }}"
|
||||
role="button">
|
||||
{{ $itemsPerPaginationEnum->value }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@include('bo.modules.pagination.items-per-page')
|
||||
@if ($paginator->hasPages())
|
||||
{{-- PAGINATION --}}
|
||||
<div class="d-flex justify-content-end align-items-center">
|
||||
|
|
@ -51,15 +32,18 @@
|
|||
@if ($i >= $paginator->currentPage() - 2 && $i <= $paginator->currentPage() + 2)
|
||||
@if ($i == $paginator->currentPage())
|
||||
<li class="page-item">
|
||||
<form action="{{ route(request()->route()->getName(), request()->route()->parameters()) }}">
|
||||
<input class="form-control border-start-0 rounded-0" type="number" name="page" value="{{ $i }}"
|
||||
min="1" max="{{ $paginator->lastPage() }}">
|
||||
<form
|
||||
action="{{ route(request()->route()->getName(), request()->route()->parameters()) }}">
|
||||
<input class="form-control border-start-0 rounded-0" type="number"
|
||||
name="page" value="{{ $i }}" min="1"
|
||||
max="{{ $paginator->lastPage() }}">
|
||||
</form>
|
||||
</li>
|
||||
@else
|
||||
<li class="page-item d-none d-md-block" data-bs-tooltip="tooltip"
|
||||
title="{{ __('pagination.specific_page', ['id' => $i]) }}">
|
||||
<a class="page-link" href="{{ request()->fullUrlWithQuery(['page' => $i]) }}">{{ $i }}</a>
|
||||
<a class="page-link"
|
||||
href="{{ request()->fullUrlWithQuery(['page' => $i]) }}">{{ $i }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endif
|
||||
|
|
@ -82,7 +66,8 @@
|
|||
title="{{ __('pagination.next_page') }}" aria-label="{{ __('pagination.next_page') }}"
|
||||
@if ($paginator->hasMorePages()) href="{{ request()->fullUrlWithQuery(['page' => $paginator->currentPage() + 1]) }}" @endif
|
||||
rel="next" @if (!$paginator->hasMorePages()) aria-hidden="true" disabled @endif>
|
||||
<i class="fa-solid fa-chevron-right fa-2xs mt-1"></i></a>
|
||||
<i class="fa-solid fa-chevron-right fa-2xs mt-1"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<div class="dropup-center d-flex justify-content-center align-items-center input-group w-fit">
|
||||
<span class="btn-md input-group-text" data-bs-tooltip="tooltip" title="{{ __('pagination.paginate_list') }}">
|
||||
<i class="fa-solid fa-list-ul"></i>
|
||||
</span>
|
||||
<button class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" type="button" aria-expanded="false">
|
||||
{{ $pagination }}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@foreach (\App\Enums\Pagination\ItemsPerPaginationEnum::toArray() as $itemsPerPaginationEnum)
|
||||
<li>
|
||||
<a class="dropdown-item user-select-none @if ($pagination === $itemsPerPaginationEnum->value) active @endif text-center"
|
||||
href="{{ request()->fullUrlWithQuery(['page' => 1, 'pagination' => $itemsPerPaginationEnum->value]) }}"
|
||||
role="button">
|
||||
{{ $itemsPerPaginationEnum->value }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
32
resources/views/bo/modules/pagination/simple.blade.php
Normal file
32
resources/views/bo/modules/pagination/simple.blade.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{{-- GET ACTUAL PAGINATION --}}
|
||||
@php $pagination = intval(Cache::get('pagination.' . str(request()->route()->getName())->slug())); @endphp
|
||||
@if ($paginator->items())
|
||||
<nav class="pagination-custom d-flex flex-column flex-md-row justify-content-between align-items-center">
|
||||
@include('bo.modules.pagination.items-per-page')
|
||||
@if ($paginator->hasPages())
|
||||
<div class="d-flex justify-content-end align-items-center mt-2 mt-md-0">
|
||||
<ul class="pagination m-0">
|
||||
{{-- PREVIOUS PAGE --}}
|
||||
<li class="page-item @if ($paginator->onFirstPage()) disabled @endif">
|
||||
<a class="page-link d-flex align-items-center text-start h-100" data-bs-tooltip="tooltip"
|
||||
title="{{ __('pagination.previous_page') }}" aria-label="{{ __('pagination.previous_page') }}"
|
||||
@if (!$paginator->onFirstPage()) href="{{ request()->fullUrlWithQuery(['page' => $paginator->currentPage() - 1]) }}" @endif
|
||||
rel="prev" @if ($paginator->onFirstPage()) aria-hidden="true" disabled @endif>
|
||||
<i class="fa-solid fa-chevron-left fa-2xs mt-1"></i>
|
||||
<span class="ms-2">{{ __('pagination.previous_page') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{-- NEXT PAGE --}}
|
||||
<li class="page-item @if (!$paginator->hasMorePages()) disabled @endif">
|
||||
<a class="page-link d-flex align-items-center text-end h-100" data-bs-tooltip="tooltip"
|
||||
title="{{ __('pagination.next_page') }}" aria-label="{{ __('pagination.next_page') }}"
|
||||
@if ($paginator->hasMorePages()) href="{{ request()->fullUrlWithQuery(['page' => $paginator->currentPage() + 1]) }}" @endif
|
||||
rel="next" @if (!$paginator->hasMorePages()) aria-hidden="true" disabled @endif>
|
||||
<span class="me-2">{{ __('pagination.next_page') }}</span>
|
||||
<i class="fa-solid fa-chevron-right fa-2xs mt-1"></i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
@endif
|
||||
</nav>
|
||||
@endif
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
$sortWay = request()->sort_way ?? (isset($modelTable) ? Session::get("crud.$modelTable.sort_way") : null);
|
||||
$routes = !request()->routeIs('bo.activity_logs.*')
|
||||
&& !request()->routeIs('bo.users.*')
|
||||
&& !request()->routeIs('bo.brands.*');
|
||||
&& !request()->routeIs('bo.brands.*')
|
||||
&& !request()->routeIs('bo.questions.answers*');
|
||||
@endphp
|
||||
|
||||
<form action="{{ request()->fullUrlWithQuery(['rstFltrs' => null]) }}" class="row gx-2 mb-2">
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
<div class="col-12 col-lg-6">
|
||||
{{-- BRAND SELECT --}}
|
||||
<select class="form-select mb-1 {{ $routeCondition && $selectedBrand && $questionModels ? 'mb-lg-1' : 'mb-lg-0' }}"
|
||||
id="brandSelect" role="button">
|
||||
id="brandSelect" role="button" name="brand">
|
||||
<option value="0" @selected(!$selectedBrand)>{{ __('Sélectionnez une marque...') }}</option>
|
||||
@foreach (\App\Models\Brand::getUserAssociatedBrands() as $brand)
|
||||
<option value="{{ $brand->getKey() }}" @selected($selectedBrand == $brand->getKey())>
|
||||
|
|
@ -26,11 +27,9 @@
|
|||
</select>
|
||||
|
||||
{{-- QUESTION SELECT --}}
|
||||
@if ($routeCondition && $selectedBrand && $questionModels->count())
|
||||
<select id="questionSelect" role="button" @class([
|
||||
'form-select',
|
||||
'mb-1' => $selectedQuestion && $answerModels,
|
||||
])>
|
||||
@if ($routeCondition && $selectedBrand && isset($questionModels) && !$questionModels->isEmpty())
|
||||
<select id="questionSelect" role="button" class="form-select mb-1 {{ $selectedQuestion && $answerModels ? 'mb-lg-1' : 'mb-lg-0' }}"
|
||||
name="question">
|
||||
<option value="0" @selected(!$selectedQuestion)>{{ __('Sélectionnez une question...') }}</option>
|
||||
@foreach ($questionModels as $question)
|
||||
<option value="{{ $question->getKey() }}" @selected($selectedQuestion == $question->getKey())>
|
||||
|
|
@ -41,8 +40,8 @@
|
|||
@endif
|
||||
|
||||
{{-- ANSWER SELECT --}}
|
||||
@if ($routeCondition && $selectedQuestion && $questionModels->count() && $answerModels->count())
|
||||
<select id="answerSelect" class="form-select" role="button">
|
||||
@if ($routeCondition && $selectedQuestion && isset($questionModels) && !$questionModels->isEmpty() && isset($answerModels) && !$answerModels->isEmpty())
|
||||
<select id="answerSelect" class="form-select mb-1 mb-lg-0" role="button" name="answer">
|
||||
<option value="0" @selected(!$selectedAnswer)>{{ __('Sélectionnez une réponse...') }}</option>
|
||||
@foreach ($answerModels as $answer)
|
||||
<option value="{{ $answer->getKey() }}" @selected($selectedAnswer == $answer->getKey())>
|
||||
|
|
@ -57,17 +56,7 @@
|
|||
<div class="input-group">
|
||||
{{-- SEARCH FIELD --}}
|
||||
<label class="input-group-text" for="searchField">{{ str($searchFields)->ucfirst() }}</label>
|
||||
<input class="form-control" id="searchField" name="search" type="search" value="{{ $search }}"
|
||||
placeholder="Recherche.." />
|
||||
|
||||
{{-- HIDDEN INPUTS --}}
|
||||
<input type="hidden" name="sort_col" type="text" value="{{ $sortCol }}">
|
||||
<input type="hidden" name="sort_way" type="text" value="{{ $sortWay }}">
|
||||
@foreach (['brand' => $selectedBrand, 'question' => $selectedQuestion, 'answer' => $selectedAnswer] as $key => $val)
|
||||
@if ($val)
|
||||
<input type="hidden" name="{{ $key }}" type="text" value="{{ $val }}">
|
||||
@endif
|
||||
@endforeach
|
||||
<input class="form-control" id="searchField" name="search" type="search" value="{{ $search }}" placeholder="Recherche.." />
|
||||
|
||||
{{-- ACTION BUTTONS --}}
|
||||
<button class="btn btn-primary" data-bs-tooltip="tooltip" type="submit"
|
||||
|
|
@ -75,8 +64,14 @@
|
|||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
@php
|
||||
$parameters = ['rstFltrs' => 'true', 'search' => null, 'page' => null];
|
||||
if ($routes) {
|
||||
$parameters = array_merge($parameters, ['brand' => null, 'question' => null, 'answer' => null]);
|
||||
}
|
||||
@endphp
|
||||
<a class="btn btn-danger ms-2" data-bs-tooltip="tooltip"
|
||||
href="{{ request()->fullUrlWithQuery(['rstFltrs' => 'true', 'search' => null, 'brand' => null, 'question' => null, 'answer' => null]) }}"
|
||||
href="{{ request()->fullUrlWithQuery($parameters) }}"
|
||||
title="{{ __('Supprimer la recherche') }}">
|
||||
<i class="fas fa-backspace"></i>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
@csrf
|
||||
@method('DELETE')
|
||||
@can('delete', \App\Models\Answer::class)
|
||||
<button class="btn btn-sm btn-danger" data-bs-tooltip="tooltip"
|
||||
<button class="btn btn-danger" data-bs-tooltip="tooltip"
|
||||
title="{{ __('Supprimer cette :model', ['model' => Str::singular(__('models.classes.answers'))]) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -17,12 +17,19 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
@include('bo.modules.search-bar')
|
||||
<div class="row w-100 mx-auto mb-2">
|
||||
<div class="col table-responsive p-0">
|
||||
@include('bo.pages.customers.index-list')
|
||||
@if (request()->filled('search') || session()->get("crud.$modelTable.search"))
|
||||
<div class="row w-100 mx-auto mb-2">
|
||||
<div class="col table-responsive p-0">
|
||||
@include('bo.pages.customers.index-list')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{!! $customerModels->links() !!}
|
||||
{!! $customerModels->links() !!}
|
||||
@else
|
||||
<div class="d-flex flex-column justify-content-center align-items-center w-100 pt-2">
|
||||
<i class="fa-solid fa-triangle-exclamation fa-2xl"></i>
|
||||
<p class="m-0">{{ __('Veuillez faire une recherche en sélectionnant ou non une marque') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,12 +17,19 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
@include('bo.modules.search-bar')
|
||||
<div class="row w-100 mx-auto mb-2">
|
||||
<div class="col table-responsive p-0">
|
||||
@include('bo.pages.singleoptins.index-list')
|
||||
@if (request()->filled('search'))
|
||||
<div class="row w-100 mx-auto mb-2">
|
||||
<div class="col table-responsive p-0">
|
||||
@include('bo.pages.singleoptins.index-list')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{!! $singleoptinModels->links() !!}
|
||||
{!! $singleoptinModels->links() !!}
|
||||
@else
|
||||
<div class="d-flex flex-column justify-content-center align-items-center w-100 pt-2">
|
||||
<i class="fa-solid fa-triangle-exclamation fa-2xl"></i>
|
||||
<p class="m-0">{{ __('Veuillez faire une recherche en sélectionnant ou non une marque') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<ol class="breadcrumb justify-content-center w-100 m-0">
|
||||
@foreach ($breadcrumbs as $breadcrumb)
|
||||
@if ($breadcrumb->url && !$loop->last)
|
||||
<li class="breadcrumb-item d-flex">
|
||||
<a class="h2 fw-bold m-0 ps-2" href="{{ $breadcrumb->url }}">
|
||||
<li class="breadcrumb-item d-flex align-items-center flex-grow-1 h2 fw-bold m-0">
|
||||
<a class="h2 fw-bold m-0" href="{{ $breadcrumb->url }}">
|
||||
{{ $breadcrumb->title }}
|
||||
</a>
|
||||
</li>
|
||||
@else
|
||||
<li class="breadcrumb-item btn-games d-flex align-items-center flex-grow-1 active h2 fw-bold m-0">
|
||||
<li class="breadcrumb-item d-flex align-items-center flex-grow-1 active h2 fw-bold m-0">
|
||||
{{ $breadcrumb->title }}
|
||||
</li>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ class ApiBase extends BaseTestCase
|
|||
* @param \App\Enums\ApiStatus $status
|
||||
* @return void
|
||||
*/
|
||||
protected function assertApiResponseStatusIs(AssertableJsonString $json, ApiStatus $status)
|
||||
protected function assertApiResponseStatusIs(AssertableJsonString $json, ApiStatus $status): void
|
||||
{
|
||||
$json->assertFragment(['status' => $status->value()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw Function to call api
|
||||
* Raw Function to call api.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $uri
|
||||
|
|
@ -51,7 +51,7 @@ class ApiBase extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Raw Function to call api with Token
|
||||
* Raw Function to call api with Token.
|
||||
*
|
||||
* @param \App\Models\Service $service
|
||||
* @param string $method
|
||||
|
|
@ -81,7 +81,7 @@ class ApiBase extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Customer models with given status (active or not)
|
||||
* Get Customer models with given status (active or not).
|
||||
*
|
||||
* @param boolean $status The customer status for a brand.
|
||||
* @param boolean $random Randomize the customer to get.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ArcadiaTest extends ApiBase
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '2563547'
|
||||
];
|
||||
$response = $this->callApiWithToken($service, 'post', route(
|
||||
|
|
|
|||
|
|
@ -639,7 +639,7 @@ class CustomerTest extends ApiBase
|
|||
});
|
||||
|
||||
$this->assertTrue(
|
||||
(bool)$customer->logins()->count(),
|
||||
(bool) $customer->logins()->count(),
|
||||
'This test assumes customer belongs to multiple brand.'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ArcadiaTest extends ApiBase
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '2563547'
|
||||
];
|
||||
$response = $this->callApiWithToken($service, 'post', route(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use App\Models\ClaimSubject;
|
|||
use App\Models\Customer;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ClaimTest extends ApiBase
|
||||
{
|
||||
|
|
@ -66,6 +67,14 @@ class ClaimTest extends ApiBase
|
|||
$json = $response->decodeResponseJson();
|
||||
$this->assertApiResponseStatusIs($json, ApiStatus::OK);
|
||||
$this->assertTrue($claimModel, 'Claim should have been stored.');
|
||||
|
||||
// Assert file stored.
|
||||
$claimModel = Claim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
|
||||
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
|
||||
$this->assertTrue(
|
||||
Storage::exists(ltrim($claimModel->file, '/')),
|
||||
"The file does not exist: {$claimModel->file}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,8 +109,7 @@ class ClaimTest extends ApiBase
|
|||
public function testSendClaimWithoutOptionnalFieldsShouldWork(): void
|
||||
{
|
||||
extract($this->getCustomer(true, false));
|
||||
$subject = ClaimSubject::query()->firstOrNew();
|
||||
$customer = Customer::query()->firstOrNew();
|
||||
$subject = ClaimSubject::query()->firstOrNew();
|
||||
|
||||
$response = $this->callApiWithToken($service, 'post', route('apiV4.claim.store'), \array_merge(
|
||||
Arr::except($this->skeleton, ['address', 'city', 'postcode', 'file']),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CustomerTest extends ApiBase
|
|||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test Customer relations to its related models
|
||||
* Test Customer relations to its related models.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -172,7 +172,7 @@ class CustomerTest extends ApiBase
|
|||
}
|
||||
|
||||
/**
|
||||
* Customer store ok
|
||||
* Customer store ok.
|
||||
* route: apiV4.customers.store
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -639,7 +639,7 @@ class CustomerTest extends ApiBase
|
|||
});
|
||||
|
||||
$this->assertTrue(
|
||||
(bool)$customer->logins()->count(),
|
||||
(bool) $customer->logins()->count(),
|
||||
'This test assumes customer belongs to multiple brand.'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderDefault()
|
||||
public function testArcadiaSendOrderDefault(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -44,11 +44,11 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test arcadia default mail can serialize to json
|
||||
* Test arcadia default mail can serialize to json.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaOrderDefaultJson()
|
||||
public function testArcadiaOrderDefaultJson(): void
|
||||
{
|
||||
$data = [
|
||||
'email' => static::$customer->email,
|
||||
|
|
@ -95,7 +95,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderGame()
|
||||
public function testArcadiaSendOrderGame(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -112,7 +112,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '12365214587562'
|
||||
]);
|
||||
$this->assertTrue($arcadiaOrderMail->send($customer));
|
||||
|
|
@ -123,7 +123,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaSendOrderGameNullString()
|
||||
public function testArcadiaSendOrderGameNullString(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -147,11 +147,11 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test arcadia game mail can serialize to json
|
||||
* Test arcadia game mail can serialize to json.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testArcadiaOrderGameJson()
|
||||
public function testArcadiaOrderGameJson(): void
|
||||
{
|
||||
$data = [
|
||||
'email' => static::$customer->email,
|
||||
|
|
@ -166,7 +166,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
'order_date' => date('Y/m/d H:i:s'),
|
||||
'support_code' => 32,
|
||||
'label_type_support' => 'Jeux Reghalal',
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())),
|
||||
'code_unique' => \strtoupper(\str_replace('-', '', (string) Str::uuid())),
|
||||
'code_on_pack' => '12365214587562'
|
||||
];
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidateGeneratedXmlDefault()
|
||||
public function testValidateGeneratedXmlDefault(): void
|
||||
{
|
||||
$fileFound = false;
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidateGeneratedXmlGame()
|
||||
public function testValidateGeneratedXmlGame(): void
|
||||
{
|
||||
$fileFound = false;
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Render a \LibXMLError
|
||||
* Render a \LibXMLError.
|
||||
*
|
||||
* @param \LibXMLError $error
|
||||
* @return string
|
||||
|
|
@ -283,7 +283,7 @@ class CrmClientArcadiaTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function libxmlDisplayErrors()
|
||||
private function libxmlDisplayErrors(): void
|
||||
{
|
||||
$errors = libxml_get_errors();
|
||||
foreach ($errors as $error) {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
namespace Tests\Client;
|
||||
|
||||
use App\Models\Claim as ModelsClaim;
|
||||
use LDC\LDCCRM\Models\Claim;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use LDC\LDCCRM\Exceptions\ValidationException;
|
||||
use LDC\LDCCRM\Models\Claim;
|
||||
|
||||
class CrmClientClaimTest extends CrmClientTester
|
||||
{
|
||||
|
|
@ -16,7 +17,8 @@ class CrmClientClaimTest extends CrmClientTester
|
|||
*/
|
||||
public function testCreateClaim(): void
|
||||
{
|
||||
$image = UploadedFile::fake()->image('photo.jpg');
|
||||
$image = UploadedFile::fake()->image('photo.jpg');
|
||||
$base64 = base64_encode(file_get_contents($image->getRealPath()));
|
||||
$this->assertTrue(Claim::setClaim(
|
||||
'Jean',
|
||||
'Bond',
|
||||
|
|
@ -27,9 +29,16 @@ class CrmClientClaimTest extends CrmClientTester
|
|||
'10 rue des totos',
|
||||
'Le Mans',
|
||||
'72100',
|
||||
base64_encode(file_get_contents($image->getRealPath())),
|
||||
$base64,
|
||||
));
|
||||
$this->assertTrue(ModelsClaim::query()->where('email', 'claim@hotmail.fr')->exists());
|
||||
|
||||
$claimModel = ModelsClaim::query()->where('email', 'claim@hotmail.fr')->firstOrFail();
|
||||
$this->assertNotEmpty($claimModel->file, 'The "file" field is empty on the Claim model.');
|
||||
$this->assertTrue(
|
||||
Storage::exists(ltrim($claimModel->file, '/')),
|
||||
"The file does not exist: {$claimModel->file}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CrmClientClientTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testApiInterface()
|
||||
public function testApiInterface(): void
|
||||
{
|
||||
$routes = $this->getClientRoutes();
|
||||
$interface = new ApiInterface();
|
||||
|
|
@ -37,18 +37,18 @@ class CrmClientClientTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testClientPing()
|
||||
public function testClientPing(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$this->assertTrue($api->ping());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unknown attribute set
|
||||
* Set unknown attribute set.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCrmModelSetUnknownAttribute()
|
||||
public function testCrmModelSetUnknownAttribute(): void
|
||||
{
|
||||
$this->expectException(AccessError::class);
|
||||
$customer = new Customer();
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ use LDC\LDCCRM\Utils;
|
|||
class CrmClientConfigTest extends CrmClientTester
|
||||
{
|
||||
/**
|
||||
* Test Utils::getConfig
|
||||
* Test Utils::getConfig.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConfigGet()
|
||||
public function testConfigGet(): void
|
||||
{
|
||||
$this->assertEquals(null, Utils::getConfig('totot'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetter()
|
||||
public function testGetter(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
|
@ -29,11 +29,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set customer prop
|
||||
* Test set customer prop.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetter()
|
||||
public function testSetter(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
|
@ -47,7 +47,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetterFailWrongType()
|
||||
public function testSetterFailWrongType(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
|
@ -60,7 +60,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetterFailWrongTypeCountry()
|
||||
public function testSetterFailWrongTypeCountry(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
|
@ -73,13 +73,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAllSetOk()
|
||||
public function testPropsAllSetOk(): void
|
||||
{
|
||||
$this->expectNotToPerformAssertions();
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -105,12 +105,12 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonSerialize()
|
||||
public function testJsonSerialize(): void
|
||||
{
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -144,13 +144,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAllSetNotOk()
|
||||
public function testPropsAllSetNotOk(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$client = new Customer();
|
||||
|
||||
$propTypes = [
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -172,16 +172,16 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set unkown prop fail
|
||||
* Test set unkown prop fail.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAssignUnknown()
|
||||
public function testPropsAssignUnknown(): void
|
||||
{
|
||||
$this->expectException(AccessError::class);
|
||||
|
||||
$customer = new Customer([
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -201,16 +201,16 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test set prop fail wrong type
|
||||
* Test set prop fail wrong type.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPropsAssignWrongType()
|
||||
public function testPropsAssignWrongType(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
|
||||
$customer = new Customer([
|
||||
'hashcode' => (string)Str::uuid(),
|
||||
'hashcode' => (string) Str::uuid(),
|
||||
'email' => 'toto@gmail.com',
|
||||
'firstname' => 'string',
|
||||
'lastname' => 'string',
|
||||
|
|
@ -234,7 +234,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerGet()
|
||||
public function testCustomerGet(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -259,7 +259,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerActivate()
|
||||
public function testCustomerActivate(): void
|
||||
{
|
||||
// Get non activated customer.
|
||||
/** @var \App\Models\Customer */
|
||||
|
|
@ -283,11 +283,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test customer update
|
||||
* Test customer update.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerUpdateProps()
|
||||
public function testCustomerUpdateProps(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -340,7 +340,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerToggleOptin()
|
||||
public function testCustomerToggleOptin(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
@ -359,11 +359,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test customer store
|
||||
* Test customer store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerStoreProps()
|
||||
public function testCustomerStoreProps(): void
|
||||
{
|
||||
$customer = new Customer();
|
||||
|
||||
|
|
@ -385,11 +385,11 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test customer login
|
||||
* Test customer login.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerLogin()
|
||||
public function testCustomerLogin(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew('toto.delarogerie@gmail.com');
|
||||
|
|
@ -404,7 +404,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerLoginUsingCustomerfromAnotherBrand()
|
||||
public function testCustomerLoginUsingCustomerfromAnotherBrand(): void
|
||||
{
|
||||
$this->expectException(ApiErrorException::class);
|
||||
$this->expectExceptionCode(ApiError::authFailed->value());
|
||||
|
|
@ -439,7 +439,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerStorePropsFails()
|
||||
public function testCustomerStorePropsFails(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$customer = new Customer();
|
||||
|
|
@ -469,7 +469,7 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomerDelete()
|
||||
public function testCustomerDelete(): void
|
||||
{
|
||||
$customer = new Customer();
|
||||
|
||||
|
|
@ -496,13 +496,13 @@ class CrmClientCustomerTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Make sute a customer exists and contains data
|
||||
* Make sute a customer exists and contains data.
|
||||
*
|
||||
* @param array $data
|
||||
* @param \App\Models\Brand $brand
|
||||
* @return void
|
||||
*/
|
||||
private function createNewCustomer(array $data, Brand $brand)
|
||||
private function createNewCustomer(array $data, Brand $brand): void
|
||||
{
|
||||
$customer = \App\Models\Customer::whereEmail($data['email'])
|
||||
->whereHas('brands', function ($q) use ($brand) {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ use LDC\LDCCRM\Models\Question;
|
|||
class CrmClientQuestionTest extends CrmClientTester
|
||||
{
|
||||
/**
|
||||
* Get All Questions
|
||||
* Get all questions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestions()
|
||||
public function testGetAllQuestions(): void
|
||||
{
|
||||
$questions = Question::all();
|
||||
$this->assertIsArray($questions, 'Should have returned an array');
|
||||
|
|
@ -38,11 +38,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonSerialize()
|
||||
public function testJsonSerialize(): void
|
||||
{
|
||||
$questions = Question::all();
|
||||
$this->assertIsArray($questions);
|
||||
$this->assertTrue((bool)count($questions));
|
||||
$this->assertTrue((bool) count($questions));
|
||||
foreach ($questions as $question) {
|
||||
$jsonDecoded = \json_decode(\json_encode($question), true);
|
||||
$this->assertArrayHasKey('id', $jsonDecoded);
|
||||
|
|
@ -64,11 +64,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all question with user answers
|
||||
* Get all question with user answers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestionsWithCustomerAnswers()
|
||||
public function testGetAllQuestionsWithCustomerAnswers(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -127,11 +127,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all unanswered questions
|
||||
* Get all unanswered questions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllCustomerUnAnsweredQuestions()
|
||||
public function testGetAllCustomerUnAnsweredQuestions(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -179,7 +179,7 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSubmitCustomerAnswer()
|
||||
public function testSubmitCustomerAnswer(): void
|
||||
{
|
||||
/** @var \App\Models\Question $answeredQuestion */
|
||||
$answeredQuestion = ModelsQuestion::whereHas('brand', function ($q) {
|
||||
|
|
@ -224,11 +224,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* Test unansweredBy
|
||||
* Test to get all customer unanswered questions should not contain first.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllCustomerUnansweredQuestionsShouldNotContainFirst()
|
||||
public function testGetAllCustomerUnansweredQuestionsShouldNotContainFirst(): void
|
||||
{
|
||||
$unWantedQuestion = Question::all()[0];
|
||||
|
||||
|
|
@ -242,11 +242,11 @@ class CrmClientQuestionTest extends CrmClientTester
|
|||
}
|
||||
|
||||
/**
|
||||
* test allWithCustomerAnswers
|
||||
* Test all with customer answers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetAllQuestionsWithCustomerAnswersShouldHaveAnswers()
|
||||
public function testGetAllQuestionsWithCustomerAnswersShouldHaveAnswers(): void
|
||||
{
|
||||
$api = new CrmApiV4();
|
||||
$customer = $api->getCustomerOrNew(static::$info->hashcode);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue