public function testCompanyName() { $this->assertEquals('JOHND', Contact::find(1)->reference); $exitCode = Artisan::call('contact:edit', ['id' => '1', '--reference' => 'New reference']); $this->assertEquals($exitCode, 0); $this->assertContains('The contact has been updated', Artisan::output()); $contact = Contact::find(1); $this->assertEquals('New reference', $contact->reference); $contact->reference = 'JOHND'; $contact->save(); }
/** * {@inheritdoc}. */ protected function handleOptions($model) { $this->updateFieldWithOption($model, 'name'); if ($this->option('contact_id')) { if (null === Contact::find($this->option('contact_id'))) { $this->error('Unable to find contact with this criteria'); return false; } } $this->updateFieldWithOption($model, 'contact_id'); $this->updateBooleanFieldWithOption($model, 'enabled'); return true; }
/** * {@inheritdoc}. */ protected function getModelFromRequest() { return Contact::find($this->argument('id')); }
/** * {@inheritdoc}. */ protected function getObjectByArguments() { return Contact::find($this->argument('id')); }