search

Home  >  Q&A  >  body text

php laravel problem help

  1. Laravel 5 How to get the function name of the current controller?

I often see Request $request written this way. What is this knowledge point called?

public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }
public function store(Request $request)
    {
        //
    }
迷茫迷茫2767 days ago481

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:56:51

    Dependency injection

    Assign an object to a property and call it

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:56:51

    First question:
    In LaravelRoute::current()->getActionName(); you can get the detailed name of the current Action, which may not be the result you want directly. Just process the results returned by the above method yourself.

    Second question:

    The $request parameter here is IlluminateHttpRequest, which is passed to the Controller through dependency injection.

    In Laravel, the Controller can use Request in the parameters after using IlluminateHttpRequest at the top.

    Request contains the request content sent by the client.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 16:56:51

    This product uses dependency injection, which makes the performance very low

    reply
    0
  • Cancelreply