public static function generateAddress($entity, $project = false)
 {
     $id_name = $project ? "project_id" : "user_id";
     // now generate their address
     $count = Pool::whereNull('used')->limit(1)->update([$id_name => $entity->id, 'used' => date('Y-m-d H:i:s', time())]);
     if ($count == 1) {
         $address = Pool::where($id_name, $entity->id)->pluck('address')[0];
         $entity->ltc_address = $address;
         $entity->save();
     }
     return isset($address) ? $address : false;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('Pools')->delete();
     DB::table('PoolOptions')->delete();
     $pool1 = Pool::create(array('title' => 'Best PHP framework'));
     $pool2 = Pool::create(array('title' => 'Favourite Pizza'));
     $pool3 = Pool::create(array('title' => 'Your development skills'));
     PoolOptions::create(array('title' => 'Laravel 5', 'vote' => 0, 'pool_id' => $pool1->id));
     PoolOptions::create(array('title' => 'Yii 2', 'vote' => 0, 'pool_id' => $pool1->id));
     PoolOptions::create(array('title' => 'Codeigniter', 'vote' => 0, 'pool_id' => $pool1->id));
     PoolOptions::create(array('title' => 'Other', 'vote' => 0, 'pool_id' => $pool1->id));
     PoolOptions::create(array('title' => 'Margherite', 'vote' => 0, 'pool_id' => $pool2->id));
     PoolOptions::create(array('title' => 'Capricciosa', 'vote' => 0, 'pool_id' => $pool2->id));
     PoolOptions::create(array('title' => 'Napoli', 'vote' => 0, 'pool_id' => $pool2->id));
     PoolOptions::create(array('title' => 'Poor', 'vote' => 0, 'pool_id' => $pool3->id));
     PoolOptions::create(array('title' => 'Good', 'vote' => 0, 'pool_id' => $pool3->id));
     PoolOptions::create(array('title' => 'Top', 'vote' => 0, 'pool_id' => $pool3->id));
 }
 public function destroy($id)
 {
     $pool = Pool::find($id);
     $pool->delete();
 }
Exemplo n.º 4
0
 public function index()
 {
     $pools = Pool::all();
     return view('pool.index', compact('pools'));
 }
Exemplo n.º 5
0
 public function scoreGamePost(Request $request)
 {
     $homeScore = $request->input('home_score');
     $awayScore = $request->input('away_score');
     $gameId = $request->input('game_id');
     $quarter = $request->input('quarter');
     Log::info($homeScore);
     Log::info($awayScore);
     $winningSquare = PoolSquare::where('home_score', '=', $homeScore)->where('away_score', '=', $awayScore)->update(array('status' => PoolSquare::STATUS_WINNER));
     Pool::where('id', '=', $gameId)->update(array('fq_winner_id' => $winningSquare['id']));
     $pool = Pool::find($gameId);
     Log::info($pool);
     Session::flash('info', 'Score Was Saved! -- Car:' . $homeScore . ' | Den: ' . $awayScore);
     $data = array('quarter' => $quarter, 'pool' => $pool['id']);
     return view('pool.score-game')->with($data);
 }