Exemple #1
0
 /**
  * Add user
  *
  * @param array $user
  * @return boolean
  */
 public function add(array $user)
 {
     $entity = new UserEntity();
     $entity->setData($user);
     $repo = $this->store()->getRepository('user');
     $event = $this->store()->getEvent();
     if ($this->string()->length($event) > 0) {
         $event_after = 'OnBefore' . $this->string()->ucwords($event) . 'Add';
         Event::on($event_after, function ($user) {
             $filter = array('LOGIC' => 'OR', UserEntity::C_LOGIN => $user[UserEntity::C_LOGIN], UserEntity::C_EMAIL => $user[UserEntity::C_EMAIL]);
             $copy = $this->finder()->filter($filter)->get();
             if ($copy !== false) {
                 $error = new MessageBag();
                 if ($copy->getValue(UserEntity::C_LOGIN) === $user[UserEntity::C_LOGIN]) {
                     $error->add(UserEntity::C_LOGIN, $this->trans('user.manager.add.dublicate_login'));
                     throw new ValidateException($error);
                 }
                 if ($copy->getValue(UserEntity::C_EMAIL) === $user[UserEntity::C_EMAIL]) {
                     $error->add(UserEntity::C_EMAIL, $this->trans('user.manager.add.dublicate_email'));
                     throw new ValidateException($error);
                 }
                 $error->add(UserEntity::C_LOGIN, $this->trans('user.manager.add.dublicate_login_or_email'));
                 $error->add(UserEntity::C_EMAIL, $this->trans('user.manager.add.dublicate_login_or_email'));
                 throw new ValidateException($error);
             }
         });
     }
     if ($this->string()->length($event) > 0) {
         $event_after = 'OnAfter' . $this->string()->ucwords($event) . 'Add';
         Event::on($event_after, function () {
             Cache::clearByTags('user');
         });
     }
     return $this->store()->add($repo, $entity);
 }
 public function postIndex()
 {
     $form = Form::fromFile(__DIR__ . '/contact.form.php');
     $form->setInput(Input::all());
     $validator = $form->accept();
     if ($validator->fails()) {
         $form->setErrors($validator->messages());
         return View::make('contact')->with('form', $form);
     }
     $data = $validator->getData();
     // Get the label for an enum
     $data['found'] = $form->fieldSpec('found')['options'][$data['found']];
     // Parse date inputs
     $data['from_date'] = strtotime($data['from_date']);
     $data['to_date'] = strtotime($data['to_date']);
     if (!Mail::send('emails.contact', $data, function ($message) use($data) {
         $message->to('*****@*****.**')->replyTo($data['email'], $data['person'])->subject('Contact form')->setCharset('UTF-8');
     })) {
         $errors = new MessageBag();
         // global here can be anything that's not an actual field name
         $errors->add('global', 'Could not send your contact request to contact@example.com. Please try again later.');
         return View::make('contact')->with('form', $form)->with('errors', $errors);
     }
     return View::make('success');
 }
Exemple #3
0
 public function login(Request $request)
 {
     if (!empty($request->input('email'))) {
         $email = $request->input('email');
         $password = $request->input('password');
         $user_node = $this->users->getUser($email);
         // Create the Person model
         $user = new Person();
         $user->setNode($user_node);
         if (!empty($user_node)) {
             // Check password and verification
             if (!$user->verified) {
                 $message_bag = new MessageBag();
                 return redirect()->back()->with('errors', $message_bag->add('email', 'Dit emailadres is nog niet geverifieerd.'));
             } elseif (Hash::check($password, $user->password)) {
                 Auth::login($user);
                 // Register the event to Piwik
                 $this->registerPiwikEvent($user->email, 'Login');
                 return redirect($this->redirectTo);
             } else {
                 $message_bag = new MessageBag();
                 return redirect()->back()->with('errors', $message_bag->add('password', 'Het wachtwoord is incorrect.'));
             }
         } else {
             $message_bag = new MessageBag();
             return redirect()->back()->with('errors', $message_bag->add('email', 'Het emailadres werd niet gevonden.'));
         }
     } else {
         $message_bag = new MessageBag();
         return redirect()->back()->with('errors', $message_bag->add('email', 'Het emailadres werd niet gevonden.'));
     }
 }
 /** 
  * observe Calendar event deleting
  * 1. delete child
  * 2. delete chart
  * 3. delete schedule
  * 4. act, accept or refuse
  * 
  * @param $model
  * @return bool
  */
 public function deleting($model)
 {
     $errors = new MessageBag();
     //1. delete child
     foreach ($model->calendars as $key => $value) {
         if (!$value->delete()) {
             $errors->add('Calendar', $value->getError());
         }
     }
     //2. delete chart
     foreach ($model->follows as $key => $value) {
         if (!$value->delete()) {
             $errors->add('Calendar', $value->getError());
         }
     }
     //3. delete schedule
     foreach ($model->schedules as $key => $value) {
         if (!$value->delete()) {
             $errors->add('Calendar', $value->getError());
         }
     }
     if ($errors->count()) {
         $model['errors'] = $errors;
         return false;
     }
     return true;
 }
 /** 
  * observe organisation event deleting
  * 1. delete branch
  * 2. delete chart
  * 3. delete policy
  * 4. act, accept or refuse
  * 
  * @param $model
  * @return bool
  */
 public function deleting($model)
 {
     $errors = new MessageBag();
     //1. delete branch
     foreach ($model->branches as $key => $value) {
         //2. delete chart
         foreach ($value->charts as $key2 => $value2) {
             if (!$value2->delete()) {
                 $errors->add('Organisation', $value2->getError());
             }
         }
         if (!$value->delete()) {
             $errors->add('Organisation', $value->getError());
         }
     }
     //3. delete policy
     foreach ($model->policies as $key => $value) {
         if (!$value->delete()) {
             $errors->add('Organisation', $value->getError());
         }
     }
     if ($errors->count()) {
         $model['errors'] = $errors;
         return false;
     }
     return true;
 }
Exemple #6
0
 public static function storeCourse()
 {
     /**Запись и сохранение курса
      * в случае удачи - возвращаем true,иначе false
      * @return BooleanType
      * */
     //Проверка радостей от пользователя
     $validator = Validator::make(array('name' => Input::get('name')), array('name' => array('required', 'min:5')));
     if ($validator->passes()) {
         dd($validator);
         //Прошла валидация
         $course = new Course();
         $course->name = Input::get('name');
         $course->save();
         //т.к у нас тепреь есть новая модель,
         //но контроллеры о ней ничего еще не знают-
         //положим упоминание о ней в Message Bag,чтоб они смогли прочитать
         $messageBag = new MessageBag();
         $messageBag->add('courseId', $course->id);
         $message = 'Course ' . $course->name . ' been successful created';
         $status = 'success';
         $result = true;
     } else {
         //Все немного хуже и данные не валидны
         $message = 'Course not been successful created';
         $status = 'fail';
         $result = false;
     }
     //Вложим в сессию итог действия
     Session::put('message', $message);
     Session::put('status', $status);
     return $result;
 }
 /**
  * Should use the error message bag to give errors for a field.
  */
 public function testErrorsFor()
 {
     $errors = [$this->generator()->anyString(), $this->generator()->anyString()];
     $fieldName = $this->generator()->anyString();
     $this->errors->shouldReceive('get')->with($fieldName)->andReturn($errors);
     $this->assertSame($errors, $this->replyComposer->errorsFor($fieldName));
 }
Exemple #8
0
 /**
  * Create a form label element.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return string
  */
 public function label($name, $value = null, $options = array())
 {
     if ($this->validationErrors && $this->validationErrors->has($name)) {
         $options = $this->addClass($options, $this->errorCssClass);
     }
     return parent::label($name, $value, $options);
 }
Exemple #9
0
 public function sendPass()
 {
     $input = Input::all();
     $user = User::where('email', '=', $input['email'])->first();
     $errors = new MessageBag();
     if ($user) {
         try {
             $user = $user->toArray();
             $data['username'] = $user['username'];
             $data['token'] = $input['_token'];
             $data['firstname'] = $user['firstname'];
             $data['lastname'] = $user['lastname'];
             $data['email'] = $user['email'];
             Session::put('data', $data);
             Mail::send('mail.reset_' . App::getLocale(), $data, function ($message) {
                 $message->to(session('data')['email'], session('data')['firstname'], session('data')['lastname'])->subject(trans('login.forgot'));
             });
             DB::insert('INSERT INTO password_resets (email, token, created_at) values ' . '("' . $data['email'] . '", "' . $data['token'] . '", "' . time() . '")');
         } catch (Exception $e) {
             $errors->add('reset', trans('message.trans'));
             return redirect()->back()->withErrors($errors);
         }
         Session::pull('data');
         return redirect('login')->withErrors(['sent' => trans('message.sent')]);
     } else {
         Session::pull('data');
         $errors->add('email', trans('message.email'));
         return redirect()->back()->withErrors($errors);
     }
 }
Exemple #10
0
 function saving($model)
 {
     $errors = new MessageBag();
     ///////////
     // RULES //
     ///////////
     if (is_null($model->_id)) {
         $id = 0;
     } else {
         $id = $model->_id;
     }
     //////////////
     // VALIDATE //
     //////////////
     $client = Client::key($model->key)->where('_id', '<>', $id)->first();
     if ($client) {
         $errors->add('Key', 'Key must be unique');
     }
     $client = Client::secret($model->key)->where('_id', '<>', $id)->first();
     if ($client) {
         $errors->add('Secret', 'Secret must be unique');
     }
     if ($errors->count()) {
         $model->setErrors($errors);
         return false;
     }
 }
 /**
  * Veritrans Credit Card
  *
  * 1. Check Order
  * 2. Save Payment
  * 
  * @return Response
  */
 public function veritranscc()
 {
     if (!Input::has('order_id')) {
         return new JSend('error', (array) Input::all(), 'Tidak ada data order id.');
     }
     $errors = new MessageBag();
     DB::beginTransaction();
     //1. Validate Sale Parameter
     $order = Input::only('order_id', 'gross_amount', 'payment_type', 'masked_card', 'transaction_id');
     //1a. Get original data
     $sale_data = \App\Models\Sale::findorfail($order['order_id']);
     //2. Save Payment
     $paid_data = new \App\Models\Payment();
     $payment['transaction_id'] = $sale_data['id'];
     $payment['method'] = $order['payment_type'];
     $payment['destination'] = 'Veritrans';
     $payment['account_name'] = $order['masked_card'];
     $payment['account_number'] = $order['transaction_id'];
     $payment['ondate'] = \Carbon\Carbon::parse($order['transaction_time'])->format('Y-m-d H:i:s');
     $payment['amount'] = $order['gross_amount'];
     $paid_data = $paid_data->fill($payment);
     if (!$paid_data->save()) {
         $errors->add('Log', $paid_data->getError());
     }
     if ($errors->count()) {
         DB::rollback();
         return response()->json(new JSend('error', (array) Input::all(), $errors), 404);
     }
     DB::commit();
     $final_sale = \App\Models\Sale::id($sale_data['id'])->with(['voucher', 'transactionlogs', 'user', 'transactiondetails', 'transactiondetails.varian', 'transactiondetails.varian.product', 'paidpointlogs', 'payment', 'shipment', 'shipment.address', 'shipment.courier', 'transactionextensions', 'transactionextensions.productextension'])->first()->toArray();
     return response()->json(new JSend('success', (array) $final_sale), 200);
 }
 /**
  * set pasword
  *
  * 1. get activation link
  * 2. validate activation
  * @param activation link
  * @return array of employee
  */
 public function setPassword($activation_link)
 {
     if (!Input::has('activation')) {
         return new JSend('error', (array) Input::all(), 'Tidak ada data activation.');
     }
     $errors = new MessageBag();
     DB::beginTransaction();
     //1. Validate activation Parameter
     $activation = Input::get('activation');
     //1. get activation link
     $employee = Employee::activationlink($activation_link)->first();
     if (!$employee) {
         $errors->add('Activation', 'Invalid activation link');
     }
     //2. validate activation
     $rules = ['password' => 'required|min:8|confirmed'];
     $validator = Validator::make($activation, $rules);
     if ($validator->passes()) {
         $employee->password = $activation['password'];
         $employee->activation_link = '';
         if (!$employee->save()) {
             $errors->add('Activation', $employee->getError());
         }
     } else {
         $errors->add('Activation', $validator->errors());
     }
     if ($errors->count()) {
         DB::rollback();
         return new JSend('error', (array) Input::all(), $errors);
     }
     DB::commit();
     return new JSend('success', ['employee' => $employee->toArray()]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $error = '';
     /*		$track = resi::select('resi.noresi','k.nama AS konsumen',
     				'ca.nama AS asal','ct.nama AS tujuan',
     				'b.tglberangkat',//'b.jamberangkat',
     				'b.tgltiba',
     				'b.nopolisi','ps.nama AS sopir','pk.nama AS kenek',
     				'u.name AS user',
     				'resi.status')
     				->leftJoin('konsumen as k','k.idkonsumen','=','resi.idkonsumen')
     				->leftJoin('berangkat as b','b.idberangkat','=','resi.idberangkat')
     				->leftJoin('cabang as ca','ca.idcabang','=','b.idasal')
     				->leftJoin('cabang as ct','ct.idcabang','=','b.idtujuan')
     				->leftJoin('pegawai as ps','ps.idpegawai','=','b.idsopir')
     				->leftJoin('pegawai as pk','pk.idpegawai','=','b.idkenek')
     				->leftJoin('users as u','u.id','=','resi.user')
     				->where('resi.noresi','=',Request::get('id'))->get();
     				//*/
     $resi = resi::find(Request::get('id'));
     if (!$resi) {
         $error = new MessageBag();
         $error->add('notfound', 'Maaf resi dengan nomer ' . Request::get('id') . ' tidak ditemukan');
         return view('master')->with('track', true)->withErrors($error);
     } else {
         $data = resi::select('resi.idberangkat', 'resi.idrute', 'resi.noresi', 'tk.nama as prspengirim', 'tk.cp as cppengirim', 'rk.nama as prspenerima', 'rk.cp as cppenerima', 'tc.nama as cabangasal', 'rc.nama as cabangtujuan', 'berangkat.nopolisi', 'berangkat.supir1', 'berangkat.supir2', 'rute.tglbrkt', 'rute.tgltiba')->leftJoin('konsumen AS tk', 'tk.idkonsumen', '=', 'resi.idkonsumen')->leftJoin('konsumen AS rk', 'rk.idkonsumen', '=', 'resi.idpenerima')->leftJoin('rute', function ($join) {
             $join->on('rute.sjt', '=', 'resi.idberangkat');
             $join->on('rute.id', '=', 'resi.idrute');
         })->leftJoin('cabang AS tc', 'tc.idcabang', '=', 'rute.kotamuat')->leftJoin('cabang AS rc', 'rc.idcabang', '=', 'rute.kotabongkar')->leftJoin('berangkat', 'berangkat.idberangkat', '=', 'rute.sjt')->where('resi.noresi', Request::get('id'))->first();
         $posisi = posisiarmada::where('sjt', $data->idberangkat)->where('id', $data->idrute)->get();
         return view('master')->with('track', true)->with('data', $data)->with('posisi', $posisi);
     }
     //('errorstracking',$error);
 }
Exemple #14
0
 public function delete()
 {
     $rules = array('newsletter_unsubscribe_email' => 'required|max:250|email|exists:fbf_newsletter_signups,email');
     $validator = \Validator::make(\Input::all(), $rules, \Lang::get('laravel-newsletter-signup::copy.unsubscribe.validation'));
     if ($validator->fails()) {
         if (\Request::ajax()) {
             $messages = $validator->messages();
             $message = $messages->first('newsletter_unsubscribe_email');
             return \Response::JSON(array('message' => $message), 400);
         }
         return \Redirect::to(\Input::get('from'))->withInput()->withErrors($validator);
     }
     $signup = Signup::withTrashed()->where('email', '=', \Input::get('newsletter_unsubscribe_email'))->first();
     if ($signup->trashed()) {
         if (\Request::ajax()) {
             return \Response::JSON(array('message' => \Lang::get('laravel-newsletter-signup::copy.unsubscribe.already_unsubscribed')), 400);
         }
         $message = new MessageBag();
         $message->add('newsletter_unsubscribe_email', \Lang::get('laravel-newsletter-signup::copy.unsubscribe.already_unsubscribed'));
         return \Redirect::to(\Input::get('from'))->withInput()->with('errors', $message);
     }
     $signup->delete();
     $success = \Lang::get('laravel-newsletter-signup::copy.unsubscribe.success');
     if (\Request::ajax()) {
         return \Response::JSON(array('message' => $success));
     }
     return \Redirect::to(\Input::get('from'))->with('newsletter_unsubscribe_email_message', $success);
 }
Exemple #15
0
 public function index()
 {
     Breadcrumbs::addCrumb('Cadastrar', Request::fullUrl());
     $signupForm = new SignupForm(['data' => Input::all(), 'prefix' => 'signup']);
     $errors = new MessageBag();
     if (Input::method() == 'POST') {
         if ($signupForm->isValid()) {
             try {
                 DB::beginTransaction();
                 $user = new User();
                 $user->name = $signupForm->fullName->value;
                 $user->email = $signupForm->email->value;
                 $user->password = Hash::make($signupForm->password->value);
                 if ($user->save()) {
                     Mail::send('user_panel::mails.welcome', ['user' => $user], function ($message) use($user) {
                         $message->to($user->email)->subject('Seja bem vindo');
                     });
                     DB::commit();
                     return Redirect::route('userpanel.signin')->with('success', 'Usuário cadastrado com sucesso!');
                 } else {
                     $errors->add('other', 'Não foi possível cadastrar');
                 }
             } catch (Exception $e) {
                 DB::rollback();
                 throw $e;
             }
         } else {
             $errors = $signupForm->errors();
         }
     }
     return View::make('user_panel::front.register.index', compact('signupForm', 'errors'));
 }
 public function getAuthState()
 {
     $state = new JobAuthState();
     $state->authMechanism = self::AUTH_MECHANISM;
     if (!Input::has('access_token')) {
         return $state;
     }
     $ownerId = $this->authServer->getResourceOwnerId();
     $type = $this->authServer->getResourceOwnerType();
     if ($type == 'user') {
         //oAuth token belongs to a user
         $user = User::find($ownerId);
         $actAs = $user->id;
         if (Input::has('act_as')) {
             if ($user->hasRole(UserRole::ACTOR_ROLE)) {
                 $actAs = Input::get('act_as');
             } else {
                 $bag = new MessageBag();
                 $bag->add('authorisation', 'The current user cannot act as another user');
                 throw new AuthorisationException($bag);
             }
         }
         $state->userId = $user->id;
         $state->rememberMe = false;
         $state->actingUserId = $actAs;
     } else {
         //oAuth token belongs to a client
         //$client = OAuthClient::find($ownerId);
         //There is no user context and act_as shouldn't be needed as clients can use
         //access tokens if they want to execute as a user
     }
     return $state;
 }
Exemple #17
0
 /**
  * Attempt to log in witth the credentials sent through Input
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function login()
 {
     $response = null;
     $identifier_field = Config::get('auth::user_table.login_through_field');
     $password_field = 'password';
     $credentials = [$identifier_field => Input::get($identifier_field), 'password' => Input::get($password_field), 'enabled' => true];
     if (array_key_exists('email', $credentials)) {
         $credentials['email'] = strtolower($credentials['email']);
     }
     $rules = array();
     $rules['password'] = '******';
     if (array_key_exists('email', $credentials)) {
         $rules['email'] = 'required|email|exists:' . Config::get('auth::user_table.table_name');
     }
     if (array_key_exists('username', $credentials)) {
         $rules['username'] = '******' . Config::get('auth::user_table.table_name');
     }
     $validator = \Validator::make($credentials, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator->errors());
     }
     if (Auth::attempt($credentials, true)) {
         $response = Redirect::intended('/')->with('success');
     } else {
         $errors = new MessageBag();
         if (empty($credentials[$identifier_field])) {
             $errors->add('message', trans('auth::form.login failed'));
         } else {
             $errors->add('message', trans('auth::form.login failed_with_username', ['username' => $credentials[$identifier_field]]));
         }
         $response = Redirect::back()->withInput()->withErrors($errors);
     }
     return $response;
 }
 public static function hydrateFromInput()
 {
     $className = get_called_class();
     $reflectionMethod = new ReflectionMethod($className, '__construct');
     $params = $reflectionMethod->getParameters();
     $paramsToPass = [];
     $throwError = false;
     $errors = new MessageBag();
     foreach ($params as $param) {
         $paramName = $param->getName();
         if (\Input::has($paramName)) {
             $paramsToPass[] = \Input::get($paramName);
         } else {
             if (!$param->isOptional()) {
                 $throwError = true;
                 $errors->add('missing_parameters', $paramName);
             }
         }
     }
     if ($throwError) {
         throw new CommandParameterException($errors);
     }
     $reflect = new ReflectionClass($className);
     return $reflect->newInstanceArgs($paramsToPass);
 }
 /** @test */
 public function errorsAreAdded()
 {
     $session = $this->makeSession();
     $session->put('errors', $bag = new MessageBag(['foo', 'bar']));
     $view = $this->callCreator($session);
     $errors = $view->validationErrors;
     $this->assertEquals($bag->all(), $errors);
 }
Exemple #20
0
 public function validate()
 {
     $messageBag = new MessageBag();
     if (!$this->relation_table || !\Schema::hasTable($this->relation_table)) {
         $messageBag->add($this->name, 'Invalid relation table on ' . $this->name);
     }
     return $messageBag->isEmpty() ? true : $messageBag;
 }
 public function notRemember(BaseCommand $command)
 {
     if ($command->getAuthState()->rememberMe == true) {
         $bag = new MessageBag();
         $bag->add('authorisation', 'This action cannot be performed using a `remembered` session');
         throw new AuthorisationException($bag);
     }
 }
 /**
  * Format the validation errors.
  *
  * @param \Illuminate\Support\MessageBag $errors
  *
  * @return mixed
  */
 protected function formatErrors($errors)
 {
     $output = [];
     foreach ($errors->getMessages() as $field => $message) {
         $output[] = ['code' => 'validation_fails', 'field' => $field, 'message' => isset($message[0]) ? $message[0] : ''];
     }
     return $output;
 }
 /**
  * Get the error for a field, wrapped in a label
  *
  * @param  InputInterface $field
  * @param  string         $id
  * @param  array          $attributes
  *
  * @return string|boolean
  */
 public function getErrorFor(InputInterface $field, $id, array $attributes = array())
 {
     $error = $this->errors->first($field->getName());
     if ($error) {
         return $this->builder->label($id, $error, $attributes);
     }
     return false;
 }
Exemple #24
0
 private function messages($key, $message)
 {
     $messages = Session::get('messages');
     if (!$messages instanceof MessageBag) {
         $messages = new MessageBag();
     }
     $messages->add($key, $message);
     Session::flash('messages', $messages);
 }
 public function __construct($messages, $code = 0, Exception $previous = null)
 {
     if (!$messages instanceof MessageProviderInterface) {
         $messages = new MessageBag((array) $messages);
     }
     $this->messages = $messages->getMessageBag();
     $this->messages->setFormat(':message');
     parent::__construct('', $code, $previous);
 }
 /**
  * Renders messages into HTML.
  * @param \Illuminate\Support\MessageBag $messages
  * @return string
  */
 public function renderMessages($messages)
 {
     $html = '<ul>';
     foreach ($messages->all('<li>:message</li>') as $message) {
         $html .= $message;
     }
     $html .= '</ul>';
     return $html;
 }
Exemple #27
0
 /** 
  * observe policy saving
  * 1. act if error or not
  * 
  * @param $model
  * @return bool
  */
 public function saving($model)
 {
     $errors = new MessageBag();
     if ($errors->count()) {
         $model['errors'] = $errors;
         return false;
     }
     return true;
 }
 /**
  * Processes a post from the login form.
  */
 public function postLogin()
 {
     $input = $this->request->only(array('username', 'password'));
     if (!$this->lock->attempt($input['username'], $input['password'])) {
         $errors = new MessageBag();
         $errors->add('error', 'Sorry, invalid username or password.');
         return $this->redirector->to($this->config->get('l4-lock::config.lock.urls.login'))->withErrors($errors);
     }
     return $this->redirector->to($this->lock->intended());
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->user()->is_admin) {
         $errors = new MessageBag();
         $errors->add('adminarea', 'Restricted Area. Please use a admin login.');
         $this->auth->logout();
         return view('auth.login', compact('errors'));
     }
     return $next($request);
 }
Exemple #30
0
 /**
  * Return errors
  *
  * @return \Illuminate\Support\MessageBag
  */
 public function getErrors()
 {
     $return = new MessageBag();
     foreach ($this->array as $key => $field) {
         foreach ($field->getErrors() as $message) {
             $return->add($key, $message);
         }
     }
     return $return;
 }