Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user_id = -1;
     $is_active = 0;
     $field = "products.updated_at";
     $order = "desc";
     $sort = array();
     $sort[$field] = $order;
     $filter = array();
     $university_id = 2;
     if (Auth::check()) {
         $user_id = Auth::id();
         $user = User::getUserInfo($user_id);
         $first_name = $user->first_name;
         $active = $user->is_active;
         $university_id = $user->university_id;
         $is_active = $user->is_active;
         if ($active) {
             //        return redirect()->intended('/results');
         } else {
             Auth::logout();
         }
     }
     $whereIn = array();
     $request = new Request();
     $ss = new SearchService();
     $output = $ss->searchItemsAlgoOne($request);
     $items = $output['data'];
     if (!$output['status']) {
         print_r("Error occurred getting results " . $output['data']);
         return;
     }
     $sort_date = 1;
     return view('index/index', ['items' => $items->paginate(8), 'sort_date' => $sort_date, 'user_id' => $user_id, 'is_active' => $is_active, 'university_list' => University::all()]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $univList = array("Arizona State University", "Auburn University", "Baylor College of Medicine", "Boston College", "Boston University", "Brandeis University", "Brigham Young University", "California Institute of Technology", "Carnegie Mellon University", "Case Western Reserve University", "City University of New York City College", "Clemson University", "Colorado State University", "Columbia University", "Cornell University", "Dartmouth College", "Drexel University", "Duke University", "Emory University", "Florida State University", "George Mason University", "Georgetown University", "Georgia Institute of Technology", "Harvard University", "Indiana University Bloomington", "Indiana University-Purdue University", "Iowa State University", "Kansas State University", "Kent State University", "Lehigh University", "Lousiana State University - Baton Rouge", "Massachusetts Institute of Technology", "Mayo Medical School", "Medical College of Wisconsin", "Medical University of South Carolina", "Michigan State University", "Mount Sinai School of Medicine", "New York University", "North Carolina State University", "Northeastern University", "Northwestern University", "Oregon Health and Science University", "Oregon State University", "Pennsylvania State University - University Park", "Portland State University", "Princeton University", "Purdue University - West Lafayette", "Rensselaer Polytechnic Institute", "Rice University", "Rockefeller University", "Rutgers, The State University of New Jersey - New Brunswick", "Saint Louis University", "San Diego State University", "Southern Methodist University", "Stanford University", "State University of New York Health Science Center", "State University of New York at Albany", "State University of New York at Buffalo", "State University of New York at Stony Brook", "Syracuse University", "Temple University", "Texas A&M University - College Station", "Texas Tech University", "The George Washington University", "The Johns Hopkins University", "The Ohio State University - Columbus", "The University of Alabama at Birmingham", "The University of Connecticut - Storrs", "The University of Georgia", "The University of Montana - Missoula", "The University of New Mexico - Albuquerque", "The University of Texas Health Science Center Houston", "The University of Texas Health Science Center San Antonio", "The University of Texas M. D. Anderson Cancer Center", "The University of Texas Medical Branch at Galveston", "The University of Texas Southwestern Medical Center", "The University of Texas at Austin", "The University of Texas at Dallas", "Thomas Jefferson University", "Tufts University", "Tulane University", "University of Alaska - Fairbanks", "University of Arizona", "University of California, Berkeley", "University of California, Davis", "University of California, Irvine", "University of California, Los Angeles", "University of California, Riverside", "University of California, San Diego", "University of California, San Francisco", "University of California, Santa Barbara", "University of California, Santa Cruz", "University of Central Florida", "University of Chicago", "University of Cincinnati", "University of Colorado at Boulder", "University of Colorado at Denver", "University of Delaware", "University of Florida", "University of Hawaii at Manoa", "University of Houston", "University of Idaho", "University of Illinois at Chicago", "University of Illinois at Urbana-Champaign", "University of Iowa", "University of Kansas - Lawrence", "University of Kentucky", "University of Maryland, Baltimore", "University of Maryland, Baltomore County", "University of Maryland, College Park", "University of Massachusetts Amherst", "University of Massachusetts Medical School, Worcester", "University of Medicine and Dentistry, New Jersey", "University of Miami", "University of Michigan - Ann Arbor", "University of Minnesota, Twin Cities", "University of Missouri - Columbia", "University of Nebraska - Lincoln", "University of Nebraska Medical Center", "University of New Hampshire - Durham", "University of North Carolina at Chapel Hill", "University of Notre Dame", "University of Oklahoma - Norman", "University of Oregon", "University of Pennsylvania", "University of Pittsburgh", "University of Rhode Island", "University of Rochester", "University of South Carolina - Columbia", "University of South Florida", "University of Southern California", "University of Tennessee - Knoxville", "University of Utah", "University of Vermont", "University of Virginia", "University of Washington", "University of Wisconsin - Madison", "University of Wyoming", "Utah State University", "Vanderbilt University", "Virginia Commonwealth University", "Virginia Polytechnic Institute and State University", "Wake Forest University", "Washington State University", "Washington University in St. Louis", "Wayne State University", "Yale University", "Yeshiva University");
     $faker = Faker\Factory::create();
     //        University::truncate();
     University::create(['id' => 0, 'name' => "Choose University...", 'city' => "NULL"]);
     foreach ($univList as $university) {
         University::create(['name' => $university, 'city' => $faker->city]);
     }
 }
 public function __construct()
 {
     $this->middleware('auth');
     $user_types = UserType::lists("name", "id");
     $states = State::lists("name", "id");
     $users_count = User::with("state")->latest()->get()->count();
     $universities_count = University::latest()->get()->count();
     $sos_count = SosModel::latest()->get()->count();
     $students_count = Student::latest()->get()->count();
     $companies_count = Company::latest()->get()->count();
     \View::share(compact("users_count", "universities_count", "sos_count", "states", "user_types", "students_count", "companies_count"));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $ss = new SearchService();
     $output = $ss->searchItemsAlgoOne($request);
     if (!$output['status']) {
         print_r("Error occurred getting results " . $output['data']);
         return;
     }
     if ($request->has('category_id')) {
         $category_id = $request->input('category_id');
     } else {
         $category_id = -1;
     }
     // Usage
     if ($request->input('usage') == 'new') {
         $new = 1;
         $used = 0;
         $all = 0;
     } else {
         if ($request->input('usage') == 'used') {
             $new = 0;
             $used = 1;
             $all = 0;
         } else {
             $new = 0;
             $used = 0;
             $all = 1;
         }
     }
     $sortfield_value = "";
     if ($request->has('sortfield')) {
         $sortfield_value = $request->input('sortfield');
     }
     $sort_date = 0;
     $sort_price_asc = 0;
     $sort_price_desc = 0;
     switch ($sortfield_value) {
         case "date_desc":
             $sort_date = 1;
             break;
         case "price_asc":
             $sort_price_asc = 1;
             break;
         case "price_desc":
             $sort_price_desc = 1;
             break;
         default:
             $sort_date = 1;
     }
     $items = $output['data'];
     return view('results.index', ['items' => $items->paginate(9), 'delivery_check' => $request->has('delivery') ? 1 : 0, 'pickup_check' => $request->has('pickup_check') ? 1 : 0, 'freeonly_check' => $request->has('freeonly') ? 1 : 0, 'searchTerm' => $request->input('searchTerm'), 'university_name' => $request->input('university_name'), 'category_id' => $category_id, 'new_check' => $new, 'used_check' => $used, 'all_check' => $all, 'sort_date' => $sort_date, 'sort_price_asc' => $sort_price_asc, 'sort_price_desc' => $sort_price_desc, 'request' => $request->all(), 'university_list' => University::all(), 'category_list' => Category::all()]);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind("users", function ($slug) {
         try {
             $user = User::whereSlug($slug)->with("state", "user_type")->firstOrFail();
             // User::with()->findOrFail($id);
             return $user;
         } catch (ModelNotFoundException $e) {
             return abort("404");
         }
     });
     $router->bind("students", function ($slug) {
         try {
             $student = User::whereSlug($slug)->with("state", "user_type")->firstOrFail();
             // User::with()->findOrFail($id);
             return $student;
         } catch (ModelNotFoundException $e) {
             return abort("404");
         }
     });
     $router->bind("universities", function ($slug) {
         try {
             $university = University::whereSlug($slug)->with("students", "faculties")->firstOrFail();
             // User::with()->findOrFail($id);
             return $university;
         } catch (ModelNotFoundException $e) {
             return abort("404");
         }
     });
     $router->bind("companies", function ($slug) {
         try {
             $company = Company::whereSlug($slug)->firstOrFail();
             // User::with()->findOrFail($id);
             return $company;
         } catch (ModelNotFoundException $e) {
             return abort("404");
         }
     });
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UniversitiesRequest $request)
 {
     $university = University::create($request->all());
     return redirect("/universities");
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $existCourse = Course::where('university_id', $id)->count();
     if ($existCourse) {
         $message = 'Course added for university, Delete it first';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
     $delete = University::where('id', $id)->delete();
     if ($delete) {
         $message = 'Detele successfully';
         return Response()->json(ResponseManager::getResult($delete, 10, $message));
     } else {
         $message = 'Error while deleting';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
Ejemplo n.º 8
0
 public function getRegister()
 {
     return view('auth/register', ["university_list" => University::all()]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     University::truncate();
     $university = University::create(['name' => 'Tshwane University of Technology', 'description' => '', 'slogan' => 'We Empower People', 'chancellor' => 'Gwendoline Malegwale Ramokgopavsss', 'vice_chancellor' => 'Prof Lourens van Staden', 'website' => 'www.tut.ac.za']);
 }
 /**
  *   @name getUniversityIdByName
  *  
  *   @description Returns university id given the name 
  *    
  *   @params university_name 
  *
  *   @return Int of university_id 
  *
  *   @author Shweta Sabne  
  *
  **/
 public function getUniversityIdByName($university_name)
 {
     $universities = University::getUniversityIdByName($university_name);
     return $universities;
 }
 private function composeNav()
 {
     view()->composer('master.template', function ($view) {
         $view->with('university_list', University::all());
     });
 }