Пример #1
0
 public function __construct(array $attributes = array())
 {
     $this->hasAttachedFile('documentation');
     $this->hasAttachedFile('instruction');
     $this->hasAttachedFile('certificate');
     parent::__construct($attributes);
 }
Пример #2
0
 public function __construct(array $attributes = array())
 {
     $url = '/system/:attachment/security_tips/:id_partition/:style/:filename';
     $this->hasAttachedFile('preview', ['styles' => ['medium' => ['dimensions' => '214x214#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]], 'small' => ['dimensions' => '100x100#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]]], 'url' => $url]);
     $this->attachImage('photo_preview_for_main', '400x250#', $url);
     parent::__construct($attributes);
 }
Пример #3
0
 /**
  * Creates a new instance of the model
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
 }
Пример #4
0
 public function delete()
 {
     $id = $this->id;
     if (!parent::delete()) {
         return false;
     }
     return !$this->find($id) ? true : false;
 }
Пример #5
0
 /**
  * Creates a new instance of the model
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if (!static::$app) {
         static::$app = app();
     }
     $this->table = static::$app['config']->get('workflow::flows_table');
 }
Пример #6
0
 /**
  * Handle dynamic method calls into the method.
  *
  * @param  string  $method
  * @param  array   $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     // Handle the automatic ordering of query results.
     if ($this->automaticallyOrder and !in_array($method, $this->ignoredOrderMethods)) {
         return $this->scopeOrder($this->newQuery());
     }
     // Handle the default Eloquent model __call
     return parent::__call($method, $parameters);
 }
 public function getAttributes()
 {
     $data = parent::getAttributes();
     if ($this->translatedAttributes) {
         foreach ($this->translatedAttributes as $field) {
             $data[$field] = $this->{$field};
         }
     }
     return $data;
 }
Пример #8
0
 public static function all($columns = array())
 {
     if (Cache::has('config:all')) {
         return Cache::get('config:all');
     } else {
         $all = parent::all();
         return Cache::rememberForever('config:all', function () use($all) {
             return $all;
         });
     }
 }
Пример #9
0
 public function __construct(array $attributes = array())
 {
     $url = '/system/:attachment/works/:id_partition/:style/:filename';
     $this->hasAttachedFile('preview', ['styles' => ['medium' => ['dimensions' => '214x214#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]], 'small' => ['dimensions' => '100x100#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]]], 'url' => $url]);
     // мб добавить аргумент ['medium' => '416x214#', 'small' => '100x100#'] и вынести в trait
     $this->attachImage('photo_preview_for_main', '400x250#', $url);
     $this->attachImage('big_preview', '416x214#', $url);
     $this->attachImage('main_photo', '810x457#', $url);
     $this->attachImage('second_photo', '400x214#', $url);
     $this->attachImage('third_photo', '400x214#', $url);
     $this->attachImage('client_photo', '214x214#', $url);
     parent::__construct($attributes);
 }
Пример #10
0
 /**
  * Overwrites the original save method 
  * @return User object
  */
 public function save(array $rules = array(), array $customMessages = array(), array $options = array(), \Closure $beforeSave = null, \Closure $afterSave = null)
 {
     $id = $this->getKey();
     if (empty($id)) {
         $this->confirmation_code = md5(uniqid(mt_rand(), true));
     }
     // If it doesn't retrieve rules, so validation on Ardent fails
     if (!empty($this->remember_token) && empty($rules)) {
         $rules = static::$rules;
         $rules = array_diff(array_keys($rules), array('password_confirmation'));
     }
     $status = parent::save($rules, $customMessages, $options, $beforeSave, $afterSave);
     if ($this->errors()->isEmpty() && !$this->confirmed && \Config::get('laravel-helpers::auth.signup_email') == true) {
         $user = $this;
         //TODO use Mail::queue o Mail::queueOn
         Mail::send(Config::get('laravel-helpers::auth.email_view_account_confirmation'), compact('user'), function ($message) use($user) {
             $message->to($user->email)->subject(Lang::get('laravel-helpers::auth.email.account_confirmation.subject'));
         });
     }
     return $status;
 }
Пример #11
0
 public function delete()
 {
     $this->clearTaggedCaches();
     return parent::delete();
     // TODO: Change the autogenerated stub
 }
Пример #12
0
 public function __construct(array $attributes = array())
 {
     $this->hasAttachedFile('photo', ['styles' => ['medium' => '300x300#', 'thumb' => '80x80#'], 'default_url' => '/system/missing.jpg', 'keep_old_files' => true]);
     parent::__construct($attributes);
 }
Пример #13
0
 /**
  *  Cascade delete songs
  */
 public function delete()
 {
     $this->songs()->delete();
     return parent::delete();
 }
 /**
  * Creates a new instance of the model
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->table = Config::get('entrust::permissions_table');
 }
Пример #15
0
 public function __construct(array $attributes = array())
 {
     $this->hasAttachedFile('picture', ['styles' => ['medium' => '300x300', 'thumb' => '100x100'], 'default_url' => 'missing-material.jpg']);
     parent::__construct($attributes);
 }
Пример #16
0
 /**
  * Runs the real eloquent save method or returns
  * true if it's under testing. Because Eloquent
  * and Ardent save methods are not Confide's
  * responsibility.
  *
  * @param array $rules
  * @param array $customMessages
  * @param array $options
  * @param \Closure $beforeSave
  * @param \Closure $afterSave
  * @return bool
  */
 protected function real_save(array $rules = array(), array $customMessages = array(), array $options = array(), \Closure $beforeSave = null, \Closure $afterSave = null)
 {
     if (defined('CONFIDE_TEST')) {
         $this->beforeSave();
         $this->afterSave(true);
         return true;
     } else {
         /*
          * This will make sure that a non modified password
          * will not trigger validation error.
          * @fixed Pull #110
          */
         if (isset($rules['password']) && $this->password == $this->getOriginal('password')) {
             unset($rules['password']);
             unset($rules['password_confirmation']);
         }
         return parent::save($rules, $customMessages, $options, $beforeSave, $afterSave);
     }
 }
Пример #17
0
 /**
  * Create a new Eloquent model instance.
  *
  * @param  array  $attributes
  * @return void
  */
 public function __construct(array $attributes = array())
 {
     $this->{$this->getKeyName()} = (string) $this->generateNewId();
     parent::__construct($attributes);
 }
Пример #18
0
 /**
  * Creates a new instance of the model
  */
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->table = Config::get('workflow::resourcelog_table');
 }
Пример #19
0
 public function __construct(array $attributes = array())
 {
     $this->hasAttachedFile('img', ['styles' => ['medium' => ['dimensions' => '214x214#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]], 'small' => ['dimensions' => '100x100#', 'auto-orient' => true, 'convert_options' => ['quality' => 100]]], 'url' => '/system/:attachment/:model/:id_partition/:style/:filename']);
     parent::__construct($attributes);
 }