public function run()
 {
     $telekom = \App\Operator::create(['name' => 'Slovak Telekom', 'description' => 'Slovak Telekom operator', 'country' => 'Slovakia']);
     $telekom->prefixes()->attach([1, 2, 3, 4, 5, 6, 7, 8]);
     $orange = \App\Operator::create(['name' => 'Orange Slovakia', 'description' => 'Orange operator', 'country' => 'Slovakia']);
     $orange->prefixes()->attach([9, 10, 11, 12, 13, 14, 15, 16]);
     $telefonica = \App\Operator::create(['name' => 'Telefonica Slovakia', 'description' => 'Telefonica aka O2', 'country' => 'Slovakia']);
     $telefonica->prefixes()->attach([18, 19, 20, 21]);
     $funFon = \App\Operator::create(['name' => 'FunFon', 'description' => 'FunFon is part of the Orange Slovakia', 'country' => 'Slovakia']);
     $funFon->prefixes()->attach(17);
     $swan = \App\Operator::create(['name' => 'SWAN Mobile', 'description' => 'Or as know as  4KA', 'country' => 'Slovakia']);
     $swan->prefixes()->attach(22);
 }
 /**
  * Создаем тестовых пользователей
  */
 public function run()
 {
     $this->command->info('Создаем пользователя: Администратор');
     $credentials = array('email' => '*****@*****.**', 'password' => 'admin1111', 'first_name' => 'Иван', 'last_name' => 'Петров', 'company' => 'Такси-сервис', 'city' => 'г. Вологда', 'phone' => '+7 (911) 501-55-55');
     $user = Sentinel::register($credentials);
     $role = Sentinel::findRoleBySlug('admin');
     $role->users()->attach($user);
     // Добавляем оператора
     Operator::create(array('user_id' => $user->id, 'name' => $user->first_name . ' ' . $user->last_name));
     $this->command->info('Создаем пользователя: Тестовый');
     $credentials = array('email' => '*****@*****.**', 'password' => 'admin1111', 'first_name' => 'Екатерина', 'last_name' => 'Климова', 'company' => 'Белка тур', 'city' => 'г. Вологда', 'phone' => '+7 (911) 233-33-33');
     $user = Sentinel::register($credentials);
     $role = Sentinel::findRoleBySlug('user');
     $role->users()->attach($user);
     // Добавляем оператора
     Operator::create(array('user_id' => $user->id, 'name' => $user->first_name . ' ' . $user->last_name));
 }
 /**
  * Окно редактирования заказа
  */
 public function getEditOrder($order_id = null)
 {
     $this->data['order'] = Order::where('ident', '=', $order_id)->firstOrFail();
     $this->data['person'] = Person::findOrFail($this->data['order']->customer);
     $this->page->title = $this->data['person']->last_name . ' ' . $this->data['person']->first_name . ' ' . $this->data['person']->middle_name;
     $this->page->desc = 'Редактирование заказа';
     // Список операторов
     $this->data['operators'] = Operator::where('user_id', '=', $this->user->id)->lists('name', 'id');
     // Список аэропортов
     $this->data['airports'] = Airport::all()->lists('airport', 'id');
     // Кол-во пассажиров
     $this->data['passengers'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10);
     return $this->render('order.edit');
 }
 public function index()
 {
     $operators = Operator::all();
     $gateways = Gateway::all();
     return view('gateway.index')->with('operators', $operators)->with('gateways', $gateways);
 }
 /**
  * Регистрация нового пользователя
  */
 public function postUserCreate(Requests\UserCreate $request)
 {
     try {
         $user = Sentinel::create(array('email' => $request->input('email'), 'password' => $request->input('password'), 'first_name' => $request->input('first_name'), 'last_name' => $request->input('last_name'), 'activated' => true));
         $user->city = $request->input('city');
         $user->company = $request->input('company');
         $user->phone = $request->input('phone');
         $user->save();
         $role = Sentinel::findRoleBySlug('user');
         $role->users()->attach($user);
     } catch (\Exception $e) {
         $this->SetErrorNotifyMessage('Ошибка выполнения операции.');
         return redirect()->back();
     }
     // Добавляем оператора с таким же именем
     Operator::create(array('user_id' => $user->id, 'name' => $request->input('first_name') . ' ' . $request->input('last_name')));
     $this->SetSuccessNotifyMessage('Пользователь &laquo;<strong>' . $request->input('first_name') . ' ' . $request->input('last_name') . '</strong>&raquo; успешно добавлен');
     return redirect()->back();
 }