Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel get route action

$request->route()->getActionMethod();
  
request()->route()->getActionMethod();

//On blade:
{{ request()->route()->getActionMethod() }}
Comment

Returns the current laravel route action

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;
use IlluminateSupportFacadesRoute;

class DemoController extends Controller
{
    public function demoAction()
    {
        $action = Route::currentRouteAction(); // string

        // return text after @
        // Before: AppHttpControllersDemoController@demoAction
        return substr($action, strpos($action, '@') + 1);

        // Output: demoAction
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: connect an if statement to an input php 
Php :: laravel collection union 
Php :: php get youtube code 
Php :: php artisan key:generate error 
Php :: laravel 6 use username on url 
Php :: php check new month 
Php :: how to create route in laravel 
Php :: laravel api error return homepage 
Php :: artisan new view 
Php :: jquery get data from php 
Php :: Laravel 7 pagination with search filter 
Php :: getting routes in middleware laravel 
Php :: polymorphism in php 
Php :: list function php 
Php :: comment installer laravel avec docker 
Php :: php return multiple variables from function 
Php :: mail laravel 
Php :: main.php 
Php :: template engine php 
Php :: laravel withValidator 
Php :: optimize wordpress query 
Php :: php date time formatting 
Php :: php get date from day of year 
Php :: Get the Last Character of a String in PHP 
Php :: mezzio quick start templating with laminas view 
Php :: permission for multisite in wp-config.php file 
Php :: IgasterLaravel ThemeExceptions heme Already Exists 
Php :: Wordpress even odd post count 
Php :: Include Custom Post Types Categories to the main query 
Php :: check if product has crosssell woocommerce 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =