How to identify which method called the view in Laravel 5.4?

Asked

Viewed 135 times

0

How can I identify which método who is calling the view within itself?

Example:

Indexcontroller.php

public function create() {
    return view('index');
}

Inside the archive view/index.blade.php how do I return the method you called, in this example I want to return create or create().

  • I don’t understand????

  • I edited the publication exemplifying for a better understanding

1 answer

0


All you have to do is use getActionName

echo Route::getCurrentRoute()->getActionName();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.