public function masuk($f3) { $post = $f3->get('POST'); $data = $f3->scrub($post); $log = new \models\UsersM(); $login = $log->masuk($data['email'], $data['pass']); $gagalLogin = is_null($login->id); if ($gagalLogin === false) { //berhasil masuk $this->set_code("01"); $this->set_msg("Berhasil masuk"); $this->set_data("user", ["token" => $login->id]); } else { $this->set_code("00"); $this->set_msg("Email atau kata sandi salah!"); $this->set_data("user", []); } $this->return_json(); }
function login() { $log = new \models\UsersM(); $login = $log->masuk("kura@wall", "111"); echo '<pre>'; $result = is_null($login->id); var_dump($result); //print_r($login->cast()); }