Exemplo n.º 1
0
 public function virtual_to_cubi(Request $request, Service $service)
 {
     $this->validate($request, ['quantity' => 'required|numeric|min:1']);
     $user = Auth::user();
     $role = $user->characterId();
     if ($user->money >= $request->quantity * $service->price) {
         if (!$this->checkOnline($role)) {
             $user->money = $user->money - $request->quantity * $service->price;
             $user->save();
             Transfer::create(['user_id' => $user->ID, 'zone_id' => 1, 'cash' => $request->quantity * 100]);
             flash()->success(trans('services.' . $service->key . '.complete'));
         } else {
             flash()->error(trans('services.must_logout'));
         }
     } else {
         flash()->error(trans('main.not_enough', ['currency' => strtolower(settings('currency_name'))]));
     }
 }
Exemplo n.º 2
0
 public function postCheck(Request $request, VoteSite $site)
 {
     if (!VoteLog::recent($request, $site)->exists()) {
         switch ($site->type) {
             case 'virtual':
                 $user = Auth::user();
                 $user->money = $site->double_rewards ? $site->reward_amount * 2 : $site->reward_amount + $user->money;
                 $user->save();
                 break;
             case 'cubi':
                 Transfer::create(['user_id' => Auth::user()->ID, 'zone_id' => 1, 'cash' => $site->double_rewards ? $site->reward_amount * 2 : $site->reward_amount]);
                 break;
         }
         VoteLog::create(['user_id' => Auth::user()->ID, 'ip_address' => $request->ip(), 'reward' => $site->double_rewards ? $site->reward_amount * 2 : $site->reward_amount, 'site_id' => $site->id]);
         return redirect('vote/success/' . $site->id);
     } else {
         flash()->error(trans('vote.already_voted'));
         return redirect()->back();
     }
 }
 /**
  * Run the database seed for account "Compte joint".
  *
  * @return void
  */
 public function runAccount1()
 {
     Transfer::create(['from_account_id' => 1, 'to_account_id' => 3, 'name' => "Surplus de liquidité", 'amount' => 1000, 'date' => Carbon::create(2015, 8, 5, 0)]);
     Transfer::create(['from_account_id' => 1, 'to_account_id' => 4, 'name' => 'Virement au PEL', 'amount' => 45, 'date' => Carbon::create(2015, 8, 17, 0)]);
     Transfer::create(['from_account_id' => 1, 'to_account_id' => 2, 'name' => 'Virement au CSL', 'amount' => 10, 'date' => Carbon::create(2015, 8, 17, 0)]);
 }
 /**
  * Run the database seed for account "CEL".
  *
  * @return void
  */
 public function runAccount3()
 {
     Transfer::create(['from_account_id' => 3, 'to_account_id' => 1, 'name' => "Manque de liquidité", 'amount' => 1000, 'date' => Carbon::create(2015, 7, 30, 0)]);
 }