WHAT DOES THE MAKE() METHOD DO IN LARAVEL

two dates Laravel 5 MAKE Create Custom helpers

Laravel’s make method is used to create an instance of a class or interface.While creating an instance with make method Laravel will automatically inject all dependencies of class that is defined in it’s constructor. E.g. an instance of the Mailer class would be automatically injected in below code.

Here is Code for THE MAKE() METHOD DO IN LARAVEL

namespace App\Services;

use \Illuminate\Mail\Mailer;

class MyService
{
    public function __construct(Mailer $mailer) {
        $this->mailer = new Mailer;
    }
}

Also Read: Common Laravel Interview Questions answer

Leave a Reply