Example #1
0
 /**
  * Unauthorizes current user.
  *
  * @return void
  */
 public static function unauthorize()
 {
     Session::forget('auth.authorized');
     Session::forget('auth.user');
     static::$authorized = false;
     static::$user = null;
 }
Example #2
0
 /**
  * Gets a layout.
  *
  * @param  string  $name
  * @param  array   $data
  * @return string
  */
 public static function get(string $name, array $data = []) : string
 {
     // Merge the data.
     static::$data = array_merge_recursive(static::data(), $data);
     // Merge validation errors into the view data.
     if (!isset(static::$data['errors']) && ($errors = Session::flash('validation_errors'))) {
         static::$data['errors'] = $errors;
     }
     // Get the path to the layout.
     $path = path('layouts') . $name . '.layout.php';
     // Load.
     return Component::load($path, static::data());
 }
Example #3
0
 /**
  * Close the system.
  *
  * @return void
  */
 public static function close()
 {
     Session::finalize();
     Database::finalize();
 }