Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/www/test.tradze.com/app/Providers/ |
<?php
namespace App\Providers;
use App\Http\Requests\Request;
use App\User;
use Carbon\Carbon;
use Illuminate\Auth\Authenticatable;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Cashier;
use Symfony\Component\CssSelector\Parser\Reader;
use Illuminate\Support\Facades\Blade;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// \Braintree_Configuration::environment(env('BRAINTREE_ENV'));
// \Braintree_Configuration::merchantId(env('BRAINTREE_MERCHANT_ID'));
// \Braintree_Configuration::publicKey(env('BRAINTREE_PUBLIC_KEY'));
// \Braintree_Configuration::privateKey(env('BRAINTREE_PRIVATE_KEY'));
// Cashier::useCurrency('gbp', '£');
//validator
Validator::extend('paymentslimit', function ($attribute, $value, $parameters, $validator) {
$limit = $parameters[0];
$payments = $parameters[1];
return $limit >= $payments;
});
//validate same date, except the hours
Validator::extend('sameDateDiffHours', function ($attribute, $value, $parameters, $validator) {
$date_start = Carbon::createFromFormat('d F Y - h:i A',$parameters[0])->format('Y-m-d');
$date_end = Carbon::createFromFormat('d F Y - h:i A',$value)->format('Y-m-d');
if ($date_start!=$date_end)
return false;
//the validator passes, return true
return true;
});
Blade::directive('checkServiceDuration', function ($expression) {
return $expression;
// Custom logic for the global function using the array variable
$result = processData($expression);
// Custom logic for the global function
return $result;
});
}
public function processData($data)
{
dd($data);
// Custom logic for processing the data
// Example: Convert the data to uppercase
return $data;
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}