how do I create an inverse function to save in my mysql in eloquent? - development

how do I create an inverse function to save in my mysql in eloquent?

I want my function to save inverse values in my database, how do I do this?
I created a function, but it does not work, can anyone help me?

class DashboardController extends Controller
{

    private $text;

    public function index()
    {
        $this->text = Chav::first();
        $this->text->alugado;

        if( $this->text === 1){
            $this->text->alugado = 0;
            $this->text->save();
        }elseif( $this->text === 0){
            $this->text->alugado = 1;
            $this->text->save();
            }

            return view('text');
    }
}



from Laravel Questions and Answers https://laravelquestions.com/php/how-do-i-create-an-inverse-function-to-save-in-my-mysql-in-eloquent/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome