GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/app/Providers/AppServiceProvider.php
<?php

namespace App\Providers;

use App\Services\ApiEndpoints;
use App\Services\DeviceService;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
         $this->app->singleton(DeviceService::class, function ($app) {
        return new DeviceService();
    });
         $this->app->singleton(ApiEndpoints::class, function ($app) {
        return new ApiEndpoints();
    });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Validator::extend('valid_password', function ($attribute, $value, $parameters, $validator) {
            if (strlen($value) < 8) {
                return false;
            }

            if (!preg_match('/[A-Z]/', $value)) {
                return false;
            }

            if (!preg_match('/[0-9]/', $value)) {
                return false;
            }

            return true;
        }, 'Password must be at least 8 characters long, contain at least 1 uppercase letter, and 1 number.');

            Validator::extend('valid_email_domain', function ($attribute, $value, $parameters, $validator) {
                $allowedDomains = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', '@ymail.com'];
                $domain = substr(strrchr($value, "@"), 1);
                return in_array($domain, $allowedDomains);
            }, 'The :attribute is not verifiable, please try again with different email address.');
    }
}