/**
  * Create a new authentication controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     if (!Settings::get('auth.loginenabled', true)) {
         $this->middleware('auth.disablelogin');
     }
     if (!Settings::get('auth.registerenabled', true)) {
         $this->middleware('auth.disableregistering');
     }
     $this->middleware('guest', ['except' => 'logout']);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             if (Settings::get('auth.loginenabled', true)) {
                 return redirect()->guest('login');
             } else {
                 return redirect()->guest('/');
             }
         }
     }
     return $next($request);
 }
 public function get($token)
 {
     $retval = array();
     $retval['status'] = 1;
     $options = Input::only('fields');
     $vendor = new Vendor();
     $cell = $vendor->getCellNumber($token);
     $settings = new Settings();
     if (isset($options['fields'])) {
         $filters = explode(',', $options['fields'], Settings::NUM_SETTINGS + 1);
         foreach ($filters as $name) {
             $retval[$name] = $settings->get($cell, $name);
         }
     }
     return $retval;
 }
Пример #4
0
 private static function makeArray()
 {
     $settings = Settings::get()->toArray();
     // insert default settings if first run application
     if (!$settings) {
         self::createDefault();
         User::createDefault();
         $arr = self::$default;
     } else {
         foreach ($settings as $item) {
             $name = $item['name'];
             $array_value = json_decode($item['value']);
             $value = $array_value ? $array_value : $item['value'];
             $arr[$name] = $value;
         }
     }
     // Front navbar menu
     $arr['page_menu'] = Page::active()->where('to_menu', 1)->orderBy('sorter')->get()->lists('name', 'slug');
     // admin credentials
     $user = User::find(1);
     $arr['name'] = $user->name;
     $arr['admin_email'] = $user->email;
     return $arr;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function reset($token)
 {
     $retval = array();
     $retval['code'] = 1;
     # Get the cell number
     $vendor = new Vendor();
     $cell = $vendor->getCellNumber($token);
     $vendor->resetNextAvailableCounter($cell, Settings::get($cell, Settings::INITIAL_EMPTY_POSITIONS) + 1);
     # Remove all appointments against the cell
     $apointment = new Appointments();
     $apointment->reset($cell);
     return $retval;
 }