Image

Laravel Create Custom Class

Laravel Create Custom Class

First we will create custom class file inside laravel project app/Classes If Classes folder doesn't exist inside app folder then create it manually.

coderuck-laravel-custom-class-1

Second step is to create your class file, I have created like SendSms.php inside your app/Classes folder.

Third step define your class code.

coderuck-laravel-custom-class-2

Finally you have created your custom class now how to access custom class method.?

Define use App\Classes\SendSms; on the top of your controller.Then only you can able to access custom class method.

/coderuck-laravel-custom-class-3

 

 

Categories: PHP Tags: #Laravel,

Newsletter Subcribe

Receive updates and latest news direct from our team. Simply enter your email.