/** * A function used to update the 'low balance' status of a * faucet. * * @param $faucetSlug * @return mixed */ public static function lowBalance($faucetSlug) { try { $lowBalanceStatus = Input::get('has_low_balance'); $faucet = Faucet::findBySlugOrId($faucetSlug); $faucet->has_low_balance = $lowBalanceStatus; $faucet->save(); Session::flash('success_message_update_faucet_low_balance_status', 'The faucet has been paused due to low balance (less than 10,000 Satoshis).'); return Redirect::to('faucets/' . $faucetSlug); } catch (ModelNotFoundException $e) { abort(404); } catch (Exception $e) { return Redirect::to('faucets/' . $faucetSlug)->withErrors(['There was a problem changing low balance status, please try again.'])->withInput(Input::get('has_low_balance')); } }
/** * Remove the specified faucet from storage. * * @param $slug * @return Response * @internal param int $id */ public function destroy($slug) { try { $faucet = Faucet::findBySlugOrId($slug); $faucetName = $faucet->name; $faucetUrl = $faucet->url; $faucet->paymentProcessors()->detach(); $faucet->users()->detach(); $faucet->delete(); Session::flash('success_message_delete', 'The faucet "' . $faucetName . '" with URL "' . $faucetUrl . '" has successfully been deleted!'); return Redirect::to('faucets'); } catch (ModelNotFoundException $e) { abort(404); } }