App\Services\Form\Server\ServerForm::save PHP Метод

save() публичный Метод

Create a new server.
public save ( array $input ) : boolean
$input array Data to create a server
Результат boolean
    public function save(array $input)
    {
        if (!$this->valid($input)) {
            return false;
        }
        return $this->server->create($input);
    }

Usage Example

Пример #1
0
 public function test_Should_FailToSave_When_ValidationFails()
 {
     $this->mockValidator->shouldReceive('with')->once()->andReturn($this->mockValidator);
     $this->mockValidator->shouldReceive('passes')->once()->andReturn(false);
     $form = new ServerForm($this->mockValidator, $this->mockServerRepository);
     $result = $form->save([]);
     $this->assertFalse($result, 'Expected save to fail.');
 }