samedi 19 septembre 2015

Forwarding the `store` method to the `update` method

I am trying to forward store request to update meth when its possible.

I trying something similar to below:

public function store(UserRequest $request)
{
    return $this->update(new User, $request);
}

public function update(User $user, UserRequest $request)
{

    // code

}

However, it seems the first parameter of update need an already in database user and the above code does not work as expected. (it update the entire users in db!)

What is the correct way to achieve that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire