Skip to content

Commit

Permalink
Merge pull request #294 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
Add Controller to HomePage
  • Loading branch information
JoshuaMicallefYBSU authored Aug 16, 2024
2 parents 8f2b870 + 22edca1 commit c4a3b38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/Http/Controllers/Training/InstructingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Http\Controllers\Controller;
use App\Models\Roster\RosterMember;
use App\Models\News\HomeNewControllerCert;
use App\Models\Training\Instructing\Instructors\Instructor;
use App\Models\Training\Instructing\Links\InstructorStudentAssignment;
use App\Models\Training\Instructing\Links\StudentStatusLabelLink;
Expand Down Expand Up @@ -479,8 +480,16 @@ public function certifyStudent($cid)
$link->save();

// Unassign Instructor from Student
$instructor_id = InstructorStudentAssignment::where('student_id', $student->id)->firstOrFail();
$instructor_id->delete();
$instructor_link = InstructorStudentAssignment::where('student_id', $cid);
$instructor_link->delete();

// Create new certification (for home page)
$controller_cert = new HomeNewControllerCert([
'controller_id' => $cid,
'user_id' => $cid,
'timestamp' => Carbon::now(),
]);
$controller_cert->save();

// Update Thread Tag to match site
$discord = new DiscordClient();
Expand Down
4 changes: 4 additions & 0 deletions app/Models/News/HomeNewControllerCert.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
*/
class HomeNewControllerCert extends Model
{
protected $fillable = [
'controller_id', 'user_id', 'timestamp',
];

public function controller()
{
return $this->belongsTo(User::class, 'controller_id');
Expand Down

0 comments on commit c4a3b38

Please sign in to comment.