jeudi 3 mai 2018

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');
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire