Skip to content

Instantly share code, notes, and snippets.

@calina-c
Created February 11, 2017 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calina-c/1d0bdfb063999237072f617310e27f02 to your computer and use it in GitHub Desktop.
Save calina-c/1d0bdfb063999237072f617310e27f02 to your computer and use it in GitHub Desktop.
<?php
namespace App\Forms\Entities;
use App\Forms\YamlConfigForm as Form;
use App\Models\Agency;
use App\Models\Service;
class ServiceForm extends Form
{
public function getModelClass()
{
return Service::class;
}
public function buildForm()
{
$data = $this->getRequest();
parent::buildForm();
$this->addBefore('Type', 'AgencyId', 'static', [
'value' => function ($value) use ($data) {
return $value ? Agency::find($value)->Name : null;
}
])
;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment