示例#1
0
 public function getAuthorlist()
 {
     //needed only by latest autocomplete
     return Author::where("firstname", "like", Input::get("q") . "%")->orWhere("lastname", "like", Input::get("q") . "%")->take(10)->get();
 }
 public function getAuthorlist()
 {
     //needed only if you want a custom remote ajax call for a custom search
     return Author::where("firstname", "like", Input::get("q") . "%")->orWhere("lastname", "like", Input::get("q") . "%")->take(10)->get();
 }
 public function anyForm()
 {
     $form = DataForm::source(Article::find(37));
     $form->add('title', 'Title', 'text')->rule('required|min:5');
     $form->add('body', 'Body', 'redactor');
     //belongs to
     $form->add('author_id', 'Author', 'select')->options(Author::lists('firstname', 'id'));
     //belongs to many (field name must be the relation name)
     $form->add('categories', 'Categories', 'checkboxgroup')->options(Category::lists('name', 'id'));
     //$form->add('photo','Photo', 'image')->moveDeferred('uploads/demo/{{ $id }}')->fit(210, 160)->preview(120,80);
     $form->add('detail.note', 'Note', 'file')->moveDeferred('uploads/demo/{{ $id }}');
     $form->add('public', 'Public', 'checkbox');
     $form->submit('Save');
     $form->saved(function () use($form) {
         $form->message("ok record saved");
         $form->link("/test/form", "back to the form");
     });
     return View::make('rapyd::demo.form', compact('form'));
 }