-

Create Custom function in laravel

By Admin | 30-Jan-2023

 Create Custom function in laravel

How to Create Custom function in laravel.

To create a function in Laravel, you can define it in a controller or in a model. Here's an example of a function in a controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ExampleController extends Controller
{
    public function myFunction(Request $request)
    {
        // your logic here

        return view('example');
    }
}

In this example, the function myFunction takes a Request object as its argument and returns a view named example.

laravel,create,function,custom,make,request,example

Tags

#laravel #create #function #custom #make #request #example

Comments (0)

Leave a Comment