public function register(Container $app) { //$app->share('mailhandler', function() use ($app){ // $config = $app->get('config'); // $paths = $config->get('paths'); // $options = $config->get('mail'); // $options['spool_directory'] = $paths['storage'] . '/spool'; // return new SwiftMailerHandler($options); //}); $config = $app->get('config'); //$r = $app->get('Symfony\Component\HttpFoundation\Request'); AppSupport::setConfig($config); //AppSupport::initialize($r->getPathInfo()); //AppSupport::loadLang($config->get('lang')); //$mail = Mail::getInstance(); //$mail->setHandler($app->get('mailhandler')); Encode::$key = $config->get('encode.key'); Encode::setAlgorithm($config->get('encode.algorithm')); DB::setCapsule($app->get('database')); }
protected function onSuccess() { DB::beginTransaction(); try { $this->onFormSuccess(); DB::commit(); } catch (\Exception $e) { $this->messages = ['error' => ['error' => [$e->getMessage()]]]; DB::rollback(); return false; } return $this->onFormSuccessReturn(); }