In this video we are going to learn about Facades.
Facades provide a static interface to classes that are available in the application's service container.
Laravel facades serve as static proxies to underlying classes in the service container,
providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.
So Lets create a custom facade.
Goto the project and inside the app folder just create a new folder.
Lets say foldername is PaymentGateway.
Inside the PaymentGateway Folder create a file.
Let say file name is Payment.php.
Inside the Payment.php write the following code.

namespace App\\PaymentGateway;

class Payment {
public function process()
echo \"Processing the payment\";

Now create another file let say file name PaymentFacade.php.
Inside the PaymentFasacde.php file.
Just write here.


namespace App\\PaymentGateway;

use Illuminate\\Support\\Facades\\Facade;

class PaymentFacade extends Facade {
    protected static function getFacadeAccessor() { return 'payment'; }
Alright now create a service provider.
So go to the command prompt and.
Here run the command.

php artisan make:provider PaymentServiceProvider

Now serviceprovider is created.
Now switch to the project and go inside the app directory then providers.
You can see here PaymentServiceProvider.
Now open this and inside the register function
use App\\PaymentGateway\\Payment;

public function register()
    $this->app->bind('payment', function(){
        return new Payment();

Now Add a service provider to config file.
So goto the config folder and then open app.php file.
Inside the app.php file.
Go to the poviders and add here.


Now add the alias.

'Payment' => App\\PaymentGateway\\PaymentFacade::class,

Now all set.
So lets use this fascades.
So go to the web.php.
Here lets create a new route.

Route::get('/payment', function(){
return Payment::process();

Also import the following on top the page.

use App\\PaymentGateway\\Payment;

Now run this.
So switch to the browser and go to the url /payment.
Now you can see the message.
So in this way can create and use the custom facades in laravel 8.