/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $course = new Course(); if (Auth::user()->hasSuperpowers()) { $institutions = Institution::all()->lists('name', 'id'); } else { $institutions = Auth::user()->institutions->lists('name', 'id'); } # the view is used for creation and modification so the corresponding action has to be passed return view('public.createCourse')->with('course', $course)->with('institutions', $institutions); }
public function getRegister($id) { $institutions = Institution::all(); switch ($id) { case 'institution': $role = 2; $page = 'auth.inst_register'; break; case 'professor': $role = 3; $page = 'auth.prof_register'; break; default: return abort(404); } return view($page, compact('role', 'institutions')); }
/** * Display a listing of the institutions resource. * * @return \Illuminate\Http\Response */ public function index() { $institutions = Institution::all(); return view('public.institutions')->with('institutions', $institutions); }
/** * Function that gets data of specified client. * * @return Response */ public function loadInstitutions() { // Check that user is part of authorized staff. if (Auth::user()->Type != 1) { // If they are unauthorized no point in returning anything. return response()->json(['state' => 'Unauthorized']); } // Get the institutions. $institutions = Institution::all(); $dataset = array(); foreach ($institutions as $institution) { array_push($dataset, array('id' => $institution->Id, 'name' => $institution->Name)); } // Return client info. $response['state'] = 'Success'; $response['dataset'] = $dataset; return response()->json($response); }
<?php $regions = \App\Region::all()->sortBy('name'); $institutions = \App\Institution::all()->sortBy('name'); ?> @extends('sysadmin') @section('content') @include('errors.list') <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">Register</div> <div class="panel-body"> {!! Form::open(['url'=>'/users/register', 'role'=>'form', 'class'=>'form-horizontal']) !!} <div class="col-md-8 col-md-offset-2"> <div class="form-group"> <label for="name">Name:</label> <input type="text" placeholder="Full Name" class="form-control" name="name" value="{{ old('name') }}" > </div> <div class="form-group"> <label for="email">Email:</label> <input type="text" placeholder="Email" class="form-control" name="email" value="{{ old('email') }}"> </div> <div class="form-group"> <label for="password">Password:</label> <input type="password" placeholder="Password" class="form-control" name="password"> </div>