Ejemplo n.º 1
0
 /**
  * Get base lang object from session.
  *
  * @return \Syscover\Pulsar\Models\Lang
  */
 function base_lang()
 {
     if (session('baseLang') === null) {
         session(['baseLang' => \Syscover\Pulsar\Models\Lang::getBaseLang()]);
     }
     return session('baseLang');
 }
Ejemplo n.º 2
0
 public function updateCustomRecord($parameters)
 {
     if ($this->request->hasFile('image')) {
         $filename = Miscellaneous::uploadFiles('image', public_path() . '/packages/syscover/pulsar/storage/langs');
     } else {
         $filename = $this->request->input('image');
     }
     if ($this->request->input('base')) {
         Lang::resetBaseLang();
     }
     Lang::where('id_001', $parameters['id'])->update(['id_001' => $this->request->input('id'), 'name_001' => $this->request->input('name'), 'image_001' => $filename, 'sorting_001' => $this->request->input('sorting'), 'base_001' => $this->request->input('base', 0), 'active_001' => $this->request->input('active', 0)]);
     if ($this->request->input('base')) {
         session(['baseLang' => Lang::getBaseLang()]);
     }
 }
Ejemplo n.º 3
0
 /**
  * Handle a login request to the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postLogin(Request $request)
 {
     $this->validate($request, ['user' => 'required', 'password' => 'required']);
     $credentials = $request->only('user', 'password');
     if (auth('pulsar')->attempt($credentials, $request->has('remember'))) {
         // check if user has access
         if (!auth('pulsar')->user()->access_010) {
             auth('pulsar')->logout();
             return redirect($this->loginPath)->withInput($request->only('user', 'remember'))->withErrors(['loginErrors' => 3]);
         }
         // set user access control list
         session(['userAcl' => AclLibrary::getProfileAcl(auth('pulsar')->user()->profile_id_010)]);
         // check if user has permission to access
         if (!is_allowed('pulsar', 'access')) {
             auth('pulsar')->logout();
             return redirect($this->loginPath)->withInput($request->only('user', 'remember'))->withErrors(['loginErrors' => 2]);
         }
         session(['packages' => Package::getRecords(['active_012' => true, 'orderBy' => ['column' => 'sorting_012', 'order' => 'desc']])]);
         session(['baseLang' => Lang::getBaseLang()]);
         return redirect()->intended($this->redirectTo);
     }
     return redirect($this->loginPath)->withInput($request->only('user', 'remember'))->withErrors(['loginErrors' => 1]);
 }
Ejemplo n.º 4
0
 public function getCountries()
 {
     // get base lang from database because this function is call from cron, without create session variable baseLang
     $baseLang = Lang::getBaseLang()->id_001;
     return EmailCampaign::belongsToMany('Syscover\\Pulsar\\Models\\Country', '005_045_email_campaigns_countries', 'campaign_id_045', 'country_id_045')->where('001_002_country.lang_id_002', $baseLang);
 }