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
No comments:
Post a Comment