Beispiel #1
0
 public static function create(array $data = array())
 {
     $container = new Container();
     $container->fill($data);
     $container->save();
     $element = new Element();
     $element->fill($data);
     $container->content()->save($element);
 }
Beispiel #2
0
 public static function getLatests()
 {
     $plugins = ORM::for_table('market_plugins')->where('status', 2)->limit(10);
     Container::get('hooks')->fireDB('model.plugins.getLatest', $plugins);
     $plugins = $plugins->find_many();
     return $plugins;
 }
 public function search($input)
 {
     $query = Container::query();
     $columns = Schema::getColumnListing('containers');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
 /**
  * Show the form for editing the specified Container.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $container = $this->containerRepository->find($id);
     if (empty($container)) {
         Flash::error('Container not found');
         return redirect(route('containers.index'));
     }
     $container->name = $container->content->name;
     $container->identifier = $container->content->identifier;
     $container->description = $container->content->description;
     $container->container_id = $container->content->container_id;
     $datas = Model::all();
     $containers = array();
     foreach ($datas as $data) {
         if ($data->content) {
             $containers[$data->content->id] = $data->content->identifier;
         }
     }
     return view('containers.edit', compact('containers'))->with('container', $container);
 }