2 years ago

Request fields in Model

Posted 2 years ago by fdusautoir

Hello Everybody,

I wonder if I took the right way in my application. For example, in my FooController I have :

public function submit(Foo $foo)
    return back();

public function publish(Foo $foo)
    return back();

And in my Foo model :

      private function updateFields($status)
            'body'        => request('body'),
            'body_draft'  => request('body'),
            'status'     => $status,
            'difficulty' => request('difficulty') ?: $this->difficulty,
            'comment'    => request('comment') ?: $this->comment,
    public function submit()
    public function publish()

All is working well but is it a good way to proceed or it not recommend to use request in model and why ?

Thanks for your help ! :)

Please sign in or create an account to participate in this conversation.