Skip to content

Commit

Permalink
remember me checkbox, classroom tables WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
danivideda committed Dec 2, 2020
1 parent 15e4e36 commit 74973c5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function loginStudent(Request $request) {
'password' => 'required'
]);

if (!Auth::guard('student')->attempt($request->only('email', 'password'))) {
if (!Auth::guard('student')->attempt($request->only('email', 'password'), $request->remember)) {
return back()->with('status', 'Invalid login details');
}

Expand All @@ -35,7 +35,7 @@ public function loginTeacher(Request $request) {
'password' => 'required'
]);

if (!Auth::guard('teacher')->attempt($request->only('email', 'password'))) {
if (!Auth::guard('teacher')->attempt($request->only('email', 'password'), $request->remember)) {
return back()->with('status', 'Invalid login details');
}

Expand Down
15 changes: 15 additions & 0 deletions app/Http/Controllers/ClassroomController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Http\Controllers;

use App\Models\Classroom;
use Illuminate\Http\Request;

class ClassroomController extends Controller
{
public function createClassroom(Request $request) {
Classroom::create([

]);
}
}
4 changes: 4 additions & 0 deletions app/Http/Controllers/TeacherController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ class TeacherController extends Controller
public function index() {
return view('teacher.home.dashboard');
}

public function createClassroom(Request $request) {

}
}
22 changes: 22 additions & 0 deletions app/Models/Classroom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Classroom extends Model
{
use HasFactory;

protected $fillable = [
'name',
'code',
'detail',
'assignments'
];

protected $casts = [
'assignments' => 'array'
];
}
8 changes: 8 additions & 0 deletions resources/views/auth/login-student.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('password') border-red-
</div>
@enderror
</div>

<div class="mb-4">
<div class="flex items-center">
<input type="checkbox" name="remember" id="remember" class="mr-2">
<label for="remember">Remember me</label>
</div>
</div>

<div>
<button type="submit" class="bg-pink-600 text-white px-4 py-3 rounded font-medium w-full">Login</button>
</div>
Expand Down
8 changes: 8 additions & 0 deletions resources/views/auth/login-teacher.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class="bg-gray-100 border-2 w-full p-4 rounded-lg @error('password') border-red-
</div>
@enderror
</div>

<div class="mb-4">
<div class="flex items-center">
<input type="checkbox" name="remember" id="remember" class="mr-2">
<label for="remember">Remember me</label>
</div>
</div>

<div>
<button type="submit" class="bg-pink-600 text-white px-4 py-3 rounded font-medium w-full">Login</button>
</div>
Expand Down

0 comments on commit 74973c5

Please sign in to comment.