Created
February 11, 2017 16:26
-
-
Save calina-c/1d0bdfb063999237072f617310e27f02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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