vendredi 31 janvier 2020

PHP set empty field in database to value

My goal is set value if field is empty.

But get "Trying to get property of non-object" error.

last_day is empty field, how to assign value 1 ?

public function getPointsForExercises(){
        $ls = Auth::user()->lessons()->get();
        $last_day = Auth::user()->user_settings->last_day;
            if (empty($user->user_settings->last_lesson)) {
                $user->user_settings->last_lesson = 1; 
           } 


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2RN9xgd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire