Skip to content

Commit

Permalink
Multiple user types done. now adding flesh to the landing page of eac…
Browse files Browse the repository at this point in the history
…h user
  • Loading branch information
TimothyMee committed Feb 21, 2018
1 parent 21734bf commit 3998ec3
Show file tree
Hide file tree
Showing 10 changed files with 526 additions and 22 deletions.
23 changes: 22 additions & 1 deletion app/Http/Controllers/AuthController.php
Expand Up @@ -4,9 +4,30 @@

use Illuminate\Http\Request;
use Mockery\Exception;
use App\User;

class AuthController extends Controller
{
public function registerStudent()
{
return view ('auth.register');
}

public function postStudentRegistration(Request $request, User $user)
{
try
{
$result = $user->createNew($request->all());
if ($result){
return view('auth.login');
}
}
catch (\Exception $e)
{
return apiFailure($e);
}
}

public function login()
{
$title = 'Login to your account';
Expand All @@ -25,7 +46,7 @@ public function postLogin(Request $request)

elseif(auth()->user()->user_type == 3)
{
return redirect()->intended(route('home'));
return redirect()->intended(route('student.home'));
}
elseif(auth()->user()->user_type == 4)
{
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/HomeController.php
Expand Up @@ -29,4 +29,9 @@ public function index()
$totalOfStaffs = User::count();
return view('home', ['totalOfStudents' => $totalOfStudents, 'totalOfStaffs' =>$totalOfStaffs]);
}

public function studentHome()
{
return view('studentHome', ['id' => auth()->user()->identification_no,]);
}
}
1 change: 0 additions & 1 deletion config/default.php
Expand Up @@ -18,7 +18,6 @@
['name' => 'SuperAdmin', 'description' => 'Has all rights to any part of the system', 'staff_id' => 1, ],
['name' => 'Admin', 'description' => 'Has rights to create,delete and update all except admins', 'staff_id' => 1, ],
['name' => 'Student', 'description' => 'The main subject of the Application', 'staff_id' => 1, ],
['name' => 'Parent', 'description' => 'Parent of the Student', 'staff_id' => 1, ],
],

'department' => [
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/2014_10_12_000000_create_users_table.php
Expand Up @@ -22,9 +22,9 @@ public function up()
$table->string('email');
$table->string('identification_no')->unique();
$table->string('password');
$table->integer('department_id');
$table->integer('department_id')->nullable();
$table->integer('user_type');
$table->integer('staff_id');
$table->integer('staff_id')->nullable();
$table->boolean('is_active')->default(true);
$table->rememberToken();
$table->softDeletes();
Expand Down
6 changes: 5 additions & 1 deletion resources/views/auth/login.blade.php
Expand Up @@ -68,14 +68,18 @@
</div>

<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<div class="col-md-9 col-md-offset-2">
<button type="submit" class="btn btn-primary">
Login
</button>

<a class="btn btn-link" href="">
Forgot Your Password?
</a>

<a href="{{route('register')}}" style="color: red">
Student and Don't have an account?
</a>
</div>
</div>
</form>
Expand Down
15 changes: 1 addition & 14 deletions resources/views/auth/register.blade.php
Expand Up @@ -109,20 +109,6 @@
</div>
</div>

<div class="form-group">
<label for="password" class="col-md-4 control-label">Department</label>

<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>

@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>

<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>

Expand All @@ -132,6 +118,7 @@
</div>


<input type="hidden" name ="user_type" value="3">

<div class="form-group">
<div class="col-md-6 col-md-offset-4">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/layouts/app.blade.php
Expand Up @@ -127,8 +127,8 @@
</a>
<ul class="dropdown-menu">
<li><a href="{{route('course.index')}}">Add New Course</a></li>
{{-- <li><a href="{{route('course-registration.new')}}">Student's Course Registration</a></li>--}}
{{-- <li><a href="{{route('course-registration.edit')}}">Edit Registration</a></li>--}}
<li><a href="{{route('course-registration.new')}}">Student's Course Registration</a></li>
<li><a href="{{route('course-registration.edit')}}">Edit Registration</a></li>
</ul>
</li>

Expand Down

0 comments on commit 3998ec3

Please sign in to comment.