Esempio n. 1
0
 public function __construct(Application $app)
 {
     parent::__construct($app);
     $args = ['subject' => $this];
     notify(__CLASS__ . '_Init', $args);
     notify(get_called_class() . '_Init', $args);
 }
 public function __construct()
 {
     parent::__construct(app());
     $this->pushCriteria(new ByBranchCriteria(request()))->scopeQuery(function ($query) {
         return $query->orderBy('lastname')->orderBy('firstname');
     });
 }
 /**
  * 更新
  *
  * @param array $input
  * @param       $id
  * @return bool
  * @throws GeneralException
  * @internal param $roles
  */
 public function update(array $input, $id)
 {
     if (parent::update($input, $id)) {
         return true;
     }
     throw new GeneralException('There was a problem updating this user. Please try again.');
 }
 public function __construct(SupplierRepo $supplierrepo, CompRepo $comprepo, CompledgerRepo $ledger)
 {
     parent::__construct(app());
     $this->supplier = $supplierrepo;
     $this->component = $comprepo;
     $this->ledger = $ledger;
 }
Esempio n. 5
0
 public function __construct(App $app, Collection $collection)
 {
     parent::__construct($app, $collection);
     $this->pushCriteria(new ByBranchCriteria(request()))->scopeQuery(function ($query) {
         return $query->orderBy('uploaddate', 'desc');
     });
 }
 public function delete($id)
 {
     try {
         return parent::delete($id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Cliente não encontrado.'];
     }
 }
Esempio n. 7
0
 public function __construct()
 {
     parent::__construct(app());
     //$this->pushCriteria(new ByBranchCriteria(request()));
     $this->scopeQuery(function ($query) {
         return $query->orderBy('comp', 'asc');
     });
 }
Esempio n. 8
0
 public function __construct(BBRepo $bbrepo, DailySales $dailysales, BranchRepository $branch)
 {
     parent::__construct(app());
     $this->bossbranch = $bbrepo;
     $this->bossbranch->pushCriteria(new BossBranchCriteria());
     $this->branch = new BranchRepository();
     $this->branch->pushCriteria(new ActiveBranch());
 }
 /**
  * @param array $attributes
  * @param $id
  * @return mixed
  */
 public function update(array $attributes, $id)
 {
     $role = $this->find($id);
     if ($attributes['display_name'] === $role->display_name) {
         unset($attributes['display_name']);
     }
     return parent::update($attributes, $id);
 }
Esempio n. 10
0
 public function __construct(EmployeeRepository $emprepo)
 {
     parent::__construct(app());
     $this->employees = $emprepo;
     $this->pushCriteria(new ByBranchCriteria(request()))->scopeQuery(function ($query) {
         return $query->orderBy('datetime', 'desc');
     });
 }
 public function find($id, $columns = array())
 {
     try {
         return parent::find($id);
     } catch (ModelNotFoundException $ex) {
         return ['success' => false, 'message' => "O id '" . $id . "' nao foi localizado!", 'error' => $ex->getMessage()];
     }
 }
 /**
  * Update attributes
  *
  * @param array $attributes
  * @param integer $id
  *
  * @return Model
  */
 public function update(array $attributes, $id)
 {
     $defaults = ["{$this->getRelationName()}" => []];
     $attributes = array_merge($defaults, $attributes);
     $model = parent::update($attributes, $id);
     $model->{$this->getShortRelationName()}()->sync($attributes["{$this->getRelationName()}"]);
     return $this->parserResult($model);
 }
Esempio n. 13
0
 /**
  * Save a new entity in repository
  *
  * @throws ValidatorException
  * @param array $attributes
  * @return mixed
  */
 public function createByAdmin(array $attributes)
 {
     parent::skipPresenter();
     $attributes['password_last_set'] = new Carbon();
     if (array_has($attributes, 'must_change_password')) {
         $attributes['password_last_set'] = null;
     }
     $user = parent::create($attributes);
     $this->updateProfile($attributes, $user['id']);
     return $user;
 }
 /**
  * @param array $attributes
  * @param $id
  * @return mixed
  */
 public function update(array $attributes, $id)
 {
     $user = $this->find($id);
     if ($user->email === $attributes['email']) {
         unset($attributes['email']);
     }
     $user = parent::update($attributes, $id);
     $this->updateRoles($user, $attributes);
     event(new UserWasUpdated($user, $attributes));
     return $this->parserResult($user);
 }
Esempio n. 15
0
 /**
  * Save a new entity in repository
  *
  * @throws ValidatorException
  * @param array $attributes
  * @return mixed
  */
 public function createByAdmin(array $attributes, $roles = null)
 {
     parent::skipPresenter();
     $attributes['password_last_set'] = new Carbon();
     if (array_has($attributes, 'must_change_password')) {
         $attributes['password_last_set'] = null;
     }
     $attributes['password'] = bcrypt($attributes['password']);
     $user = parent::create($attributes);
     $user->roles()->sync($roles);
     return $user;
 }
 public function delete($id)
 {
     try {
         $client = parent::find($id);
         parent::delete($id);
         return ['success' => true];
     } catch (ModelNotFoundException $ex) {
         return ['success' => false, 'message' => 'O id ' . $id . ' nao foi localizado!', 'error' => $ex->getMessage()];
     } catch (Exception $ex2) {
         return ['success' => false, 'message' => 'Erro ao excluir client: ' + $ex2 . getMessage(), 'error' => $ex2->getMessage()];
     }
 }
Esempio n. 17
0
 /**
  * Update attributes
  *
  * @param array $attributes
  * @param integer $id
  *
  * @return Model
  */
 public function update(array $attributes, $id)
 {
     $defaults = ['roles' => []];
     $attributes = array_merge($defaults, $attributes);
     $model = $this->find($id);
     if (!in_array('Esensi\\Model\\Contracts\\HashingModelInterface', class_implements($model))) {
         throw new Exception("User model must implement Esensi\\Model\\Contracts\\HashingModelInterface.\n                Revert to 0.3.* or see upgrade guide for details.");
     }
     if (!array_key_exists('password', $attributes)) {
         $model->fill($attributes);
         if (Config::get('entrust-gui.confirmable') === true) {
             $model->password_confirmation = $model->password;
         }
         $model->saveWithoutHashing();
     } else {
         $model = parent::update($attributes, $id);
     }
     $model->roles()->sync($attributes['roles']);
     return $this->parserResult($model);
 }
Esempio n. 18
0
 public function paginate($limit = null, $columns = array('*'))
 {
     $paginator = parent::paginate($limit, $columns);
     if ($this->with_relation_count) {
         $id = [];
         foreach ($paginator->items() as $item) {
             $id[] = $item->id;
         }
         foreach ($this->relations as $relation => $options) {
             $tmp = $this->getRelationRecordCount($relation, $relation)->whereIn('main.id', $id)->get()->all();
             $tmp2 = [];
             foreach ($options['fields'] as $field) {
                 foreach ($tmp as $record) {
                     $tmp2[$record->id] = $record->{$field};
                 }
                 foreach ($paginator->items() as &$item) {
                     $item[$field] = !empty($tmp2[$item->id]) ? $tmp2[$item->id] : 0;
                 }
             }
             unset($item);
         }
     }
     return $paginator;
 }
Esempio n. 19
0
 public function __construct(Container $app, $model = null)
 {
     $this->prepareModel($model);
     parent::__construct($app);
 }
Esempio n. 20
0
 public function __construct()
 {
     parent::__construct(app());
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return $this->repository->find($id);
 }
Esempio n. 22
0
 public function __construct(App $app, ByBranch $byBranch)
 {
     parent::__construct($app);
     $this->pushCriteria($byBranch);
 }
Esempio n. 23
0
 public function __construct(ExpenseRepo $expenserepo)
 {
     parent::__construct(app());
     $this->expense = $expenserepo;
 }
 public function __construct(Application $app)
 {
     parent::__construct($app);
 }
Esempio n. 25
0
 public function __construct(CompcatRepo $compcatrepo)
 {
     parent::__construct(app());
     $this->compcat = $compcatrepo;
 }
Esempio n. 26
0
 /**
  * Update a user by id
  *
  * @throws ValidatorException
  * @param array $attributes
  * @param $id
  * @return mixed
  */
 public function update(array $attributes, $id)
 {
     $attributes = $this->hashPassword($attributes);
     return parent::update($attributes, $id);
 }
Esempio n. 27
0
 /**
  * 删除菜单.
  *
  * @param $id
  */
 public function delete($id)
 {
     // 先删除子菜单
     $this->model->find($id)->subButtons()->delete();
     // 删除自身
     parent::delete($id);
 }
 /**
  * @param $id
  * @return array
  */
 public function destroy($id)
 {
     return ['data' => ['result' => $this->repository->delete($id)]];
 }
Esempio n. 29
0
 /**
  * Reset Model
  *
  * @return AbstractRepository
  * @throws RepositoryException
  */
 public function resetModel()
 {
     parent::resetModel();
     return $this;
 }
Esempio n. 30
0
 public function __construct()
 {
     parent::__construct(app());
     //$this->boots();
 }