File: /www/wwwroot/www.shooperm.com/app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Models\User;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->register(TranslationServiceProvider::class);
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (!Collection::hasMacro('paginate')) {
Collection::macro('paginate',
function ($perPage = 15, $page = null, $options = []) {
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
return (new LengthAwarePaginator(
$this->forPage($page, $perPage), $this->count(), $perPage, $page, $options))
->withPath('');
});
}
if (config('app.force_https')) {
URL::forceScheme('https');
}
Schema::defaultStringLength(191);
Validator::extend('check_unique_phone', function($attribute, $value, $parameters, $validator) {
if (is_numeric($value)) {
$data=User::where('phone',$value)->first();
if($data){
return false;
}
return true;
}
return true;
});
}
}