php - Adding a select for foreign key object serverfireteam/panel -


i'm using serverfireteam laravelpanel (which uses zofe/rapyd-laravel ). created crud controller entity. entity has foreign key table. want show autocomplete foreign key shows empty selectbox.

my controller code this:

 public function  edit($entity){      parent::edit($entity);     $this->edit = \dataedit::source(new \app\regal());     $this->edit->add('bezeichnung', 'bezeichnung','text');     $this->edit->add('nummer', 'nummer','text');     $this->edit->add('maxpaletten', 'max paletten je ebene','text');     $this->edit->add('anzahlebenen', 'anzahl ebenen','text');      $this->edit->add('kunde_id','kunde','select')->options(\app\kunde::lists("name", "id"));       return \view::make('regale.editpanel', array(         'title'          => $this->entity ,          'edit' => $this->edit         ));    }     

and model files:

class kunde extends model {  protected $table = 'kunden'; public function listpaletten(){     return $this->hasmany('app\models\palette'); } public function listadressen(){     return $this->hasmany('app\models\adresse'); } public function listregale(){     return $this->hasmany('app\models\regal'); } public function listartikel(){     return $this->hasmany('app\models\artikel'); } } 

..

class regal extends model {  protected $table = 'regale';  public function kunde(){     return $this->belongsto('app\models\kunde');         } } 

you using options method, options method used selectbox .

as explained in document :

autocomplete (input field autocomplete feature using twitter typeahead , ajax features using relation.fieldname , search() method )

$this->edit->add('author.fullname', 'author', 'autocomplete')->search(array('firstname', 'lastname')); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -