pickab00
228
16
Laravel

Can not use variable outside of If statement

Posted 1 month ago by pickab00

My variable can not be used outside of the if statement. Here is my controller:

public function getStuff(){

    if ($insert->free_meal == 1){
                $push = 'Guest is also eligible for a Free Meal';
        }

    return $push;   

}

It is giving me variable not found

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.