public function get($identifier, $default = '') { $definition = \DefinitionDriver::getByIdentifier($identifier); if (!$definition) { return $default; } if (!$definition->{$definition->type}) { if ($definition->type == 'image') { if ($default) { $parts = explode('x', $default); return $this->getDefaultImage($parts[0], $parts[1]); } } return $default; } return $definition->{$definition->type}; }
public function index() { $definitions = \DefinitionDriver::all('site', \Input::get('tag')); return $definitions; }
public function setupDefinitions() { $this->info('Setting up definitions'); $definition = ['identifier' => 'email_from_email', 'description' => '"From" email address', 'type' => 'string', 'string' => '*****@*****.**', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } $definition = ['identifier' => 'email_from_name', 'description' => '"From" email address alias', 'type' => 'string', 'string' => 'CMS', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } $definition = ['identifier' => 'mailgun_domain', 'description' => 'Mailgun API domain', 'type' => 'string', 'string' => '', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } $definition = ['identifier' => 'mailgun_secret', 'description' => 'Mailgun API secret', 'type' => 'string', 'string' => '', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } $definition = ['identifier' => 'head', 'description' => 'Extra HTML in head tag. Add scripts and styles here', 'type' => 'code', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } $definition = ['identifier' => 'angular_extensions', 'description' => 'Angular required modules', 'type' => 'code', 'tag' => 'dev', 'editable' => false, 'hidden' => true]; try { \DefinitionDriver::store($definition); } catch (\Exception $e) { $this->error('Error creating the definition: "' . $e->getMessage() . '"'); } }
public function destroy($id) { \DefinitionDriver::delete($id); return \Redirect::route('dev.definitions.index'); }