Exemplo n.º 1
0
 public static function GetByIDOrName($idOrName)
 {
     if (is_numeric($idOrName)) {
         return Chance::GetByID($idOrName);
     }
     return Chance::GetByName($idOrName);
 }
Exemplo n.º 2
0
 /**
  * Show the form for creating a new resource.
  * GET /rated/create
  *
  * @return Response
  */
 public function create()
 {
     $array = Input::all();
     $chance = Chance::find($array['chances_id']);
     //        dd($chance->userofchances[0]->users);
     if ($chance->vehicles->users->id == Auth::user()->id) {
         return View::make('rate.ratechance', compact('chance'));
     }
 }
Exemplo n.º 3
0
    protected function RenderContent()
    {
        ?>
			<div class="Panel">
				<h3 class="PanelTitle">Chances</h3>
				<div class="PanelContent">
				<?php 
        $chances = Chance::Get();
        if (count($chances) == 0) {
            ?>
					There are no Chances available for you to play at the moment. Please check back soon!
				<?php 
        } else {
            foreach ($chances as $chance) {
            }
        }
        ?>
				</div>
			</div>
<?php 
    }
 public function store()
 {
     $data = Input::all();
     $idchance = $data['chances_id'];
     $iduser = Auth::user()->id;
     $data['users_id'] = $iduser;
     $chance = Chance::find($idchance);
     $userofchances = UserofChance::where('chances_id', '=', $idchance)->where('users_id', '=', $iduser)->get();
     if (empty($userofchances)) {
         $message = json_encode(array('message', 'You have already taken this chance'));
         return $message;
     }
     $vehicle = Vehicle::find($chance->vehicles_id);
     if ($vehicle->users_id == $iduser) {
         $message = json_encode(array('message', 'You created this chance'));
     } else {
         UserofChance::create($data);
         $chance->capacity = $chance->capacity - 1;
         $chance->save();
         return Redirect::intended('/chanceslist/');
     }
 }
Exemplo n.º 5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $chance = Chance::find($id);
     return View::make('chances.showchance', compact('chance'));
 }
Exemplo n.º 6
0
<?php

if (count($path) > 1 && $path[1] != "") {
    $id = $path[1];
    $chance = Chance::GetByIDOrName($id);
    if ($chance == null) {
        $errorPage = new PsychaticaErrorPage();
        $errorPage->Message = "The specified Chance does not exist, or the duration for this event has passed.";
        $errorPage->ReturnButtonURL = "~/market/chances";
        $errorPage->ReturnButtonText = "Return to Chances";
        $errorPage->Render();
        return;
    }
    require "detail.inc.php";
    return;
} else {
    require "list.inc.php";
    return;
}