Example #1
0
 protected function initialize()
 {
     static::$properties = array_replace(static::$properties, self::$billingProperties);
     static::$hidden = array_merge(static::$hidden, ['stripe_customer', 'not_charged', 'last_trial_reminder']);
     parent::initialize();
     self::creating([get_called_class(), 'notChargedGuard']);
 }
 public function __invoke($req, $res, $next)
 {
     // inject the request/response into auth
     $auth = $this->app['auth'];
     $auth->setRequest($req)->setResponse($res);
     $user = $auth->getAuthenticatedUser();
     // use the authenticated user as the requester for model permissions
     ACLModel::setRequester($user);
     $this->app['requester'] = $user;
     return $next($req, $res);
 }
Example #3
0
 public function __construct($app)
 {
     // CLI requests have a super user
     if (defined('STDIN')) {
         $userClass = $this->getUserClass($app);
         $user = new $userClass(-2);
         $user->promoteToSuperUser();
         $app['user'] = $user;
         // use the super user as the requester for model permissions
         ACLModel::setRequester($user);
         $app['requester'] = $user;
     }
 }
 protected function initialize()
 {
     parent::initialize();
     static::updated([get_called_class(), 'passwordChanged']);
 }