/**
  * Store a newly created resource in storage
  * http://laravel5.app/center?lat=50.062042&lng=19.936745&name=Cracov+Main+Square
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(CenterAddFormRequest $r)
 {
     $lat = round($r->get('lat'), 9);
     $lng = round($r->get('lng'), 9);
     return \App\Center::add($lat, $lng, $r->get('name'));
 }
Example #2
0
 /**
  * Counts the number of centers that are in the red, or
  * have a negative balance. It also gets the number
  * of centers that have a positive balance if a
  * true parameter is passed.
  *
  * @param bool $black
  * @return int
  */
 public static function getNumOfCentersInRed($black = false)
 {
     $output = [];
     foreach (Center::all() as $center) {
         $balance = Balance::where('center_id', '=', $center->id)->orderBy('date', 'desc')->first();
         if ($black) {
             if ($balance->availableBalance > 0) {
                 array_push($output, $balance->center_id);
             }
         } else {
             if ($balance->availableBalance < 0) {
                 array_push($output, $balance->center_id);
             }
         }
     }
     return count($output);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $bars = \App\Center::find(\Config::get('place.center'))->place->bars;
     $bars->load('photos', 'reviews');
     return $bars;
 }
Example #4
0
 /**
  * The getEditProfile method GETs a users profile and returns
  * the view for that profile.
  *
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function getEditProfile($id)
 {
     $data = ['page_title' => 'Your Profile', 'user' => User::find($id), 'centers' => Center::all()];
     return view('user.profile', $data);
 }