public function validate(array $params = [])
    {
        $name = array_get($params, 'name');
        if (is_null($name) or $name != config('antares/logger::operations.login')) {
            return false;
        }
        $params = array_merge($params, $this->getClientParams());
        try {
            $model = $this->model->newQuery()
                    ->where('user_id', $params['user_id'])
                    ->where('ip_address', $params['ip_address'])
                    ->where('browser', $params['browser'])
                    ->orderBy('created_at', 'desc')
                    ->firstOrFail();
            $model->touch();
        } catch (Exception $ex) {
            $this->saveNewDevice($params);
        }
        if (isset($model) and ! is_null($model) and ( $model->ip_address != $params['ip_address'] or $model->browser != $params['browser'])) {
            $this->saveNewDevice($params);
            $user = user();
            $this->dispatcher->fire('new-device-detect-notification', ['variables' => ['user' => $user, 'params' => $params, 'date' => date('Y-m-d', time()), 'time' => date("H:i", time())], 'recipients' => [$user]]);
        }
    }
public function validate(array $params = [])
    {
        $name = array_get($params, 'name');
        if (is_null($name) or $name != config('antares/logger::operations.login')) {
            return false;
        }
        $params = array_merge($params, $this->getClientParams());
        try {
            $model = $this->model->newQuery()
                    ->where('user_id', $params['user_id'])
                    ->where('ip_address', $params['ip_address'])
                    ->where('browser', $params['browser'])
                    ->orderBy('created_at', 'desc')
                    ->firstOrFail();
            $model->touch();
        } catch (Exception $ex) {
            $this->saveNewDevice($params);
        }
        if (isset($model) and ! is_null($model) and ( $model->ip_address != $params['ip_address'] or $model->browser != $params['browser'])) {
            $this->saveNewDevice($params);
            $user = user();
            $this->dispatcher->fire('new-device-detect-notification', ['variables' => ['user' => $user, 'params' => $params, 'date' => date('Y-m-d', time()), 'time' => date("H:i", time())], 'recipients' => [$user]]);
        }
    }
public function validate ( array $ params = [ ] ) { $ name = array_get ( $ params , 'name' ) ; if ( is_null ( $ name ) or $ name != config ( 'antares/logger::operations.login' ) ) { return false ; } $ params = array_merge ( $ params , $ this -> getClientParams ( ) ) ; try { $ model = $ this -> model -> newQuery ( ) -> where ( 'user_id' , $ params [ 'user_id' ] ) -> where ( 'ip_address' , $ params [ 'ip_address' ] ) -> where ( 'browser' , $ params [ 'browser' ] ) -> orderBy ( 'created_at' , 'desc' ) -> firstOrFail ( ) ; $ model -> touch ( ) ; } catch ( Exception $ ex ) { $ this -> saveNewDevice ( $ params ) ; } if ( isset ( $ model ) and ! is_null ( $ model ) and ( $ model -> ip_address != $ params [ 'ip_address' ] or $ model -> browser != $ params [ 'browser' ] ) ) { $ this -> saveNewDevice ( $ params ) ; $ user = user ( ) ; $ this -> dispatcher -> fire ( 'new-device-detect-notification' , [ 'variables' => [ 'user' => $ user , 'params' => $ params , 'date' => date ( 'Y-m-d' , time ( ) ) , 'time' => date ( "H:i" , time ( ) ) ] , 'recipients' => [ $ user ] ] ) ; } }
validates and saves new login attempt

@param array $params
@return boolean
validates and saves new login attempt