AdamWathan\Form\ErrorStore\IlluminateErrorStore::hasError PHP Method

hasError() public method

public hasError ( $key )
    public function hasError($key)
    {
        if (!$this->hasErrors()) {
            return false;
        }
        $key = $this->transformKey($key);
        return $this->getErrors()->has($key);
    }

Usage Example

 public function test_it_converts_array_keys_to_dot_notation()
 {
     $errors = new MessageBag(array('foo.bar' => 'Some error'));
     $session = Mockery::mock('Illuminate\\Session\\Store');
     $session->shouldReceive('has')->with('errors')->andReturn(true);
     $session->shouldReceive('get')->with('errors')->andReturn($errors);
     $errorStore = new IlluminateErrorStore($session);
     $this->assertTrue($errorStore->hasError('foo[bar]'));
 }