/**
  * create name before creating a new role instance.
  *
  * @param array $data
  *
  * @return EloquentRole
  */
 public function create(array $data)
 {
     if (!array_key_exists('name', $data)) {
         $data['name'] = Str::slug($data['display_name']);
     }
     return parent::create($data);
 }
 /**
  * Encrypt password before updating a user instance.
  *
  * @param array $data
  *
  * @return EloquentUser
  */
 public function update(array $data, $id)
 {
     if (array_key_exists('password', $data)) {
         $data['password'] = bcrypt($data['password']);
     }
     return parent::update($data, $id);
 }
 public function find($id)
 {
     if ($this->elegantModel->hasExtension('translatable')) {
         return parent::find($id);
     } else {
         return $this->model->find($id);
     }
 }
 /**
  * Return all settings, with the setting name as key
  * @return array
  */
 public function all()
 {
     $rawSettings = parent::all();
     $settings = [];
     foreach ($rawSettings as $setting) {
         $settings[$setting->name] = $setting;
     }
     return $settings;
 }