Esempio n. 1
0
 public function save(Request $request)
 {
     $input = $request->all();
     // $field_name = implode('|',$input['website']['locales']);
     $company = new Company();
     $company->name = $input['client']['company_name'];
     $company->alias = $input['website']['sub_name'];
     $company->save();
     $user = new User();
     $user->name = $input['client']['name'];
     $user->email = $input['client']['email'];
     $user->password = $input['client']['password'];
     $user->ip = '*';
     $user->branch_id = 1;
     $user->company_id = $company->id;
     $user->active = 1;
     $user->save();
     $user->roles()->attach(Role::find(1)->id);
     // $gr_fields = new GrFields;
     // $gr_fields->field_name = $field_name;
     // $gr_fields->company_id = $company->id;
     // $gr_fields->save();
     session(['input' => $input]);
     return redirect('thanks');
 }
Esempio n. 2
0
 public function profile($id)
 {
     $company = new Company();
     $province = new Province();
     $object = $company->_getById($id);
     $provinces = $province->_getAll();
     return view('company.profile', compact('object', 'provinces'));
 }
 public static function saveCompanyDetails(Request $request)
 {
     $rules = self::getRules();
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/system/company')->withErrors($validator)->withInput()->send();
     } else {
         $companyDetailsContent = CompanyRepository::count();
         if ($companyDetailsContent > 0) {
             $companyDetails = CompanyRepository::getCompanyDetails();
             if ($request->file('company_logo_name')) {
                 if ($companyDetails->company_logo_name != null) {
                     CommonTasks::deleteImage($companyDetails->company_logo_name);
                 }
                 $storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
                 $companyDetails->company_logo_name = $storageName;
             } else {
                 if ($request->get('clear_check') == 'checked') {
                     CommonTasks::deleteImage($companyDetails->company_logo_name);
                     $companyDetails->company_logo_name = null;
                 }
             }
             $companyDetails->company_name = $request->get("company_name");
             $companyDetails->company_description = $request->get("company_description");
             $companyDetails->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
             $companyDetails->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
             $companyDetails->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
             $companyDetails->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
             $companyDetails->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
             $companyDetails->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
             $companyDetails->push();
             Session::flash('message', 'Company Information Saved');
             return Redirect::to('/system/company')->send();
         } else {
             $company = new Company();
             $company->company_name = $request->get("company_name");
             $company->company_description = $request->get("company_description");
             $company->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
             $company->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
             $company->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
             $company->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
             $company->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
             $company->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
             if ($request->file('company_logo_name')) {
                 $storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
                 $company->company_logo_name = $storageName;
             } else {
                 $company->company_logo_name = null;
             }
             $company->save();
             Session::flash('message', 'Company Information Saved');
             return Redirect::to('/system/company')->send();
         }
     }
 }
Esempio n. 4
0
 public function edit($id)
 {
     $userName = Auth::user()->name;
     $companies = Company::all();
     $campain = Campain::find($id);
     return view('campain.edit', ['userName' => $userName, 'companies' => $companies, 'campain' => $campain]);
 }
Esempio n. 5
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('article', function ($value) {
         return $this->getArticle()->where('slug', $value)->firstOrFail();
     });
     $router->bind('cong-ty', function ($value) {
         return \App\Company::where('slug', $value)->firstOrFail();
     });
     $router->bind('thiet-ke-thi-cong', function ($value) {
         return $this->designModel->getDesigns()->where('designs.slug', $value)->firstOrFail();
     });
     $router->bind('house', function ($value) {
         return $this->houseModel->getHouses()->where('houses.slug', $value)->firstOrFail();
     });
     $router->bind('company', function ($value) {
         return \App\Company::where('slug', $value)->firstOrFail();
     });
     $router->bind('project', function ($value) {
         return $this->projectModel->getProjects()->where('projects.slug', $value)->firstOrFail();
     });
     $router->model('owner', 'App\\House');
     $router->model('agency', 'App\\House');
     $router->model('message', 'App\\Message');
     parent::boot($router);
 }
Esempio n. 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $validator = Validator::make($request->all(), ['name' => 'required|unique:papers', 'size' => 'required|unique:papers']);
     if ($validator->fails()) {
         if ($request->ajax()) {
             return response()->json($validator->messages());
             exit;
         } else {
             return \Redirect::back()->withErrors($validator)->withInput();
         }
     }
     array_forget($request, "_token");
     $all_request = $request->all();
     $paper = new Paper();
     foreach ($all_request as $key => $value) {
         $paper->{$key} = $value;
     }
     $paper->save();
     $papers = Paper::all();
     if ($request->ajax()) {
         if ($papers) {
             foreach ($papers as $paper) {
                 echo "\n                        <tr>\n                            <td>{$paper->id}</td>\n                            <td>{$paper->name}</td>\n                            <td>{$paper->description}</td>\n                            <td>{$paper->dimension}</td>\n                            <td>{$paper->unit}</td>\n\n                            <td><button class='edtPaperLink btn-primary' cid='{$paper->id}' cname='{$paper->name}' cdescription='{$paper->description}' cdimension='{$paper->dimension}' cunit='{$paper->unit}'><span  class='glyphicon glyphicon-pencil'></span></button></td>\n                            <td><button class='btn-danger'  data-target='#myModalPaperEdit' data-toggle='modal'><span  class='glyphicon glyphicon-trash'></span></button></td>\n                        </tr>\n                        ";
             }
         }
         exit;
     }
     return View("settings.paper", ["companies" => Company::all(), 'papers' => $papers, 'title' => 'Job Papers Setting']);
 }
Esempio n. 7
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 20; $i++) {
         \App\Company::create(['title' => $faker->unique()->company, 'address' => $faker->streetAddress, 'phone' => $faker->phoneNumber]);
     }
 }
 public function authenticate(Request $request)
 {
     // TODO: authenticate JWT
     $credentials = $request->only('email', 'password');
     // dd($request->all());
     // Validate credentials
     $validator = Validator::make($credentials, ['password' => 'required', 'email' => 'required']);
     if ($validator->fails()) {
         return response()->json(['message' => 'Invalid credentials', 'errors' => $validator->errors()->all()], 422);
     }
     // Get user by email
     $company = Company::where('email', $credentials['email'])->first();
     // Validate Company
     if (!$company) {
         return response()->json(['error' => 'Invalid credentials'], 422);
     }
     // Validate Password
     if (!Hash::check($credentials['password'], $company->password)) {
         return response()->json(['error' => 'Invalid credentials'], 422);
     }
     // Generate Token
     $token = JWTAuth::fromUser($company);
     // Get expiration time
     $objectToken = JWTAuth::setToken($token);
     $expiration = JWTAuth::decode($objectToken->getToken())->get('exp');
     return response()->json(['access_token' => $token, 'token_type' => 'bearer', 'expires_in' => $expiration]);
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $type = $this->input('type_request');
     if ($type == 0) {
         return ['name' => 'required|max:255|unique:companies', 'email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'required|min:5|max:20|same:confirm_password', 'confirm_password' => 'required|min:5'];
     } else {
         $email = $this->input('email');
         $name = $this->input('name');
         $user_id = $this->input('user_id');
         $company_id = $this->input('company_id');
         $company = Company::findOrFail($company_id);
         $user = User::findOrFail($user_id);
         if ($user->email == $email) {
             if ($company->name == $name) {
                 return ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
             } else {
                 return ['name' => 'required|max:255|unique:companies', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
             }
         } else {
             if ($company->name == $name) {
                 return ['email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
             } else {
                 return ['name' => 'required|max:255|unique:companies', 'email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
             }
         }
     }
 }
 public function updateCompany(Request $request)
 {
     $company = Company::find(Auth::user()->company_id);
     if ($request->has('company-name')) {
         $company->name = $request->input('company-name');
     }
     if ($request->has('address')) {
         $company->address = $request->input('address');
     }
     if ($request->has('city')) {
         $company->city = $request->input('city');
     }
     if ($request->has('state')) {
         $company->state = $request->input('state');
     }
     if ($request->has('zip')) {
         $company->zip = $request->input('zip');
     }
     if ($request->has('email')) {
         $company->email = $request->input('email');
     }
     if ($request->has('phone')) {
         $company->phone = $request->input('phone');
     }
     $request->session()->flash('success', 'Company Updated!');
     $company->save();
     $team = User::where('company_id', $company->id)->where('user_type', 2)->get();
     return view('manage.company', ['company' => Company::find(Auth::user()->company_id), 'team' => $team]);
 }
Esempio n. 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param int $id
  *
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $data = $request->except(['created_at', 'deleted_at']);
     $company = Company::find($id);
     $company->update($data);
     return redirect()->to('wpanel/profile');
 }
Esempio n. 12
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         \App\Company::create(['name' => $faker->company()]);
     }
 }
Esempio n. 13
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $companies = Company::all();
     $accountancies = Accountancy::all();
     return view('admin.accountancy.index')->with(['companies' => $companies, 'accountancies' => $accountancies]);
 }
Esempio n. 14
0
 public function showSettings()
 {
     $companies = \App\Company::all()->lists('name', 'id');
     $current_company = \App\Company::find(Auth::user()->current_company);
     //        dd($current_company);
     return view('settings.settings', compact('companies', 'current_company'));
 }
Esempio n. 15
0
 /**
  * Update the users profile
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = User::find($request->input('user_id'));
     $user->name = $request->input('name');
     $user->email = $request->input('email');
     $user->username = $request->input('username');
     if ($request->input('password') != '') {
         $user->password = bcrypt($request->input('password'));
     }
     $user->update();
     $company = Company::where('user_id', $request->input('user_id'))->first();
     $company->name = $request->input('company_name');
     $company->description = $request->input('company_description');
     $company->phone = $request->input('company_phone');
     $company->email = $request->input('company_email');
     $company->address1 = $request->input('company_address');
     $company->address2 = $request->input('company_address2');
     $company->city = $request->input('company_city');
     $company->postcode = $request->input('company_postcode');
     if ($request->hasFile('logo')) {
         $file = $request->file('logo');
         $name = Str::random(25) . '.' . $file->getClientOriginalExtension();
         $image = Image::make($request->file('logo')->getRealPath())->resize(210, 113, function ($constraint) {
             $constraint->aspectRatio();
         });
         $image->save(public_path() . '/uploads/' . $name);
         $company->logo = $name;
     }
     $company->update();
     flash()->success('Success', 'Profile updated');
     return back();
 }
Esempio n. 16
0
 public function getViewCompany($id)
 {
     if (Auth::user()->company_id != $id && !$this->entrust->hasRole("super_admin")) {
         return "You are Not Authrized to View Any Other Company's Profile ";
     }
     $company = Company::where("id", $id)->with(["customers"])->first();
     return view("company", ["company" => $company]);
 }
Esempio n. 17
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     // $this->validate($request, $this->form_rules);
     $data = ['name' => $request->input('name'), 'website_name' => $request->input('website_name'), 'slogan' => $request->input('slogan'), 'phone_number' => $request->input('phone_number'), 'cell_phone' => $request->input('cell_phone'), 'address' => $request->input('address'), 'state' => $request->input('state'), 'city' => $request->input('city'), 'facebook' => $request->input('facebook'), 'facebook_app_id' => $request->input('facebook_app_id'), 'twitter' => $request->input('twitter'), 'zip_code' => $request->input('zip_code'), 'google_maps_key_api' => $request->input('google_maps_key_api'), 'email' => $request->input('email'), 'contact_email' => $request->input('contact_email'), 'sales_email' => $request->input('sales_email'), 'support_email' => $request->input('support_email'), 'description' => $request->input('description'), 'keywords' => $request->input('keywords'), 'about_us' => $request->input('about_us'), 'refund_policy' => $request->input('refund_policy'), 'privacy_policy' => $request->input('privacy_policy'), 'terms_of_service' => $request->input('terms_of_service')];
     $company = Company::find($id);
     $company->update($data);
     return redirect()->to('wpanel/profile');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //return view('Email.welcome');
     //
     $companies = \App\Company::where('active', 1)->get();
     $periods = \App\Period::where('active', 1)->get();
     return view('Admin.Registry.Company.company', ['companies' => $companies, 'periods' => $periods]);
 }
Esempio n. 19
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $project = \App\Project::findOrFail($id);
     $yearslist = \App\Year::lists('year', 'id');
     $companies = \App\Company::findOrFail($project->company_id);
     $officers_for_dropdown = \App\Officer::lists('last_name', 'id');
     return view('pages.project.edit', compact('project', 'companies', 'officers_for_dropdown', 'yearslist'));
 }
 /**
  * Страница редактирования группы категорий.
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function getEdit($id)
 {
     // Ищем фирму по короткому названию
     $data['company'] = Company::whereShortTitle($this->companyName)->first();
     // Ищем группу
     $data['group_category'] = $this->findGroupCategory($id);
     return view('admin.companies.catalog.groups_categories.edit', $data);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // unguard()メソッドは、EloquentのマスアサインメントをOFFにします。
     Model::unguard();
     //
     Company::create(['id' => 1, 'company_id' => 1, 'name' => '株式会社VApps', 'name_kana' => 'ぶいあっぷす']);
     Company::create(['id' => 2, 'company_id' => 2, 'name' => '株式会社PApps', 'name_kana' => 'ぴーあっぷす']);
     Company::create(['id' => 3, 'company_id' => 3, 'name' => '株式会社AApps', 'name_kana' => 'あーあっぷす']);
 }
 public function edit($id)
 {
     $pl_data = \App\PerangkatLunak::find($id);
     $medias = \App\Media::lists('nama_media', 'id');
     $licenses = \App\License::lists('nama_license', 'id');
     $jenises = \App\Jenis::lists('nama_jenis', 'id');
     $companies = \App\Company::lists('nama_company', 'id');
     return view('perangkat_lunak.edit', ['pl_data' => $pl_data, 'medias' => $medias, 'licenses' => $licenses, 'jenises' => $jenises, 'companies' => $companies]);
 }
Esempio n. 23
0
 /**
  * Отображает индексную страницу модуля
  *
  * @return \Illuminate\View\View
  */
 public function getShow($shortTitle)
 {
     // Ищем кфирму по короткому названию
     $data['company'] = Company::whereShortTitle($shortTitle)->first();
     if (empty($data['company'])) {
         abort(404);
     }
     return view('marketing.companies.descriptions.show', $data);
 }
 public function run()
 {
     DB::table('companies')->truncate();
     Model::unguard();
     Company::create(['title' => 'Sika', 'short_title' => 'sika', 'file_main' => '1.jpg', 'file_logo' => '1.png']);
     Company::create(['title' => 'SFS intec', 'short_title' => 'sfs', 'file_main' => '2.jpg', 'file_logo' => '2.png']);
     Company::create(['title' => 'Праймер', 'short_title' => 'primer', 'file_main' => '3.jpg', 'file_logo' => '3.png']);
     Model::reguard();
 }
Esempio n. 25
0
 public function index()
 {
     $data['is_showzhiye'] = Zhiye::where('z_show', '=', '1')->get();
     $data['allzhiye'] = Zhiye::all();
     $data['is_showcompany'] = Company::where('c_show', '=', '1')->get();
     $data['allcompany'] = Company::all();
     $data['alltime'] = Time::all();
     return view('contestRoom.index', $data);
 }
Esempio n. 26
0
 public function destroy($id)
 {
     $company = Company::findOrFail($id);
     $company->delete();
     session()->flash('flash_message_danger', 'Empresa borrada correctamente.');
     //        Si flash_message_important esta presente, el mensaje no desaparece hasta que el usuario lo cierre
     //        session()->flash('flash_message_important', true);
     return redirect('empresas');
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function alias(Request $request)
 {
     if ($request->ajax()) {
         $user = \App\Company::where('alias', $request->get('alias'))->get();
         if ($user->count()) {
             return Response::json(array('msg' => 'true'));
         }
         return Response::json(array('msg' => 'false'));
     }
 }
Esempio n. 28
0
 function index()
 {
     $user = Auth::user();
     $posts = Post::latest('id')->get();
     $companies = Company::all();
     $users = User::all();
     $testvar = "XYZABC";
     return view('users.test', compact('testvar'));
     return view('users.index', compact('user', 'posts', 'companies', 'users'));
 }
Esempio n. 29
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 1; $i++) {
         $companyName = str_replace('-', ' ', $faker->unique()->company);
         $userName = str_replace([' ', ','], '', $companyName);
         $domain = $userName . $faker->randomElement(['.com', '.net', '.org']);
         Company::create(['status' => $faker->randomElement(['active', 'inactive']), 'name' => $companyName, 'website_name' => $companyName, 'slogan' => $faker->catchPhrase, 'logo' => '/img/pt-default/' . $faker->unique()->numberBetween(1, 330) . '.jpg', 'theme' => '', 'phone_number' => $faker->phoneNumber, 'cell_phone' => $faker->phoneNumber, 'address' => $faker->streetAddress, 'state' => $faker->state, 'city' => $faker->city, 'zip_code' => $faker->postcode, 'facebook' => $userName, 'google_plus' => $userName, 'facebook_app_id' => $faker->md5, 'twitter' => $userName, 'email' => 'info@' . $domain, 'contact_email' => 'contact@' . $domain, 'sales_email' => 'sales@' . $domain, 'support_email' => 'support@' . $domain, 'website' => 'http://' . $domain, 'description' => $faker->text(200), 'keywords' => implode(',', $faker->words(20)), 'about_us' => $faker->text(1200), 'refund_policy' => trans('law.refund'), 'privacy_policy' => trans('law.privacy'), 'terms_of_service' => trans('law.terms'), 'google_maps_key_api' => 'AIzaSyCutQnEgrqX8W2X-nBCYB7-CbsTC-LlRMw']);
     }
 }
Esempio n. 30
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $newUser = ['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'user_type' => $data['user_type'], 'phone' => $data['phone']];
     $user = User::create($newUser);
     // SE É EMPRESA CRIAR TAMBÉM UM REGISTRO NA TABELA COMPANY
     if ($data['user_type'] == 'COMPANY') {
         Company::create(['id_user' => $user->id_user, 'cnpj' => ${$data}['cnpj']]);
     }
     return $user;
 }