public function index()
 {
     $data['module'] = $this->module;
     $data['module_name'] = $this->module_name;
     $data['companies'] = Company::Active();
     return view('accounts.companies.lists', $data);
 }
 public function run()
 {
     Model::unguard();
     DB::table('companies')->truncate();
     Company::create(['id' => 1, 'name' => 'Pronueva Ltda.', 'logo_url' => '/images/logo_pronueva.png', 'email' => '*****@*****.**', 'website' => 'http://www.pronueva.com', 'company_type_id' => '0', 'status' => '1', 'weight' => '1']);
 }
 public function edit($id)
 {
     $data['module'] = $this->module;
     $data['module_name'] = $this->module_name;
     $data['sections'] = $this->sections;
     $group = $this->group;
     $group = $group::where('id', $id)->first();
     $delimiter = array('{', '"', '}', ':', '1');
     $permissions = str_replace($delimiter, "", explode(',', $group->permission));
     $data['permissions'] = $permissions;
     $data['companies'] = Company::Active()->lists('name', 'id');
     $data['group'] = $group;
     $data['sub_module'] = 'Editar usuario';
     $data['action'] = 'update/';
     return view('accounts.groups.edit', $data);
 }
 public function edit($id)
 {
     $data['module'] = $this->module;
     $data['module_name'] = $this->module_name;
     $user = $this->user;
     $data['user'] = $user::where('id', $id)->first();
     $groups_company = CompanyGroup::where('company_id', $data['user']->company_id)->get();
     if (count($groups_company) < 1) {
         $data['groups'] = array('0' => 'No hay grupos asociados a esta empresa');
     } else {
         foreach ($groups_company as $gc) {
             $groups[] = $gc->group_id;
         }
         $data['groups'] = array('0' => 'Seleccione...') + Group::whereIn('id', $groups)->lists('name', 'id');
     }
     $data['sub_module'] = 'Editar usuario';
     $data['companies'] = array('0' => 'Seleccionar') + Company::Active()->lists('name', 'id');
     $data['action'] = 'update/';
     return view('accounts.users.edit', $data);
 }