예제 #1
1
 public function slots()
 {
     $user = Auth::user();
     $location = $user->location;
     $slot = Slot::where('location', '=', $location)->first();
     $input = Input::get('wager');
     $owner = User::where('name', '=', $slot->owner)->first();
     $num1 = rand(1, 10);
     $num2 = rand(5, 7);
     $num3 = rand(5, 7);
     if ($user->name != $owner->name) {
         if ($num1 & $num2 & $num3 == 6) {
             $money = rand(250, 300);
             $payment = $money += $input * 1.75;
             $user->money += $payment;
             $user->save();
             session()->flash('flash_message', 'You rolled three sixes!!');
             return redirect('/home');
         } else {
             $user->money -= $input;
             $user->save();
             $owner->money += $input;
             $owner->save();
             session()->flash('flash_message_important', 'You failed to roll three sixes!!');
             return redirect(action('SlotsController@show', [$slot->location]));
         }
     } else {
         session()->flash('flash_message_important', 'You own this slot!!');
         return redirect(action('SlotsController@show', [$slot->location]));
     }
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach (Slot::all() as $slot) {
         foreach (Recruiter::all() as $recruiter) {
             DB::table('interviews')->insert(['slot_id' => $slot->id, 'recruiter_id' => $recruiter->id]);
         }
     }
 }
예제 #3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function checkExit($id)
 {
     $slot = \App\Slot::find($id);
     if ($slot->exitslot() == true) {
         $msg = "EXIT";
     } else {
         $msg = "NO EXIT";
     }
     return view('check')->with('msg', $msg);
 }
예제 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $slot = Slot::findOrFail($id);
     if (!$slot->user_id) {
         $slot->user_id = \Auth::user()->id;
         $slot->save();
         return "success";
     } else {
         return "error";
     }
 }
예제 #5
0
파일: AddSlots.php 프로젝트: vftk/bana
 private function addSlotsForDay(Carbon $day)
 {
     $result = '';
     $courts = [3, 4, 5, 6];
     $hours = [15, 16, 17, 18];
     foreach ($courts as $key => $court) {
         foreach ($hours as $key => $hour) {
             if (!Slot::where('day', $day->toDateString())->where('court', $court)->where('hour', $hour)->count()) {
                 $result .= $day->toDateString() . ', Bana ' . $court . ', kl ' . $hour . ':00 tillagd som slot.<br/>';
                 Slot::create(['day' => $day->toDateString(), 'hour' => $hour, 'court' => $court]);
             }
         }
     }
     return $result;
 }
예제 #6
0
 private function getSlotsData()
 {
     setlocale(LC_TIME, 'Swedish');
     $result = [];
     $start = Carbon::now();
     $stop = Carbon::now()->addMonth();
     $slots = Slot::where('day', '>=', $start)->where('day', '<', $stop)->orderBy('day', 'asc')->orderBy('hour', 'asc')->orderBy('court', 'asc')->get();
     if ($slots) {
         $current_day = null;
         $current_hour = null;
         foreach ($slots as $key => $slot) {
             if (!$current_day || $current_day->day != $slot->day) {
                 if ($current_day) {
                     $current_day->hours[] = $current_hour;
                     $result[] = $current_day;
                 }
                 $current_day = new \stdClass();
                 $current_day->day = $slot->day;
                 $current_day->weekday = Carbon::parse($slot->day)->dayOfWeek;
                 $current_day->week = Carbon::parse($slot->day)->format('W');
                 $current_hour = null;
             }
             if (!$current_hour || $current_hour->hour != $slot->hour) {
                 if ($current_hour) {
                     $current_day->hours[] = $current_hour;
                 }
                 $current_hour = new \stdClass();
                 $current_hour->hour = $slot->hour;
                 $current_hour->slots = [];
             }
             $current_hour->slots[] = $slot;
         }
         $current_day->hours[] = $current_hour;
         $result[] = $current_day;
     }
     return $result;
 }
예제 #7
0
 public function killPlayer()
 {
     $user = Auth::user();
     $player = Input::get('kill');
     $radioButton = Input::get('radio');
     $playerFind = User::where('name', '=', $player)->first();
     $armor = $playerFind->armors->count();
     $armors = $playerFind->armors->first();
     $slots = Slot::where('owner', '=', $playerFind->name)->first();
     $kill_exp = rand(100, 500);
     if ($player == $user->name) {
         return redirect('/kill');
     } elseif ($playerFind->location == $user->location) {
         if ($radioButton == 'Colt Derringer') {
             $gun = Gun::where('name', '=', 'Colt Derringer')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Colt SAA') {
             $gun = Gun::where('name', '=', 'Colt SAA')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Smith and Wesson') {
             $gun = Gun::where('name', '=', 'Smith and Wesson')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Winchester') {
             $gun = Gun::where('name', '=', 'Winchester')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Barrett .50 Cal') {
             $gun = Gun::where('name', '=', 'Barrett .50 Cal')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Thompson') {
             $gun = Gun::where('name', '=', 'Thompson')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } elseif ($radioButton == 'Minigun') {
             $gun = Gun::where('name', '=', 'Minigun')->first();
             if ($armor > 0) {
                 if ($gun->power > $armors->defence) {
                     $difference = $armors->defence -= $gun->power;
                     $health = $difference * rand(5, 15);
                     $playerFind->health -= $health;
                     $playerFind->save();
                     if ($playerFind->health <= 0) {
                         $kill_money = $playerFind->money;
                         $playerFind->sitestate = 2;
                         $playerFind->money = 0;
                         $playerFind->save();
                         $user->exp += $kill_exp;
                         $user->money += $kill_money;
                         $user->removeGun($gun);
                         $user->save();
                         if ($slots->owner == $playerFind->name) {
                             $slots->owner = $user->name;
                             $slots->save();
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         } else {
                             session()->flash('flash_message', 'You killed the player!');
                             return redirect('/home');
                         }
                     } else {
                         session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'Your weapon is too weak for this user!');
                     return redirect('/kill');
                 }
             } else {
                 $playerFind->health -= $gun->power * rand(5, 15);
                 $user->save();
                 $playerFind->save();
                 if ($playerFind->health <= 0) {
                     $kill_money = $playerFind->money;
                     $playerFind->sitestate = 2;
                     $playerFind->money = 0;
                     $playerFind->save();
                     $user->exp += $kill_exp;
                     $user->money += $kill_money;
                     $user->removeGun($gun);
                     $user->save();
                     if ($slots->owner == $playerFind->name) {
                         $slots->owner = $user->name;
                         $slots->save();
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     } else {
                         session()->flash('flash_message', 'You killed the player!');
                         return redirect('/home');
                     }
                 } else {
                     session()->flash('flash_message_important', 'You didnt manage to kill the player!');
                     return redirect('/home');
                 }
             }
         } else {
             session()->flash('flash_message_important', 'You Failed To Kill Anyone!!');
             return redirect('/home');
         }
     } else {
         session()->flash('flash_message_important', 'You are not in the same location!!');
         return redirect('/home');
     }
 }
예제 #8
0
파일: routes.php 프로젝트: VP42/PIMs
use Illuminate\Support\Facades\DB;
Route::get('/', function () {
    $slots = \App\Slot::all();
    $interviewsForJson = [];
    $interviews = Interview::with(['slot'])->get();
    foreach ($interviews as $interview) {
        $interviewsForJson[$interview->id] = ['id' => $interview->id, 'begins_at' => date_format($interview->slot->begins_at, 'H:i'), 'ends_at' => date_format($interview->slot->ends_at, 'H:i'), 'recruiter' => ['identity' => $interview->recruiter->identity, 'title' => $interview->recruiter->title]];
    }
    return view('home', ['slots' => $slots, 'recruiters_rh' => Recruiter::with(['interviews.candidate'])->where('rh', true)->get(), 'recruiters_admissions' => Recruiter::with(['interviews.candidate'])->where('admissions', true)->get(), 'recruiters_coaching' => Recruiter::with(['interviews.candidate'])->where('coaching', true)->get(), 'interviews' => json_encode($interviewsForJson)]);
});
Route::get('/gestion', ['middleware' => 'auth.basic', function () {
    return view('gestion', ['slots' => \App\Slot::all(), 'recruiters' => Recruiter::with(['interviews.candidate'])->get()]);
}]);
Route::get('/print', ['middleware' => 'auth.basic', function () {
    $pdfMaker = app('dompdf.wrapper');
    $pdf = $pdfMaker->loadView('print', ['slots' => \App\Slot::all(), 'recruiters' => Recruiter::with(['interviews.candidate', 'interviews.slot'])->get()]);
    return $pdf->stream('entretiens_par_recruteurs.pdf');
}]);
Route::post('/save-interview', function (SaveInterviewRequest $request) {
    return DB::transaction(function () use($request) {
        try {
            $candidate = Candidate::create(['firstname' => $request->input('firstname'), 'lastname' => $request->input('lastname'), 'email' => $request->input('email'), 'phone' => $request->input('phone'), 'promo' => $request->input('promo')]);
            $interview = Interview::findOrFail((int) $request->input('interview'));
            if (!is_null($interview->candidate_id)) {
                throw new Exception("Interview already taken!");
            }
            $interview->candidate_id = $candidate->id;
            $interview->save();
            return response()->json('Interview saved');
        } catch (Exception $e) {
            return response()->json('Interview NOT saved', 500);
예제 #9
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::user()->jailtime <= Carbon::now()) {
         $user = Auth::user();
         $name = $user->name;
         $money = $user->money;
         $exp = $user->exp;
         $rank = $user->rank;
         $health = $user->health;
         $points = $user->points;
         $location = $user->location;
         $blackjack = Blackjack::where('location', '=', $location)->first();
         $onlineUsers = User::orderBy('updated_at', 'DESC')->take(5)->get();
         $slot = Slot::where('location', '=', $location)->first();
         if ($exp <= 51) {
             $user->rank = "Tramp";
         } elseif ($exp <= 151) {
             $user->rank = "Pikey";
         } elseif ($exp <= 301) {
             $user->rank = "Goon";
         } elseif ($exp <= 801) {
             $user->rank = "Thug";
         } elseif ($exp <= 2501) {
             $user->rank = "Gangster";
         } elseif ($exp <= 5501) {
             $user->rank = "Terrorist";
         } elseif ($exp <= 9001) {
             $user->rank = "Gang Leader";
         } elseif ($exp <= 16001) {
             $user->rank = "Hustler";
         } elseif ($exp <= 25001) {
             $user->rank = "Capo";
         } elseif ($exp <= 36001) {
             $user->rank = "Under Boss";
         } elseif ($exp <= 50001) {
             $user->rank = "Boss";
         } elseif ($exp <= 75001) {
             $user->rank = "Warlord";
         } elseif ($exp <= 110001) {
             $user->rank = "Godfather";
         } elseif ($exp <= 150001) {
             $user->rank = "God of War";
         } elseif ($exp <= 300001) {
             $user->rank = "Emperor";
         } elseif ($exp <= 300000000000000) {
             $user->rank = "Sovereign";
         }
         $user->save();
         if ($user->sitestate == 1) {
             return "your account was banned from the site";
         } else {
             if ($user->sitestate == 2) {
                 return "your account was killed! Sign up again";
             } else {
                 return view('home', compact('name', 'money', 'exp', 'rank', 'health', 'points', 'onlineUsers', 'location', 'blackjack', 'slot'));
             }
         }
     } else {
         session()->flash('flash_message_important', 'You are currently jailed!');
         return redirect('/jail');
     }
 }
예제 #10
0
 public function index()
 {
     $slots = \App\Slot::all();
     return view('dashboard.admin.profile')->with(['user' => \Auth::User(), 'slots' => $slots]);
 }
 public function admin()
 {
     $user = \Auth::User();
     $slots = \App\Slot::all();
     return view('valence')->with(['user' => $user, 'slots' => $slots]);
 }