public function postActionFaucet(ActionFaucetRequest $request) { $data = $request->all(); switch ($data['action']) { case 'next': Faucet::updateUntil($data); $faucet = Faucet::firstReady(); break; case 'disable': Faucet::disableFaucet($data); $faucet = Faucet::firstReady(); break; case 'save_duration': $result = Faucet::where('id', $data['prev_faucet_id'])->update(['duration' => $data['cduration'] * 60]); $faucet = Faucet::find($data['prev_faucet_id']); $message = 'New duration successfully saved.'; break; case 'change_order': Session::put('order', $data['order']); return Response::json([]); } $count = Faucet::countFaucets(); $ret_data = ['id' => $faucet->id, 'url' => $faucet->url, 'duration' => $faucet->duration, 'priority' => $faucet->priority, 'info' => $faucet->info, 'last_pay' => self::getLastPayInfo($faucet), 'n_all' => $count['n_all'], 'n_act' => $count['n_act']]; isset($message) ? $ret_data['message'] = $message : NULL; return Response::json($ret_data); }
public function faucet($slug) { $faucet = Faucet::find($slug); if ($faucet == null || !$faucet) { return [404 => 'Not Found']; } return $faucet; }
/** * A function used to tweet the details of a Random faucet. */ public function sendRandomFaucetTweet() { $faucetIds = Faucet::where('id', '>', 0)->pluck('id')->toArray(); shuffle($faucetIds); $randomNumber = array_slice($faucetIds, 0, 1); //Obtain a faucet using the random integer. $faucet = Faucet::find($randomNumber[0]); if ($faucet != null) { //Construct a message template based on the random faucet's details. $message = "Earn between " . $faucet->min_payout . " and " . $faucet->max_payout . " satoshis every " . $faucet->interval_minutes . " minute/s from " . url('/faucets/' . $faucet->slug) . " for free :)."; // Send the tweet of the random faucet. $this->sendTweet($message); } }
/** * A function used to tweet the details of a Random faucet. */ public function sendRandomFaucetTweet() { $faucetCount = count(Faucet::all()); if ($faucetCount > 0) { //Obtain a random integer used to //get a random faucet to tweet. $numbers = range(0, $faucetCount - 1); shuffle($numbers); $randomNumber = array_slice($numbers, 0, 1); //Obtain a faucet using the random integer. $faucet = Faucet::find($randomNumber[0]); //Construct a message template based on the random faucet's details. $message = "Earn between " . $faucet->min_payout . " and " . $faucet->max_payout . " satoshis every " . $faucet->interval_minutes . " minute/s from " . url('/faucets/' . $faucet->slug) . " for free :)."; // Send the tweet of the random faucet. $this->sendTweet($message); } }