samedi 16 février 2019

How to write Laravel eloquent query inside model function?

Actually I don't know how to retrieve data from db using function and query inside model .Please help me what should i add inside model function.

Here is controller

public function checkAdmin(Request $request){
        $data  = array();
        $data['email'] = $request->email;
        $data['password'] = $request->password;
        $found = AdminModel::checkAdmin($data);
        if($found == TRUE){
            echo "found";
        }
        else{
            echo "sorry";
        }
    }

Here is the Model Function

public static function checkAdmin($data){
        $found = $this->where('email',$data['email'])->where('password',$data['password'])->first();
        return $found;
    }



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2S7GIIe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire