/** * Set registration process active / in-active * * @param $user * @return mixed */ public function toggleRegistrationProcess($user) { if ($user === 'staff') { if ($this->isRegistrationActive('staff')) { unlink(storage_path() . '/app/activeForStaff'); // Clear the tables Grade::truncate(); ElectiveCount::truncate(); TeacherRequest::truncate(); AllocatedElective::truncate(); AdminStaffRequest::truncate(); HostelStaffRequest::truncate(); CurrentStudentState::truncate(); LibraryStaffRequest::truncate(); ChiefWardenStaffRequest::truncate(); Teacher::where('semNo', '>', '0')->update(['semNo' => null]); } else { touch(storage_path() . '/app/activeForStaff'); } } else { if ($user === 'students') { if ($this->isRegistrationActive('student')) { unlink(storage_path() . '/app/activeForStudents'); } else { touch(storage_path() . '/app/activeForStudents'); } } } return redirect()->back(); }