Answer the question
In order to leave comments, you need to log in
How to change the data inside the model itself?
There are functions in the controller:
...
if($message->receiver_id == Auth::id()){
// отмечает сообщение прочитанным
$message->setWatched();
}
....
static function setWatched(){
$this->watched = 1;
}
Answer the question
In order to leave comments, you need to log in
Your method is declared static, which is indicated in the error. Remove static and everything will work.
public function setWatched()
{
$this->defineWatched(1);
}
public function defineWatched($value)
{
$this->watched = $value;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question