示例#1
0
 /**
  * Displays collection of companies.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $limit = isset($_GET['limit']) ? $_GET['limit'] : 0;
     $start = isset($_GET['start']) ? $_GET['start'] : 0;
     $accept = $this->getAcceptHeaders();
     $amountCompanies = Companies::count();
     $companies = Companies::where('created_at', '!=', '');
     if ($start > 0) {
         $companies = $companies->skip((int) $start);
     }
     if ($limit > 0) {
         $companies->take($limit);
     }
     $this->_pagination = $this->createPagination($companies, $amountCompanies, $start, $limit);
     $companies = $companies->get();
     if ($accept == 'application/json') {
         return $this->makeJson($companies);
     } elseif ($accept == 'application/xml') {
         header('Content-type: application/xml');
         echo $this->makeXML($companies);
         return;
     }
     return new JsonResponse(['message' => 'Unsupported format: ' . $accept], 415);
 }
示例#2
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');
     }
 }