/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 33;
     Investor::create(['email' => '*****@*****.**', 'name' => $faker->firstName, 'phone' => $faker->phoneNumber, 'passport_num' => strtoupper($faker->bothify('????####')), 'dob' => $faker->date("d-m-Y"), 'acc_period_start' => '01-03-2015', 'acc_period_end' => '28-02-2016', 'tracking_url' => 'http://gpslive.co.uk/login.php?au=2FD967CDDADD7FA7F1C97DB8422CBF2E']);
     for ($i = 0; $i < $limit; $i++) {
         Investor::create(['email' => $faker->unique()->email, 'name' => $faker->firstName, 'phone' => $faker->phoneNumber, 'passport_num' => strtoupper($faker->bothify('????####')), 'dob' => $faker->date("d-m-Y"), 'acc_period_start' => '01-03-2015', 'acc_period_end' => '28-02-2016', 'tracking_url' => 'http://gpslive.co.uk/login.php?au=2FD967CDDADD7FA7F1C97DB8422CBF2E']);
     }
 }
Esempio n. 2
0
 public function sendMail()
 {
     $user = User::find(2);
     $investor = Investor::find(10);
     Mail::send('emails.reminder', ['user' => $user, 'investor' => $investor], function ($m) use($user) {
         $m->from('*****@*****.**', 'Cars2Let Investor Reporting');
         $m->to('*****@*****.**', $user->name)->subject('Your Reminder!');
     });
 }
 public function updateTransaction(SaveTransactionPostRequest $request)
 {
     DB::transaction(function () use($request) {
         $transaction = Transaction::find($request->input('id'));
         $transaction->transactionDate = Carbon::parse($request->input('transactionDate'))->toDateString();
         $transaction->amount = $request->input('amount');
         $transaction->transaction_type_id = $request->input('transaction_type_id');
         $transaction->notes = $request->input('notes') === '' ? null : $request->input('notes');
         $transaction->save();
         $investor = Investor::find($transaction->investor_id);
         $investor->balance = $this->computeBalance($investor->id);
         $investor->save();
         return response()->json(['status' => 'success']);
     });
 }
 /**
  *	
  *	Description: Check and Save Account and Investors
  * 	Component: CreateInvestorAccount
  *
  */
 public function addAccount(ValidateAddInvestorPostRequest $request)
 {
     try {
         //Create user
         $isUsernameExist = true;
         $username = '';
         while ($isUsernameExist) {
             $username = '******' . (string) Uuid::uuid4();
             if (!User::where('userName', $username)->first()) {
                 $isUsernameExist = false;
             }
         }
         $user = User::create(['username' => $username]);
         $user->user_role_id = UserRole::where('name', 'Investor')->first()->id;
         $user->save();
     } catch (\Exception $e) {
         $user->delete();
         throw $e;
     }
     try {
         // Create Account
         $account = Account::create(['name' => $request->input('accountName'), 'type' => $request->input('accountType')]);
         $account->user_id = $user->id;
         $account->save();
     } catch (\Exception $e) {
         $user->delete();
         $account->delete();
         throw $e;
     }
     try {
         // Add Investor
         $investor = Investor::create(['firstName' => $request->input('firstName'), 'middleName' => $request->input('middleName') === '' ? null : $request->input('middleName'), 'lastName' => $request->input('lastName'), 'email' => $request->input('email') === '' ? null : $request->input('email')]);
         $investor->isOwner = true;
         $investor->account_id = $account->id;
         $investor->save();
     } catch (\Exception $e) {
         $user->delete();
         $account->delete();
         throw $e;
     }
     try {
         // Add Co Investors if Account Type = 'joint'
         if ($request->input('accountType') === 'joint') {
             foreach ($request->input('coInvestors') as $index => $value) {
                 $coInvestor = Investor::create(['firstName' => $value['coFirstName'], 'middleName' => $value['coMiddleName'] === '' ? null : $value['coMiddleName'], 'lastName' => $value['coLastName']]);
                 $coInvestor->account_id = $account->id;
                 $coInvestor->save();
             }
         }
     } catch (\Exception $e) {
         $investor = Investor::where('account_id', $account->id)->delete();
         $user->delete();
         $account->delete();
         throw $e;
     }
     return response()->json(['status' => 'success', 'message' => 'New Account Created.']);
 }
Esempio n. 5
0
 public function admin_store(RegisterInvestorRequest $request)
 {
     $user = User::where('email', $request->input('email'))->first();
     $mono = Log::getMonolog();
     $mono->pushHandler(new \Monolog\Handler\FirePHPHandler());
     $mono->addInfo("Investor store", $request->all());
     Investor::create($request->all());
     if ($user == null) {
         User::create(['email' => $request->input('email'), 'password' => bcrypt('sample'), 'status' => 'new', 'type' => 'investor']);
     } else {
         $user->type = 'investor';
         $user->save();
     }
     $activator = AccountActivation::create(['delivered_to' => $request->input('email'), 'active' => true, 'destination' => 'email', 'source' => 'admin']);
     $activator->renew();
     $activator->send();
     return redirect(url('/admin/investor/all'));
 }
Esempio n. 6
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $in = Investor::create(['email' => $data['email'], 'name' => $data['name']]);
     return User::create(['email' => $data['email'], 'password' => bcrypt($data['password']), 'status' => 'active', 'type' => 'investor']);
 }
 public function setUserCredentials(ValidateUserCredentialsPostRequest $request)
 {
     $investor = Investor::where('verification_code', $request->input('verification_code'))->first();
     $investor->account->user->username = $request->input('username');
     $investor->account->user->password = bcrypt($request->input('password'));
     $investor->account->user->password_changed_at = Carbon::now();
     $investor->account->user->is_active = true;
     $investor->account->user->email = $investor->email;
     $investor->account->user->touch();
     $investor->account->user->save();
     $investor->account->touch();
     $investor->account->save();
     $investor->verification_code = null;
     $investor->is_email_verified = true;
     $investor->touch();
     $investor->save();
     return response()->json(['status' => 'success', 'url' => route('memberLogin')]);
 }
Esempio n. 8
0
 public function verifyInvestor($verification_code)
 {
     if (Investor::where('verification_code', $verification_code)->count() > 0) {
         return view('modules.application.verify');
     }
 }