/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     if ($request->hasFile('logo')) {
         $file = $request->file('logo');
         $name = 'logo_' . time() . '.' . $file->getClientOriginalExtension();
         $path = public_path('/assets/img');
         $file->move($path, $name);
     }
     $data = Companies::find($id);
     $data->fill($request->all());
     $data->logo = @$name;
     $data->save();
     Flash::success('Cambios Realizados!');
     return redirect()->route('empresas.edit', $id);
 }
Exemple #2
0
 public function index()
 {
     for ($i = 0; $i < 20; $i++) {
         Factory::create(App\Companies::class, 1);
         $company = Companies::all()->last();
         $randNum = rand(0, 10);
         for ($x = 0; $x < $randNum; $x++) {
             Factory::create(App\Employees::class);
             $user = Employees::all()->last();
             $company->employees->attach($user);
         }
     }
     //        factory(App\Companies::class, 50)->create()->each(function($c) {
     //            $c->employees()->addTo(factory(App\Employees::class)->make());
     //        });
 }
Exemple #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $company = Companies::find($id);
     $company->delete();
     if ($company == null) {
         return new JsonResponse(['message' => 'Not able to find this company'], 404);
     }
     return new JsonResponse([], 204);
 }
Exemple #4
0
 public function verifyPagePost(Request $request)
 {
     $this->validate($request, ['password' => 'required']);
     //var_dump($request);
     $companies = Companies::where('company_name', $request->company)->first();
     //var_dump($companies);
     if ($companies && Hash::check($request->password, $companies->verification_password)) {
         return redirect('/register?source=' . base64_encode("verify"));
     } else {
         return back()->withInput()->with('error', 'The Password is incorrect');
     }
 }