Skip to content

Usage with models #139

Answered by Nir-An
rrrrando asked this question in Q&A
Jun 1, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

@rrrrando you can do something like From a request :

call or bind the model and then insert what you want from the object

class SongController{
    ...
    
    public function update(
        Song $model, // the model
        SongData $songData //the  object
    ){
        $model->update(['title' => $songData->title]);
        
        return 
    }
}

for more information, you can see how to update a model and the difference between 'update' to 'save' method

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rrrrando
Comment options

Answer selected by rrrrando
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants