Example #1
1
 protected function makeResponse(Request $request)
 {
     $message = $this->translator->get('c::auth.login-required');
     if ($request->ajax() || $request->isJson() || $request->wantsJson()) {
         return Response::json(['error' => $message], 403);
     } else {
         $url = $this->url->action('anlutro\\Core\\Web\\AuthController@login');
         $intended = $request->getMethod() == 'GET' ? $request->fullUrl() : ($request->header('referer') ?: '/');
         $this->session->put('url.intended', $intended);
         return $this->redirect->to($url)->with('error', $message);
     }
 }
Example #2
0
 /**
  * Calculate age for given timestamp(s)
  *
  * @param  mixed $timestamp1  accepts string, unix-timestamp and DateTime object
  * @param  mixed $timestamp2  accepts string, unix-timestamp and DateTime object
  * @param  string $unit       constraint output to a given unit
  * @return string
  */
 public function age($timestamp1, $timestamp2 = null, $unit = null)
 {
     $timestamp1 = is_numeric($timestamp1) ? '@' . intval($timestamp1) : $timestamp1;
     $timestamp1 = is_a($timestamp1, 'DateTime') ? $timestamp1 : new DateTime($timestamp1);
     $timestamp2 = is_numeric($timestamp2) ? '@' . intval($timestamp2) : $timestamp2;
     $timestamp2 = is_a($timestamp2, 'DateTime') ? $timestamp2 : new DateTime($timestamp2);
     if ($timestamp1 == $timestamp2) {
         return $this->translator->get($this->getTranslationKey('date.n0w'));
     }
     $diff = $timestamp1->diff($timestamp2);
     $total = array('year' => $diff->y, 'month' => $diff->m + $diff->y * 12, 'week' => floor($diff->days / 7), 'day' => $diff->days, 'hour' => $diff->h + $diff->days * 24, 'minute' => $diff->h + $diff->i + $diff->days * 24 * 60, 'second' => $diff->h + $diff->i + $diff->s + $diff->days * 24 * 60 * 60);
     if (is_null($unit)) {
         foreach ($total as $key => $value) {
             if ($value > 0) {
                 $lang_key = 'date.' . $key . '_choice';
                 $lang_key = $this->getTranslationKey($lang_key);
                 $unit = $this->translator->choice($lang_key, $value);
                 return $value . ' ' . $unit;
             }
         }
     } elseif (array_key_exists($unit, $total)) {
         $value = $total[$unit];
         $lang_key = 'date.' . $unit . '_choice';
         $lang_key = $this->getTranslationKey($lang_key);
         $unit = $this->translator->choice($lang_key, $value);
         return $value . ' ' . $unit;
     }
     throw new \InvalidArgumentException('Invalid argument in function call');
 }
 public function __construct(DatabaseManager $DB, AuthenticationManagementInterface $AuthenticationManager, Translator $Lang)
 {
     $this->DB = $DB;
     $this->AuthenticationManager = $AuthenticationManager;
     /*
     $this->Database = $DB->table('ACCT_Journal_Entry AS je')
     						->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')
     						->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')
     						->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')
     						->where(function($query)
     		                {
     		                  $query->orWhere('jv.status', '=', 'B');
     		                  $query->orWhereNull('jv.status');
     		                }
     						)
     						->where('c.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())
     						->whereIn('at.pl_bs_category', array('B', 'C'))
     						->whereNull('je.deleted_at')
     						->whereNull('jv.deleted_at');
     */
     $this->Database = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where('jv.status', '=', 'B')->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->where('c.is_group', '=', 0)->whereIn('at.pl_bs_category', array('B', 'C'))->whereNull('je.deleted_at')->whereNull('jv.deleted_at');
     $this->Database2 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Account AS c')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where('c.is_group', '=', 1)->where('c.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereIn('at.pl_bs_category', array('B', 'C'))->select(array($DB->raw('0 AS acct_pl_debit'), $DB->raw('0 AS acct_pl_credit'), 'c.id AS acct_pl_account_id', 'c.parent_account_id AS acct_pl_parent_account_id', 'c.key AS acct_pl_account_key', 'c.name AS acct_pl_account_name', 'c.is_group AS acct_pl_is_group', 'c.balance_type AS acct_pl_balance_type', $DB->raw('CASE at.pl_bs_category WHEN "B" THEN "' . $Lang->get('decima-accounting::profit-and-loss.income') . '" ELSE "' . $Lang->get('decima-accounting::profit-and-loss.expenses') . '" END AS acct_pl_pl_bs_category'), $DB->raw('0 AS acct_pl_balance')));
     $this->visibleColumns = array($DB->raw('IFNULL(SUM(je.debit),0) AS acct_pl_debit'), $DB->raw('IFNULL(SUM(je.credit),0) AS acct_pl_credit'), 'c.id AS acct_pl_account_id', 'c.parent_account_id AS acct_pl_parent_account_id', 'c.key AS acct_pl_account_key', 'c.name AS acct_pl_account_name', 'c.is_group AS acct_pl_is_group', 'c.balance_type AS acct_pl_balance_type', $DB->raw('CASE at.pl_bs_category WHEN "B" THEN "' . $Lang->get('decima-accounting::profit-and-loss.income') . '" ELSE "' . $Lang->get('decima-accounting::profit-and-loss.expenses') . '" END AS acct_pl_pl_bs_category'), $DB->raw('0 AS acct_pl_balance'));
     $this->orderBy = array(array('acct_pl_account_key', 'asc'));
 }
Example #4
0
 /**
  * Render the likes into a string.
  *
  * @param Collection $likesCollection  The likes to render.
  *
  * @param string     $viewAllLikesLink The link to view all of the likes for the content.
  *
  * @return string
  */
 public function render(Collection $likesCollection, $viewAllLikesLink)
 {
     $numLikesToList = $this->settings->get('posts.likes_to_show', 3);
     $numOtherLikes = $likesCollection->count() - $numLikesToList;
     $userId = $this->guard->user()->getAuthIdentifier();
     $likes = [];
     $likesCollection = $likesCollection->filter(function (Like $like) use(&$likes, &$numLikesToList, $userId) {
         if ($like->user->id === $userId) {
             $like->user->name = $this->lang->get('likes.current_user');
             $likes[] = $like;
             $numLikesToList--;
             return false;
         }
         return true;
     });
     $numLikesInCollection = $likesCollection->count();
     if ($numLikesInCollection > 0 && $numLikesToList > 0) {
         if ($numLikesInCollection < $numLikesToList) {
             $numLikesToList = $numLikesInCollection;
         }
         $randomLikes = $likesCollection->random($numLikesToList);
         if (!is_array($randomLikes)) {
             // random returns a single model if $numLikesToList is 1...
             $randomLikes = array($randomLikes);
         }
         foreach ($randomLikes as $key => $like) {
             $likes[] = $like;
         }
     }
     return $this->viewFactory->make('likes.list', compact('numOtherLikes', 'likes', 'viewAllLikesLink'))->render();
 }
 /**
  * @param \Illuminate\Translation\Translator         $translator
  * @param \Illuminate\Routing\Router                 $router
  * @param \Illuminate\Contracts\Routing\UrlGenerator $urlGenerator
  */
 public function __construct(Translator $translator, Router $router, UrlGenerator $urlGenerator)
 {
     $this->translator = $translator;
     $this->router = $router;
     $this->urlGenerator = $urlGenerator;
     // Unfortunately we can't do this in the service provider since routes are booted first
     $this->translator->addNamespace('paginateroute', __DIR__ . '/../resources/lang');
     $this->pageKeyword = $this->translator->get('paginateroute::paginateroute.page');
 }
 public function update()
 {
     $roles = $this->request->get('roles', []);
     try {
         $this->execute('Pardisan\\Commands\\Permission\\PermRoleCommand', ['roles' => $roles]);
         return $this->redirectRoute('admin.permissions.index')->with('success_message', $this->lang->get('messages.permissions.update_success'));
     } catch (RepositoryException $e) {
         return $this->redirectBack()->with('error_message', $this->lang->get('messages.repository_error'));
     }
 }
 public function __construct(DatabaseManager $DB, AuthenticationManagementInterface $AuthenticationManager, Translator $Lang)
 {
     // $this->DB = $DB;
     // $this->DB->connection()->enableQueryLog();
     $this->Database = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Account AS a')->leftJoin('ACCT_Account AS ap', 'ap.id', '=', 'a.parent_account_id')->join('ACCT_Account_Type AS at', 'at.id', '=', 'a.account_type_id')->where('a.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereNull('a.deleted_at');
     $this->visibleColumns = array('a.id AS acct_am_id', 'a.key as acct_am_key', 'a.name as acct_am_name', 'a.balance_type as acct_am_balance_type', 'a.is_group as acct_am_is_group', 'a.account_type_id as acct_am_account_type_id', 'at.name as acct_am_account_type', 'ap.id as acct_am_parent_account_id', 'ap.key as acct_am_parent_key', 'ap.name as acct_am_parent_account', $DB->raw('CASE a.balance_type WHEN "D" THEN "' . $Lang->get('decima-accounting::account-management.D') . '" ELSE "' . $Lang->get('decima-accounting::account-management.A') . '" END AS acct_am_balance_type_name'), $DB->raw('CASE a.is_group WHEN 1 THEN 0 ELSE 1 END AS acct_am_is_leaf'));
     $this->orderBy = array(array('acct_am_key', 'asc'));
     $this->treeGrid = true;
     $this->parentColumn = 'ap.id';
     $this->leafColumn = 'acct_am_is_leaf';
 }
 /**
  * Renders the age gate view
  */
 public function agegate()
 {
     $previousTooYoung = $this->session->get('laravel-avp.previous_too_young');
     $view = view(config('agegate.view'))->with(compact('previousTooYoung'));
     if (!$this->session->has('errors') && $previousTooYoung) {
         $messages = $this->lang->get('laravel-avp::validation.custom');
         $errorMsg = $messages['dob.previous'];
         $view->withErrors(['dob' => [$errorMsg]]);
     }
     return $view;
 }
 public function __construct(DatabaseManager $DB, AuthenticationManagementInterface $AuthenticationManager, AccountManagementInterface $AccountManager, Translator $Lang, Carbon $Carbon)
 {
     $this->DB = $DB;
     $this->AccountManager = $AccountManager;
     $this->AuthenticationManager = $AuthenticationManager;
     $this->Carbon = $Carbon;
     $this->Database = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->join('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->where('c.is_group', '=', 0)->whereNull('je.deleted_at')->whereNull('jv.deleted_at')->select(array($DB->raw('IFNULL(SUM(je.debit),0) AS acct_gl_debit'), $DB->raw('IFNULL(SUM(je.credit),0) AS acct_gl_credit'), 'c.id AS acct_gl_account_id', 'c.parent_account_id AS acct_gl_parent_account_id', 'c.key AS acct_gl_account_key', 'c.name AS acct_gl_account_name', 'c.is_group AS acct_gl_is_group', 'c.balance_type AS acct_gl_balance_type', $DB->raw('0 AS acct_gl_total_debit'), $DB->raw('0 AS acct_gl_total_credit'), $DB->raw('0 AS acct_gl_opening_balance'), $DB->raw('0 AS acct_gl_closing_balance'), $DB->raw('\'\' AS acct_gl_voucher_date'), $DB->raw('\'\' AS acct_gl_voucher_type'), $DB->raw('\'\' AS acct_gl_voucher_number')));
     $this->Database2 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Account AS c')->where('c.is_group', '=', 1)->where('c.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->select(array($DB->raw('0 AS acct_gl_debit'), $DB->raw('0 AS acct_gl_credit'), 'c.id AS acct_gl_account_id', 'c.parent_account_id AS acct_gl_parent_account_id', 'c.key AS acct_gl_account_key', 'c.name AS acct_gl_account_name', 'c.is_group AS acct_gl_is_group', 'c.balance_type AS acct_gl_balance_type', $DB->raw('0 AS acct_gl_total_debit'), $DB->raw('0 AS acct_gl_total_credit'), $DB->raw('0 AS acct_gl_opening_balance'), $DB->raw('0 AS acct_gl_closing_balance'), $DB->raw('\'\' AS acct_gl_voucher_date'), $DB->raw('\'\' AS acct_gl_voucher_type'), $DB->raw('\'\' AS acct_gl_voucher_number')));
     $this->Database3 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->join('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->where('c.is_group', '=', 0)->whereNull('je.deleted_at')->whereNull('jv.deleted_at')->select(array($DB->raw('0 AS acct_gl_debit'), $DB->raw('0 AS acct_gl_credit'), 'c.id AS acct_gl_account_id', 'c.parent_account_id AS acct_gl_parent_account_id', 'c.key AS acct_gl_account_key', 'c.name AS acct_gl_account_name', 'c.is_group AS acct_gl_is_group', 'c.balance_type AS acct_gl_balance_type', $DB->raw('IFNULL(SUM(je.debit),0) AS acct_gl_total_credit'), $DB->raw('IFNULL(SUM(je.credit),0) AS acct_gl_total_credit'), $DB->raw('0 AS acct_gl_opening_balance'), $DB->raw('0 AS acct_gl_closing_balance'), $DB->raw('\'\' AS acct_gl_voucher_date'), $DB->raw('\'\' AS acct_gl_voucher_type'), $DB->raw('\'\' AS acct_gl_voucher_number')));
     $this->Database4 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->join('ACCT_Voucher_Type AS vt', 'vt.id', '=', 'jv.voucher_type_id')->join('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->where('c.is_group', '=', 0)->whereNull('je.deleted_at')->whereNull('jv.deleted_at')->select(array($DB->raw('je.debit AS acct_gl_debit'), $DB->raw('je.credit AS acct_gl_credit'), 'c.id AS acct_gl_account_id', 'c.parent_account_id AS acct_gl_parent_account_id', $DB->raw('IFNULL(jv.manual_reference,"' . $Lang->get('decima-accounting::journal-management.noRef') . '") AS acct_gl_account_key'), 'jv.remark AS acct_gl_account_name', 'c.is_group AS acct_gl_is_group', 'c.balance_type AS acct_gl_balance_type', $DB->raw('0 AS acct_gl_total_debit'), $DB->raw('0 AS acct_gl_total_credit'), $DB->raw('0 AS acct_gl_opening_balance'), $DB->raw('0 AS acct_gl_closing_balance'), $DB->raw('DATE_FORMAT(jv.date, "' . $Lang->get('form.mysqlDateFormat') . '") AS acct_gl_voucher_date'), $DB->raw('vt.name AS acct_gl_voucher_type'), $DB->raw('jv.number AS acct_gl_voucher_number')));
     $this->orderBy = array(array('acct_gl_account_key', 'asc'));
 }
Example #10
0
 public function trans($id, array $parameters = [], $domain = 'messages', $locale = null)
 {
     $id = "{$domain}.{$id}";
     $message = $this->translator->get($id, $parameters, $locale);
     if ($message == $id) {
         $message = str_replace($domain . ".", "", $message);
         foreach ($parameters as $key => $value) {
             $message = str_replace(':' . $key, $value, $message);
         }
     }
     return $message;
 }
Example #11
0
 /**
  * Get localized name of zodiac sign
  *
  * @return string
  */
 public function localized()
 {
     if (!is_a($this->translator, 'Illuminate\\Translation\\Translator')) {
         return "zodiacs.{$this->name}";
     }
     if ($this->translator->has("zodiacs.{$this->name}")) {
         // return error message from validation translation file
         return $this->translator->get("zodiacs.{$this->name}");
     }
     // return packages default message
     return $this->translator->get("zodiacs::zodiacs.{$this->name}");
 }
Example #12
0
 /**
  * @param SigninRequest $request
  * @param Translator $lang
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(SignInRequest $request, Translator $lang)
 {
     $credentials = $request->except('_token', 'remember_me');
     $remember_me = $request->has('remember_me') ? true : false;
     $response = $this->dispatch(new Signin($credentials, $remember_me));
     if ($response instanceof User) {
         return redirect('admin/start');
     } elseif (is_string($response) && $response == 'unconfirmed') {
         $route = store_route('store.auth.confirm-email.create', ['email' => $credentials['email']]);
         $error = $lang->get('users::auth.errors.unconfirmed', ['url' => $route]);
         return redirect()->back()->withErrors(['email' => $error]);
     }
     return redirect()->back()->withErrors(['email' => $lang->get('users::auth.errors.failed')]);
 }
Example #13
0
 /**
  * @return string
  */
 public function last_page()
 {
     $lang = null;
     $collection = $this->router->getRoutes();
     $route = $collection->match(Request::create($this->wrappedObject->last_page));
     if ($route->getName() != null) {
         $langOptions = $this->getWioData($route->getName(), $route->parameters());
         if (!isset($langOptions['url'])) {
             $langOptions['url'] = route($route->getName(), $route->parameters());
         }
         if (!isset($langOptions['langString'])) {
             $langString = 'online.' . $route->getName();
         } else {
             $langString = 'online.' . $langOptions['langString'];
             unset($langOptions['langString']);
         }
         $lang = $this->translator->get($langString, $langOptions);
         // May happen if we have two routes 'xy.yx.zz' and 'xy.yx'
         if (is_array($lang)) {
             $lang = $this->translator->get($langString . '.index', $langOptions);
         }
     }
     if ($lang == null) {
         //			$lang = Lang::get('online.unknown', ['url' => '']);
         // Used for debugging, should be left here until we have added all routes
         $lang = 'online.' . $route->getName();
     }
     return $lang;
 }
Example #14
0
 private function shareTitle()
 {
     $langKey = "titles.{$this->router->currentRouteName()}";
     if ($this->lang->has($langKey)) {
         $this->view->share('title', $this->lang->get($langKey));
     }
 }
Example #15
0
 /**
  * Get the translation for the given key.
  *
  * @param  string  $key
  * @param  array   $replace
  * @param  string  $locale
  * @param  bool    $wrap
  *
  * @return string
  */
 public function get($key, array $replace = array(), $locale = null, $wrap = true)
 {
     if (!Lari18n::isActivated() || !$wrap) {
         return parent::get($key, $replace, $locale);
     }
     return $this->lari18n->wrap(parent::get($key, $replace, $locale), $key, $replace, $locale);
 }
Example #16
0
 /**
  * Get the translated level.
  *
  * @param  string       $key
  * @param  string|null  $locale
  *
  * @return string
  */
 public function get($key, $locale = null)
 {
     if (is_null($locale) || $locale === 'auto') {
         $locale = $this->getLocale();
     }
     return $this->translator->get("log-viewer::levels.{$key}", [], $locale);
 }
 /**
  * tries to translate the message if existing, otherwise returns the original message string
  *
  * @param string $message
  * @return string
  */
 private function translateMessage($message)
 {
     if ($this->translator->has($message)) {
         return $this->translator->get($message);
     }
     return $message;
 }
 public function get($key, array $replace = array(), $locale = null)
 {
     $cached = Cache::remember($key, 15, function () use($key, $replace, $locale) {
         return parent::get($key, $replace, $locale);
     });
     return $cached;
 }
Example #19
0
 public function postReset()
 {
     $credentials = $this->request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->password->reset($credentials, function ($user, $password) {
         $user->password = $this->hasher->make($password);
         $user->save();
     });
     switch ($response) {
         case $this->password->INVALID_PASSWORD:
         case $this->password->INVALID_TOKEN:
         case $this->password->INVALID_USER:
             return $this->redirector->back()->with('error', $this->translator->get($response));
         case $this->password->PASSWORD_RESET:
             return $this->redirector->to('/');
     }
 }
Example #20
0
 /**
  * Translate a level.
  *
  * @param  string       $level
  * @param  string|null  $locale
  *
  * @return string
  */
 private function getTranslatedName($level, $locale)
 {
     if ($locale === 'auto') {
         $locale = null;
     }
     return $this->translator->get('log-viewer::levels.' . $level, [], $locale);
 }
Example #21
0
 /**
  * Attempts to translate texts if the translator component is set and the
  * lang key is found, otherwise returns the original text.
  *
  * @param $text
  * @param array $parameters
  * @return string
  */
 public function translate($text, $parameters = array())
 {
     if (!is_null($this->lang)) {
         return $this->lang->get($text, $parameters);
     }
     return $text;
 }
Example #22
0
 /**
  * Get the translation for the given key.
  *
  * @param  string  $key
  * @param  array   $replace
  * @param  string  $locale
  * @param  bool  $fallback
  * @return string
  */
 public function get($key, array $replace = [], $locale = null, $fallback = true)
 {
     $translationRepository = app(TranslationRepository::class);
     if ($translation = $translationRepository->findByKeyAndLocale($key, $locale)) {
         return $this->makeReplacements($translation, $replace);
     }
     return parent::get($key, $replace, $locale);
 }
 /**
  * Get the translation for the given key.
  *
  * @param  string  $key
  * @param  array   $replace
  * @param  string  $locale
  * @return string
  */
 public function get($key, array $replace = array(), $locale = null)
 {
     $result = parent::get($key, $replace, $locale);
     if ($result === $key) {
         $this->notifyMissingKey($key);
     }
     return $result;
 }
Example #24
0
 /**
  * Translates and return a title for a menu item.
  *
  * This method will attempt to find a "menu.key_item" through the translator
  * component. If no translation is found for this item, it will attempt to
  * transform the item $key string to a title readable format.
  *
  * @param $key
  * @return string
  */
 protected function translateTitle($key)
 {
     $translation = $this->lang->get('menu.' . $key);
     if ($translation != 'menu.' . $key) {
         return $translation;
     }
     return String::title($key);
 }
 public function __construct(DatabaseManager $DB, AuthenticationManagementInterface $AuthenticationManager, Translator $Lang)
 {
     $this->DB = $DB;
     $this->AuthenticationManager = $AuthenticationManager;
     //$this->DB->connection()->enableQueryLog();
     /*
     $this->Database = $DB->table('ACCT_Journal_Entry AS je')
     						->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')
     						->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')
     						->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')
     						->where(function($query)
     		                {
     		                  $query->orWhere('jv.status', '=', 'B');
     		                  $query->orWhereNull('jv.status');
     		                }
     						)
     						->where('c.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())
     						->whereIn('at.pl_bs_category', array('D', 'E'))
     						->whereNull('je.deleted_at')
     						->whereNull('jv.deleted_at');
     						//->groupBy('c.id', 'c.parent_account_id', 'c.key', 'c.name', 'at.name');
     
     $this->visibleColumns = array($DB->raw('IFNULL(SUM(je.debit),0) AS acct_bs_debit'), $DB->raw('IFNULL(SUM(je.credit),0) AS acct_bs_credit'),
     															'c.id AS acct_bs_account_id', 'c.parent_account_id AS acct_bs_parent_account_id','c.key AS acct_bs_account_key', 'c.name AS acct_bs_account_name', 'c.is_group AS acct_bs_is_group', 'c.balance_type AS acct_bs_balance_type',
     															$DB->raw('CASE at.pl_bs_category WHEN "D" THEN "' . $Lang->get('decima-accounting::balance-sheet.assets') . '" ELSE "' . $Lang->get('decima-accounting::balance-sheet.liability') . '" END AS acct_bs_pl_bs_category'),
     															//$DB->raw('CASE balance_type WHEN "D" THEN IFNULL(SUM(je.debit),0) - IFNULL(SUM(je.credit),0) ELSE IFNULL(SUM(je.credit),0) - IFNULL(SUM(je.debit),0) END AS acct_bs_balance'),
     															$DB->raw('0 AS acct_bs_balance'),
     															//'at.name AS acct_bs_account_type_name'
     															//$DB->raw('CONCAT(" ", DATE_FORMAT(jv.date, "%c"), " - ", DATE_FORMAT(jv.date, "' . $Lang->get('form.mysqlDateFormat') . '"), " - #", jv.number, " - ", vt.name, " - ", IFNULL(jv.manual_reference,"No Ref."), " - ", jv.remark) AS voucher_header')
     															//$DB->raw('count(*) AS voucher_header')
     );
     */
     $this->Database = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where('jv.status', '=', 'B')->where('c.is_group', '=', 0)->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereIn('at.pl_bs_category', array('D', 'E'))->whereNull('je.deleted_at')->whereNull('jv.deleted_at');
     //->groupBy('c.id', 'c.parent_account_id', 'c.key', 'c.name', 'at.name');
     $this->visibleColumns = array($DB->raw('IFNULL(SUM(je.debit),0) AS acct_bs_debit'), $DB->raw('IFNULL(SUM(je.credit),0) AS acct_bs_credit'), 'c.id AS acct_bs_account_id', 'c.parent_account_id AS acct_bs_parent_account_id', 'c.key AS acct_bs_account_key', 'c.name AS acct_bs_account_name', 'c.is_group AS acct_bs_is_group', 'c.balance_type AS acct_bs_balance_type', $DB->raw('CASE at.pl_bs_category WHEN "D" THEN "' . $Lang->get('decima-accounting::balance-sheet.assets') . '" ELSE "' . $Lang->get('decima-accounting::balance-sheet.liability') . '" END AS acct_bs_pl_bs_category'), $DB->raw('0 AS acct_bs_balance'));
     $this->Database2 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where(function ($query) {
         $query->orWhere('jv.status', '=', 'B');
         $query->orWhereNull('jv.status');
     })->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereIn('at.pl_bs_category', array('B'))->whereNull('je.deleted_at')->whereNull('jv.deleted_at');
     $this->Database4 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Journal_Entry AS je')->join('ACCT_Journal_Voucher AS jv', 'jv.id', '=', 'je.journal_voucher_id')->rightJoin('ACCT_Account AS c', 'je.account_id', '=', 'c.id')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where(function ($query) {
         $query->orWhere('jv.status', '=', 'B');
         $query->orWhereNull('jv.status');
     })->where('jv.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereIn('at.pl_bs_category', array('C'))->whereNull('je.deleted_at')->whereNull('jv.deleted_at');
     $this->Database3 = $DB->connection($AuthenticationManager->getCurrentUserOrganizationConnection())->table('ACCT_Account AS c')->join('ACCT_Account_Type AS at', 'at.id', '=', 'c.account_type_id')->where('c.is_group', '=', 1)->where('c.organization_id', '=', $AuthenticationManager->getCurrentUserOrganizationId())->whereIn('at.pl_bs_category', array('D', 'E'))->select(array($DB->raw('0 AS acct_bs_debit'), $DB->raw('0 AS acct_bs_credit'), 'c.id AS acct_bs_account_id', 'c.parent_account_id AS acct_bs_parent_account_id', 'c.key AS acct_bs_account_key', 'c.name AS acct_bs_account_name', 'c.is_group AS acct_bs_is_group', 'c.balance_type AS acct_bs_balance_type', $DB->raw('CASE at.pl_bs_category WHEN "D" THEN "' . $Lang->get('decima-accounting::balance-sheet.assets') . '" ELSE "' . $Lang->get('decima-accounting::balance-sheet.liability') . '" END AS acct_bs_pl_bs_category'), $DB->raw('0 AS acct_bs_balance')));
     $this->orderBy = array(array('acct_bs_account_key', 'asc'));
 }
Example #26
0
 /**
  * Prepare an email for account reset results
  *
  * @param User $user
  * @param string $reset_code
  * @throws PasswordResetCodeInvalidException
  * @throws PasswordResetFailedException
  */
 protected function prepareResetResultMailData($user, $reset_code)
 {
     $to = array('address' => $user->getAttribute('email'), 'name' => $user->getAttribute('first_name') . ' ' . $user->getAttribute('last_name'));
     $this->setTo($to);
     $this->setSubject($this->cmsName . ' | ' . $this->lang->get('larapress::email.Password Reset!'));
     $this->setData(array('new_password' => $this->attemptToReset($user, $reset_code)));
     $this->setView(array('text' => 'larapress::emails.new-password'));
 }
 /**
  * Get the translation for the given key.
  *
  * @param  string  $key
  * @param  array   $replace
  * @param  string  $locale
  * @return string
  */
 public function get($key, array $replace = array(), $locale = null)
 {
     $result = parent::get($key, $replace, $locale);
     $flag = Config::get('translations-debugger::input_flag');
     if (($method = Input::get($flag, null)) != null) {
         return $this->method($method, $key, $result);
     }
     return $result;
 }
 /**
  * Format the label to the proper format
  *
  * @param $name
  * @return string
  */
 public function formatLabel($name)
 {
     if (!$name) {
         return null;
     }
     if ($this->translator->has($name)) {
         return $this->translator->get($name);
     }
     return ucfirst(str_replace('_', ' ', $name));
 }
 public function putRoleStates()
 {
     $roles = $this->request->get('roles', []);
     try {
         $this->execute('Pardisan\\Commands\\State\\RoleStateCommand', ['roles' => $roles]);
         return $this->redirectRoute('admin.states.edit_role_states')->with('success_message', $this->lang->get('messages.update_success'));
     } catch (RepositoryException $e) {
         return $this->redirectBack()->with('error_message', $this->lang->get('messages.repository_error'));
     }
 }
 /**
  * Storing a cat in db
  *
  * @return Redirect
  */
 public function store()
 {
     try {
         $created = $this->execute('Pardisan\\Commands\\Category\\Store\\Command');
         return $this->redirectRoute('admin.categories.index')->with('success_message', $this->lang->get('messages.categories.success_update', ['name' => $created->name]));
     } catch (NotFoundException $e) {
         App::abort(404);
     } catch (FormValidationException $e) {
         return $this->redirectBack()->withInput()->withErrors($e->getErrors());
     }
 }