Skip to content

Instantly share code, notes, and snippets.

@mouyong
Last active June 24, 2018 20:53
Show Gist options
  • Save mouyong/e40c705c4aa8dcea82cf1ee71bcae735 to your computer and use it in GitHub Desktop.
Save mouyong/e40c705c4aa8dcea82cf1ee71bcae735 to your computer and use it in GitHub Desktop.

Revisions

  1. mouyong revised this gist Jun 24, 2018. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions get_current_router_bind_key
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,16 @@ if (!function_exists('get_current_router_bind')) {
    function get_current_router_bind_key() {
    dd(key(array_reverse(last(last(debug_backtrace(0)[2])))));
    }
    }

    // UserController
    // update(Request $request, User get_current_router_bind_key())
    public function update(Request $request, User $user)
    {
    get_current_router_bind_key();
    $this->authorize('update', $user);

    $user->update(array_only($request->all(), $user->getFillable()));

    return $this->success($user);
    }
  2. mouyong revised this gist Jun 24, 2018. 2 changed files with 6 additions and 13 deletions.
    13 changes: 0 additions & 13 deletions get_current_router_bind
    Original file line number Diff line number Diff line change
    @@ -1,13 +0,0 @@
    // Illuminate\Routing\Controller
    public function callAction($method, $parameters)
    {
    get_current_router_bind();
    return call_user_func_array([$this, $method], $parameters);
    }

    // helpers.php
    if (!function_exists('get_current_router_bind')) {
    function get_current_router_bind() {
    dd(array_reverse(head(debug_backtrace(0))['args'][1]));
    }
    }
    6 changes: 6 additions & 0 deletions get_current_router_bind_key
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    // helpers.php
    if (!function_exists('get_current_router_bind')) {
    function get_current_router_bind_key() {
    dd(key(array_reverse(last(last(debug_backtrace(0)[2])))));
    }
    }
  3. mouyong revised this gist Jun 24, 2018. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion get_current_router_bind
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,13 @@
    // Illuminate\Routing\Controller
    public function callAction($method, $parameters)
    {
    dd(array_reverse(head(debug_backtrace(0))['args'][1]));
    get_current_router_bind();
    return call_user_func_array([$this, $method], $parameters);
    }

    // helpers.php
    if (!function_exists('get_current_router_bind')) {
    function get_current_router_bind() {
    dd(array_reverse(head(debug_backtrace(0))['args'][1]));
    }
    }
  4. mouyong revised this gist Jun 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion get_current_router_bind
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // Illuminate\Routing\Controller
    public function callAction($method, $parameters)
    {
    dd(array_reverse(debug_backtrace(0)[0]['args'][1]));
    dd(array_reverse(head(debug_backtrace(0))['args'][1]));
    return call_user_func_array([$this, $method], $parameters);
    }
  5. mouyong created this gist Jun 24, 2018.
    6 changes: 6 additions & 0 deletions get_current_router_bind
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    // Illuminate\Routing\Controller
    public function callAction($method, $parameters)
    {
    dd(array_reverse(debug_backtrace(0)[0]['args'][1]));
    return call_user_func_array([$this, $method], $parameters);
    }