/**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $user = \Auth::user();
     if ($user->role->name == 'admin' || $user->role->name == 'root') {
         $location = new \App\Location();
         $data = $request->json()->get('data');
         $location->name = $data[0]['location'];
         $location->capacity = $data[0]['allowance'];
         $location->save();
         return back()->withInput();
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 2;
     $locations = App\Location::get();
     foreach ($locations as $location) {
         for ($i = 0; $i < $limit; $i++) {
             DB::table('stories')->insert(['title' => $faker->text($maxNbChars = 10), 'story' => $faker->text, 'published' => $faker->boolean($chanceOfGettingTrue = 50), 'location_id' => $location->id]);
         }
     }
 }
Esempio n. 3
0
 /**
  * Create a new Location /
  */
 public function newLocation($timeline_id, Request $request)
 {
     $timeline = \App\Timeline::where('id', '=', $timeline_id)->first();
     if ($request->input('showForm') == 'true') {
         return view('locations.newLocation')->with('showForm', 'true')->with('timeline', $timeline);
     } else {
         if (\Auth::check()) {
             // Validate the request data
             $this->validate($request, ['name' => 'required']);
             $location = new \App\Location();
             $user = \Auth::user();
             $location->name = $request->input('name');
             $location->description = $request->input('description');
             $location->timeline_id = $timeline_id;
             $location->created_by = $user->id;
             $location->last_modified_by = $user->id;
             $location->save();
             return view('locations.newLocation')->with('showForm', 'false')->with('location', $location)->with('timeline', $timeline);
         } else {
             return 'Access Denied';
         }
     }
 }
Esempio n. 4
0
 /**
  * Seed the specialties table.
  *
  * @return void
  * @author PJ
  */
 private function seedTable($data)
 {
     foreach ($data as $lineIndex => $row) {
         $specialty = App\Location::create(['zip' => $row[0], 'city' => $row[1], 'state' => $row[2], 'lat' => $row[3], 'lon' => $row[4], 'pop' => $row[5]]);
     }
 }
Esempio n. 5
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
Route::get('/', ['middleware' => 'auth', function () {
    $states = App\Location::select('state', 'county')->get()->groupBy('state');
    return view('locations.index', compact('states'));
}]);
Route::get('/products', ['middleware' => 'auth', 'as' => 'products', 'uses' => 'ProductsController@index']);
Esempio n. 6
0
});
Route::resource('disposition', 'DispositionController', ['only' => ['store']]);
Route::bind('note', function ($id) {
    return App\Note::whereId($id)->first();
});
Route::resource('note', 'NoteController', ['only' => 'store']);
Route::bind('doctor', function ($id) {
    return App\Doctor::whereId($id)->first();
});
Route::resource('doctor', 'DoctorController');
Route::bind('user', function ($id) {
    return App\User::whereId($id)->first();
});
Route::resource('user', 'UserController');
Route::bind('location', function ($id) {
    return App\Location::whereId($id)->first();
});
Route::resource('location', 'LocationController');
Route::bind('timeslot', function ($id) {
    return App\Timeslot::whereId($id)->first();
});
Route::resource('timeslot', 'TimeslotController');
Route::get('{lead_id}/retrieve_notes', ['as' => 'retrieve_notes_by_lead', 'uses' => 'NoteController@retrieveNote']);
//get available timeslot locations
Route::get('timeslot/available/{location_id}/{day}', function ($location_id, $day) {
    $timeslots = array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00');
    $selectedTimeslots = \App\Timeslot::where('location_id', $location_id)->where('day', $day)->lists('time')->toArray();
    return array_diff($timeslots, $selectedTimeslots);
});
Route::get('doctor/{doctor}/available-locations', function ($doctor) {
    return $doctor->locations;
Esempio n. 7
0
<?php

return ['locations' => App\Location::with('content')->get()];