Esempio n. 1
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param array $data
  *
  * @return User
  */
 protected function create(array $data)
 {
     $license = License::where('license', $data['code'])->where('used', 0)->first();
     if ($license == null) {
         return redirect()->to('/register')->with('Error', 'Je licentie code is incorrect');
     }
     $user = User::create(['name' => $data['name'], 'code' => $data['code'], 'province_id' => $data['province'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     $user->addLicense($license);
     return $user;
 }
Esempio n. 2
0
 private function _users()
 {
     $provinces = Province::all();
     foreach ($provinces as $p) {
         $faker = \Faker\Factory::create();
         $user = new User();
         $user->name = $faker->name;
         $user->province_id = $p->id;
         $user->email = $faker->email;
         $user->password = Hash::make('123456');
         $user->save();
         $license = License::where('used', 0)->first();
         $license->used = 1;
         $license->save();
         $license->user()->attach($user);
         $score = new Score();
         $score->score = rand(100, 3500);
         $score->license = $license->license;
         $score->save();
     }
 }
 public function claim_license()
 {
     $licenseKey = Input::get('license_key');
     $productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
     $license = License::where('license_key', '=', $licenseKey)->where('is_claimed', '<', 3)->where('product_id', '=', $productId)->first();
     if ($license) {
         if ($license->transaction_reference != 'TEST_MODE') {
             $license->is_claimed = $license->is_claimed + 1;
             $license->save();
         }
         return $productId == PRODUCT_INVOICE_DESIGNS ? $_ENV['INVOICE_DESIGNS'] : 'valid';
     } else {
         return 'invalid';
     }
 }
 public function claim_license()
 {
     $licenseKey = Input::get('license_key');
     $productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
     $license = License::where('license_key', '=', $licenseKey)->where('is_claimed', '<', 5)->where('product_id', '=', $productId)->first();
     if ($license) {
         if ($license->transaction_reference != 'TEST_MODE') {
             $license->is_claimed = $license->is_claimed + 1;
             $license->save();
         }
         return $productId == PRODUCT_INVOICE_DESIGNS ? file_get_contents(storage_path() . '/invoice_designs.txt') : 'valid';
     } else {
         return 'invalid';
     }
 }
 public function claim_license()
 {
     $licenseKey = Input::get('license_key');
     $productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
     $license = License::where('license_key', '=', $licenseKey)->where('is_claimed', '<', 5)->where('product_id', '=', $productId)->first();
     if ($license) {
         if ($license->transaction_reference != 'TEST_MODE') {
             $license->is_claimed = $license->is_claimed + 1;
             $license->save();
         }
         if ($productId == PRODUCT_INVOICE_DESIGNS) {
             return file_get_contents(storage_path() . '/invoice_designs.txt');
         } else {
             // temporary fix to enable previous version to work
             if (Input::get('get_date')) {
                 return $license->created_at->format('Y-m-d');
             } else {
                 return 'valid';
             }
         }
     } else {
         return RESULT_FAILURE;
     }
 }
 /**
  * Auto set the users license
  *
  * @param string $licenseID
  */
 public static function getAutoLicense($licenseID)
 {
     $license = null;
     if ($licenseID) {
         $license = License::where(['slug' => $licenseID])->first();
     }
     return $license;
 }