Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #375

    What exactly does the __invoke() method do?


    Controllers normally have several methods and you define each method with names such as index, store, update etc

    When you just have single action and instead of thinking of a name for a method you can use the invoke method


    namespace App\Http\Controllers;

    use App\Models\User;
    use Illuminate\Http\Response;

    class ProvisionServer extends Controller
    * Provision a new web server.
    public function __invoke()
    return view(‘user’);

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.