Exemplo n.º 1
0
 /**
  * Create an input if it doesn't exist.
  * @param $input array
  */
 protected function createIfNotExisting($input)
 {
     if (Input::where('name', $input['name'])->where('object', $input['object'])->exists()) {
         return;
     }
     $this->created[] = Input::create($input);
 }
Exemplo n.º 2
0
 /**
  * Create an input object from this field.
  * @return null|false|Input
  */
 public function createInput()
 {
     if (!$this->input) {
         return null;
     }
     if (Input::where('name', $this->name)->where('object', $this->blueprint->getClass())->exists()) {
         return false;
     }
     return Input::create($this->toInputArray());
 }
Exemplo n.º 3
0
 /**
  * Find inputs for this object and set the values.
  * @return Collection
  */
 public function inputs()
 {
     return $this->inputs = Input::retrieve($this);
 }
Exemplo n.º 4
0
 /**
  * Associate a model class this with table.
  * Loads the appropriate table headers and priorities.
  * Object title fields will display an edit link (pending user permissions)
  * @param string $class
  * @return $this|bool
  */
 public function setClass($class)
 {
     if (!class_exists($class)) {
         return false;
     }
     $this->class = $class;
     $inputs = Input::byObject($class);
     $inputs->each(function ($input) use($class) {
         if (!$input->in_table) {
             return;
         }
         // Create a link to edit the object.
         if ($input->isTitleField()) {
             $this->setFormatter($input->name, '\\Birdmin\\Formatters\\edit_model_link');
         }
         $this->setHeader($input->name, $input->label, $input->priority);
     });
     //        if ($config = $class::getConfig()) {
     //            $this->config(isset($config['table']) ? $config['table'] : array());
     //        }
     return $this;
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Input::blueprint()->dropSchema();
 }