successdav
8 months ago

Return true or false if a record exist in the Database

Posted 8 months ago by successdav

I want to return true if a record exist in the database and active is set to true and return false if it no record is found in the database or a record is found but active is set to false

but this code keeps returning true whether a record exist or not

    public function isSubscribe($course)
    {
        return !! $this->subscriptions()->where('id', $course->id)
            ->where('status', true);
    }

and this one keeps returning false whether a record exist or not

    public function isSubscribe($course)
    {
        return ! $this->subscriptions()->where('id', $course->id)
            ->where('status', true);
    }

thanks for your help

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