public function run() { $faker = Faker::create(); foreach (range(1, 20) as $index) { CalendarEvent::create(['event_name' => $faker->bs, 'creator_id' => User::all()->random()->id, 'location_id' => Location::all()->random()->id, 'start_time' => $faker->time, 'end_time' => $faker->time, 'cost' => $faker->numberBetween($min = 25, $max = 500), 'description' => $faker->text($maxNbChars = 200), 'event_image' => $faker->image]); } }
private function getMasterDatas() { $data['categories'] = Category::orderBy('title')->get(); View::share('categories', $data['categories']); $data['locations'] = Location::all(); View::share('locations', $data['locations']); }
/** * Show the form for creating a new order * * @return Response */ public function create() { $items = Item::all(); $customers = Client::all(); $locations = Location::all(); return View::make('orders.create', compact('items', 'locations', 'customers')); }
public function action_edit($id) { if (Auth::check() && Session::has('id')) { $account = Account::find(Session::get('id')); $location = Location::find($id); if (Input::has('address') && Input::has('city') && Input::has('postal_code')) { if ($account->id == $location->account_id) { Input::has('address') ? $location->address = strip_tags(Input::get('address')) : ($location->address = ''); Input::has('city') ? $location->city = strip_tags(Input::get('city')) : ($location->city = ''); Input::has('postal_code') ? $location->postal_code = strip_tags(Input::get('postal_code')) : ($location->postal_code = ''); $location->save(); return Redirect::to("/account/myLocations"); } else { return Redirect::to("/account/myLocations"); } } else { if ($location->account_id == $account->id) { $locations = Location::all(); $view = View::make('location.edit.index')->with('title', 'Edit Location')->with('location', $location)->with('locations', $locations); return $view; } else { return Response::error('403'); } } } else { return Redirect::to('/'); } }
public function locations() { $locations = Location::all(); $organization = Organization::find(1); $pdf = PDF::loadView('erpreports.locationsReport', compact('locations', 'organization'))->setPaper('a4')->setOrientation('potrait'); return $pdf->stream('Stores List.pdf'); }
public function index() { $rooms = Room::all(); $locations = Location::all(); $menu = 'data'; return View::make('rooms.index', compact('rooms', 'locations', 'menu')); }
/** * Revert the changes to the database. * * @return void */ public function down() { // $locations = Location::all(); foreach ($locations as $location) { $location->delete(); } }
public function create() { $locations = Location::all(); $courses = Course::where('location_id', '=', Auth::user()->location_id)->get(); $employees = Employee::all(); $menu = 'student'; return View::make('movements.create', compact('locations', 'courses', 'employees', 'menu')); }
public function index() { $users = User::all(); $employees = Employee::all(); $locations = Location::all(); $menu = 'data'; return View::make('users.index', compact('users', 'employees', 'locations', 'menu')); }
public function edit($id) { $activity = Activity::find($id); $generations = Generation::all(); $locations = Location::all(); $menu = 'project'; return View::make('activities.edit', compact('activity', 'generations', 'locations', 'menu')); }
public static function familyLoc($family) { $flocations = []; foreach ($family as $f) { $l = \Location::all(["user_id = ?" => $f->user_id], ["*"], "created", "desc"); $flocations = array_merge($flocations, $l); } return $flocations; }
public function index() { $currProject = Auth::user()->curr_project_id; $currLocation = Auth::user()->location_id; $projects = Project::all(); $locations = Location::all(); $menu = 'setup'; return View::make('setups/index', compact('projects', 'locations', 'currProject', 'currLocation', 'menu')); }
/** * Show the form for creating a new resource. * GET /calendarevents/create * * @return Response */ public function create() { $locations = Location::all(); $dropdown = []; $dropdown['-1'] = 'Add New Address'; foreach ($locations as $location) { $dropdown[$location->id] = $location->title; } return View::make('events.create')->with('dropdown', $dropdown); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $donors = [''] + Donor::all()->lists('name_with_blood_group', 'id'); $products = ['']; foreach (Category::all() as $cat) { $cat_products = $cat->products->lists('name', 'id'); $products[$cat->name] = $cat_products; } $locations = [''] + Location::all()->lists('name_with_parent', 'id'); return View::make('donations.create', ['donors' => $donors, 'products' => $products, 'locations' => $locations, 'today' => Carbon\Carbon::now()]); }
public function allLocations() { $new = array(); $locations = Location::all(); foreach ($locations as $location) { $ven = Vendor::find($location->vendor_id); $location['logo_path'] = $ven->logo_path; array_push($new, $location); } $data = array('status' => 'ok', 'locations' => $new); return $data; }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $types = ['', 'Positive', 'Negative']; $products = ['']; foreach (Category::all() as $cat) { $cat_products = $cat->products->lists('name', 'id'); $products[$cat->name] = $cat_products; } $locations = [''] + Location::all()->lists('name_with_parent', 'id'); //$products = array('') + Product::all()->lists('name', 'category_id'); return View::make('adjustments.create', ['products' => $products, 'locations' => $locations, 'type' => $types, 'quantity' => '', 'today' => Carbon\Carbon::now(), 'description' => '']); }
public function run() { $faker = Faker::create(); for ($i = 0; $i < 25; $i += 1) { $event = new CalendarEvent(); $event->start_time = '2015-09-01 12:00:00'; $event->end_time = '2015-09-02 12:00:00'; $event->title = $faker->catchPhrase; $event->description = $faker->text(100); $event->price = '0'; $event->user_id = User::all()->random()->id; $event->location_id = Location::all()->random()->id; $event->game_id = Game::all()->random()->id; $event->save(); } }
public function run() { $faker = Faker::create(); for ($i = 0; $i < 60; $i++) { $calendarEvent = new CalendarEvent(); $calendarEvent->start = "2012-12-02 13:00"; $calendarEvent->end = "2012-12-02 19:00"; $calendarEvent->title = $faker->catchPhrase . " " . $faker->catchPhrase; $calendarEvent->description = $faker->realText(200, 2); $calendarEvent->price = rand(0, 10); $calendarEvent->user_id = User::all()->random(1)->id; $calendarEvent->location_id = Location::all()->random(1)->id; $calendarEvent->img = $faker->imageUrl($width = 640, $height = 480); $calendarEvent->save(); } }
public function showWelcome() { $sports = Sport::all(); $cities = Location::all(); /* pull list of cities for events from events table city column */ $sportDropdown = []; $sportDropdown[-1] = 'Select a Sport'; $cityDropdown = []; $cityDropdown[-1] = 'Select a City'; foreach ($sports as $sport) { $sportDropdown[$sport->id] = $sport->sport; } foreach ($cities as $city) { $cityDropdown[$city->id] = $city->city; } return View::make('home')->with('sportDropdown', $sportDropdown)->with('cityDropdown', $cityDropdown); }
/** * Make changes to the database. * * @return void */ public function up() { // $locations = Location::all(); foreach ($locations as $loc) { for ($i = 0; $i < 2; $i++) { $l = new Listing(); $l->title = $i; $l->description = "THSI IFS AWIFAWOEIJFAWIEJFWEIFJ"; $l->category_id = "1"; $l->price = 123.12; $l->date_available = "2013-07-27 00:00:00"; $l->date_unavailable = "2013-08-05 00:00:00"; $l->location_id = $loc->id; $l->save(); } } }
/** * Make changes to the database. * * @return void */ public function up() { // $locations = Location::all(); foreach ($locations as $location) { for ($i = 1; $i <= 2; $i++) { $listing = new Listing(); $listing->title = "{$i}"; $listing->description = "description {$i}"; $listing->category = "wood"; $listing->quantity = "{$i}"; $listing->price = "\$" . $i; $listing->date_expiry = "2013-03-19 11:33:22"; $listing->date_available = "2013-03-19 11:33:22"; $listing->date_unavailable = "2013-03-19 11:33:22"; $listing->location_id = $location->id; $listing->save(); } } }
public function run() { $faker = Faker::create(); /*foreach(range(1, 10) as $index)*/ for ($i = 0; $i < 50; $i++) { $calendar_event = new CalendarEvent(); // $calendar_event->user_id = 1; // $calendar_event->location_id = 1; $calendar_event->user_id = User::all()->random()->id; $calendar_event->location_id = Location::all()->random()->id; // $calendar_event->start_date_time = '2015-09-12'; // $calendar_event->end_date_time = '2015-09-13'; $startDate = Carbon::createFromTimeStamp($faker->dateTimeBetween('-30 days', '+30 days')->getTimestamp()); $calendar_event->start_date_time = $startDate; $calendar_event->end_date_time = Carbon::createFromFormat('Y-m-d H:i:s', $startDate)->addHour(); $calendar_event->title = $faker->title; $calendar_event->description = $faker->catchPhrase; $calendar_event->price = $faker->randomNumber(2); $calendar_event->url = $faker->imageUrl(640, 480, 'city'); $calendar_event->save(); } }
public function showWelcome() { if (Sentry::check()) { $user = Sentry::getUser(); $group = User::find($user->id); $skills = Skill::all(); $assigned = $group->skills->lists('id'); $user_object = User::find($user->id); $locations = Location::all(); $location_assigned = $group->locations->lists('id'); //for an oppurtunity if and skills match then check against location $skillmatches = Skill::with('opportunities')->with('users')->has('opportunities')->has('users')->get(); //if the oppurtunity and location match send email and display in Matches on feed $events = Community_event::all(); //array to store docs without tags $usermatches = User::with('locations')->has('locations')->get(); $opportunitymatches = Opportunity::with('location')->with('skills')->get(); return View::make('hello', compact('skillmatches', 'opportunitymatches', 'skills', 'assigned', 'locations', 'location_assigned', 'events')); } else { return View::make('hello'); } }
public function locationable() { $locs = []; // spotables move them to locations Itinerary::withTrashed()->get()->each(function ($item) use(&$locs) { foreach ($item->spots as $spot) { if ($spot->location) { $vals = ['location_id' => $spot->location->id, 'locationable_id' => $item->id, 'locationable_type' => get_class($item), 'created_at' => $item->created_at, 'updated_at' => $item->created_at]; $exist = DB::table('locationables')->where($vals)->first(); if ($exist == NULL) { DB::table('locationables')->insert($vals); array_push($locs, $spot->location->id); } } } }); $locations = Location::all()->each(function ($item) use(&$locs) { $vals = ['location_id' => $item->id, 'locationable_id' => $item->locationable_id, 'locationable_type' => $item->locationable_type, 'created_at' => $item->created_at, 'updated_at' => $item->created_at]; $exist = DB::table('locationables')->where($vals)->first(); if ($exist == NULL) { DB::table('locationables')->insert($vals); if ($item->locationable_type == 'Spot') { $spot = Spot::withTrashed()->whereId($item->locationable_id)->first(); if ($spot) { $item->timestamps = false; $item->spot_id = $spot->id; $item->save(); $spot->timestamps = false; $spot->location_id = $item->id; $spot->save(); } } array_push($locs, $item->id); } }); return $locs; }
/** * Show the form for editing the specified calendarevent. * * @param int $id * @return Response */ public function edit($id) { $event = Calendarevent::find($id); if (!$event) { App::abort(404); } if (!Auth::check()) { return Redirect::action('UsersController@doLogin'); } elseif (Auth::id() == $event->creator_id || Auth::user()->role == 'admin') { $locations = Location::all(); $dropdown = []; $dropdown[-1] = 'Add new address'; foreach ($locations as $location) { $dropdown[$location->id] = $location->location_name . " - " . $location->location_city . ', ' . $location->location_state; } return View::make('calendarevents.edit', compact('event', 'dropdown')); } else { Session::flash('errorMessage', 'Access not authorized'); return Redirect::action('CalendarEventsController@index'); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $locations = $this->location->all(); return View::make('admin.locations.index', compact('locations')); }
public function purchases() { $purchases = DB::table('erporders')->join('erporderitems', 'erporders.id', '=', 'erporderitems.erporder_id')->join('items', 'erporderitems.item_id', '=', 'items.id')->join('clients', 'erporders.client_id', '=', 'clients.id')->where('erporders.type', '=', 'purchases')->select('clients.name as client', 'items.name as item', 'quantity', 'clients.address as address', 'clients.phone as phone', 'clients.email as email', 'date', 'erporders.id as id', 'erporders.status', 'discount_amount', 'erporders.order_number as order_number', 'price', 'description', 'erporders.type')->get(); $items = Item::all(); $locations = Location::all(); $organization = Organization::find(1); $pdf = PDF::loadView('erpreports.purchasesReport', compact('purchases', 'organization'))->setPaper('a4')->setOrientation('potrait'); return $pdf->stream('Purchases List.pdf'); }
public function edit($id) { $registration = Registration::find($id); $locations = Location::all(); $employees = Employee::where('location_id', '=', 18)->get(); $classifications = Classification::where('category', '=', 'Registration')->get(); $menu = 'registration'; return View::make('registrations.edit', compact('registration', 'menu', 'locations', 'employees', 'classifications')); }
/** * Show list of employee locations * * @return mixed */ public function manageLocations() { $locs = Location::all(); return View::make('admin.locations', compact('locs')); }
/** * @before _secure */ public function profile() { $this->seo(array("title" => "Profile", "view" => $this->getLayoutView())); $view = $this->getActionView(); $user = $this->user; $view->set("errors", array()); if (RequestMethods::post("action") == "saveUser") { $user->name = RequestMethods::post("name"); $user->phone = RequestMethods::post("phone"); $password = RequestMethods::post("password"); if (!empty($password)) { $user->password = sha1($password); } $user->save(); $this->setUser($user); $view->set("success", "Info updated!!"); } $locations = Location::all(array("user_id = ?" => $this->user->id), array("*"), "created", "desc"); $family = Shared\Services\Patient::findFamily($this->user); $flocations = Shared\Services\Patient::familyLoc($family); if (RequestMethods::post("action") == "saveLocation") { $location_id = RequestMethods::post("location_id"); $location = $locations[$location_id]; $l = \Location::saveRecord(null, $location, array("validate" => true)); if (is_array($l)) { $view->set("success", "Fix the following errors")->set("errors", $l); } else { $locations[$location_id] = $l; $view->set("success", "Updated Location"); } } if (RequestMethods::post("addLocation")) { $user_id = (int) RequestMethods::post("user_id", $this->user->id); if ((int) $this->user->id == $user_id) { $u = $this->user; } else { $u = ArrayMethods::toObject(['id' => $family[$user_id]->user_id]); } $location = \Location::saveRecord($u, null, array("validate" => true)); if (is_array($location)) { $view->set("success", "Fix the following errors")->set("errors", $location); } else { $view->set("success", "Added New Location"); $arr = array($location->id => $location); $locations = array_merge($locations, $arr); } } $view->set("locations", $locations)->set("family", $family)->set("flocations", $flocations); }