Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":13156:{a:2:{s:7:"defects";a:14:{s:74:"Tests\Feature\AttendanceModuleTest::can_view_student_attendance_by_section";i:4;s:92:"Tests\Feature\AttendanceModuleTest::students_are_added_to_a_section_before_taking_attendance";i:4;s:82:"Tests\Feature\AttendanceModuleTest::admin_or_teacher_can_adjust_student_attendance";i:4;s:62:"Tests\Feature\Auth\RegisterLoginTest::test_user_can_be_created";i:3;s:58:"Tests\Feature\Auth\RegisterLoginTest::test_user_can_log_in";i:3;s:112:"Tests\Feature\GradeModuleTest::teacher_can_get_total_calculated_marks_of_each_student_of_a_section_of_his_course";i:4;s:81:"Tests\Feature\GradeModuleTest::teacher_can_save_grade_for_a_section_of_his_course";i:4;s:70:"Tests\Feature\LibrarianTest::can_see_some_personal_student_information";i:4;s:72:"Tests\Feature\LibrarianTest::can_see_some_personal_librarian_information";i:3;s:47:"Tests\Feature\LibrarianTest::can_add_a_new_book";i:4;s:64:"Tests\Feature\Library\BookModuleTest::it_loads_the_new_book_page";i:3;s:85:"Tests\Feature\UserModuleTest::admin_redirected_to_register_with_register_role_student";i:4;s:70:"Tests\Feature\LibrarianTest::can_see_some_personal_teacher_information";i:3;s:53:"Tests\Feature\LibrarianTest::can_see_list_of_students";i:3;}s:5:"times";a:151:{s:43:"Tests\Feature\AccountingModuleTest::view_is";d:8.317;s:64:"Tests\Feature\AccountingModuleTest::accountant_can_create_sector";d:0.302;s:72:"Tests\Feature\AccountingModuleTest::accountant_can_view_edit_sector_form";d:0.153;s:62:"Tests\Feature\AccountingModuleTest::accountant_can_edit_sector";d:0.113;s:67:"Tests\Feature\AccountingModuleTest::accountant_can_view_income_list";d:0.162;s:61:"Tests\Feature\AccountingModuleTest::accountant_can_add_income";d:0.121;s:68:"Tests\Feature\AccountingModuleTest::accountant_can_view_expense_list";d:0.162;s:62:"Tests\Feature\AccountingModuleTest::accountant_can_add_expense";d:0.108;s:74:"Tests\Feature\AttendanceModuleTest::can_view_student_attendance_by_section";d:0.179;s:64:"Tests\Feature\AttendanceModuleTest::can_view_students_by_section";d:0.217;s:92:"Tests\Feature\AttendanceModuleTest::students_are_added_to_a_section_before_taking_attendance";d:0.119;s:73:"Tests\Feature\AttendanceModuleTest::view_student_attendance_by_student_id";d:0.17;s:92:"Tests\Feature\AttendanceModuleTest::admin_or_teacher_can_view_adjust_student_attendance_form";d:0.15;s:82:"Tests\Feature\AttendanceModuleTest::admin_or_teacher_can_adjust_student_attendance";d:0.136;s:81:"Tests\Feature\AttendanceModuleTest::admin_or_teacher_can_take_students_attendance";d:0.132;s:83:"Tests\Feature\AttendanceModuleTest::admin_or_teacher_can_update_students_attendance";d:0.118;s:91:"Tests\Feature\Auth\RegisterLoginTest::test_unauthenticated_user_cannot_view_a_register_form";d:0.075;s:62:"Tests\Feature\Auth\RegisterLoginTest::test_user_can_be_created";d:0.241;s:69:"Tests\Feature\Auth\RegisterLoginTest::test_user_can_view_a_login_form";d:0.112;s:58:"Tests\Feature\Auth\RegisterLoginTest::test_user_can_log_in";d:0.298;s:79:"Tests\Feature\CourseModuleTest::admin_or_teacher_can_view_courses_by_teacher_id";d:0.165;s:79:"Tests\Feature\CourseModuleTest::admin_or_teacher_can_view_courses_by_section_id";d:0.162;s:85:"Tests\Feature\CourseModuleTest::can_view_students_from_grade_table_by_course_and_exam";d:0.177;s:52:"Tests\Feature\CourseModuleTest::admin_can_add_course";d:0.113;s:67:"Tests\Feature\CourseModuleTest::admin_can_save_course_configuration";d:0.117;s:40:"Tests\Feature\ExampleTest::testBasicTest";d:0.014;s:75:"Tests\Feature\GradeModuleTest::can_view_classes_sections_for_students_grade";d:0.168;s:74:"Tests\Feature\GradeModuleTest::can_view_all_students_marks_under_a_section";d:0.173;s:58:"Tests\Feature\GradeModuleTest::can_view_grade_of_a_student";d:0.161;s:90:"Tests\Feature\GradeModuleTest::teacher_can_view_students_grades_of_a_section_of_his_course";d:0.198;s:92:"Tests\Feature\GradeModuleTest::teacher_can_submit_students_grades_of_a_section_of_his_course";d:0.281;s:112:"Tests\Feature\GradeModuleTest::teacher_can_get_total_calculated_marks_of_each_student_of_a_section_of_his_course";d:0.168;s:81:"Tests\Feature\GradeModuleTest::teacher_can_save_grade_for_a_section_of_his_course";d:0.117;s:44:"Tests\Feature\GradeSystemModuleTest::view_is";d:0.148;s:76:"Tests\Feature\GradeSystemModuleTest::admin_can_view_grade_system_create_form";d:0.171;s:66:"Tests\Feature\GradeSystemModuleTest::admin_can_create_grade_system";d:0.111;s:66:"Tests\Feature\GradeSystemModuleTest::admin_can_delete_grade_system";d:0.112;s:73:"Tests\Feature\LibrarianTest::can_see_dashboard_as_a_home_page_after_login";d:0.278;s:53:"Tests\Feature\LibrarianTest::can_see_list_of_students";d:0.339;s:70:"Tests\Feature\LibrarianTest::can_see_some_personal_student_information";d:0.441;s:53:"Tests\Feature\LibrarianTest::can_see_list_of_teachers";d:0.152;s:70:"Tests\Feature\LibrarianTest::can_see_some_personal_teacher_information";d:0.113;s:55:"Tests\Feature\LibrarianTest::can_see_list_of_librarians";d:0.155;s:72:"Tests\Feature\LibrarianTest::can_see_some_personal_librarian_information";d:0.114;s:46:"Tests\Feature\LibrarianTest::can_see_all_books";d:0.158;s:49:"Tests\Feature\LibrarianTest::can_see_book_details";d:0.167;s:50:"Tests\Feature\LibrarianTest::can_edit_book_details";d:0.264;s:49:"Tests\Feature\LibrarianTest::can_see_issued_books";d:0.183;s:47:"Tests\Feature\LibrarianTest::can_add_a_new_book";d:0.253;s:61:"Tests\Feature\Library\BookModuleTest::it_shows_the_books_list";d:0.118;s:67:"Tests\Feature\Library\BookModuleTest::it_displays_the_books_details";d:0.111;s:64:"Tests\Feature\Library\BookModuleTest::it_loads_the_new_book_page";d:0.111;s:59:"Tests\Feature\Library\BookModuleTest::it_creates_a_new_book";d:0.108;s:74:"Tests\Feature\Library\BookModuleTest::the_book_attributes_must_be_required";d:0.115;s:66:"Tests\Feature\Library\BookModuleTest::the_book_code_must_be_unique";d:0.11;s:65:"Tests\Feature\Library\BookModuleTest::it_loads_the_edit_book_page";d:0.112;s:58:"Tests\Feature\Library\BookModuleTest::a_book_can_be_edited";d:0.11;s:69:"Tests\Feature\Library\IssuedBookModuleTest::librarian_can_issue_books";d:0.131;s:45:"Tests\Feature\Manage\ClassModuleTest::view_is";d:0.299;s:61:"Tests\Feature\Manage\ClassModuleTest::it_shows_the_class_list";d:0.168;s:60:"Tests\Feature\Manage\ClassModuleTest::admin_can_create_class";d:0.426;s:46:"Tests\Feature\Manage\CourseModuleTest::view_is";d:0.114;s:63:"Tests\Feature\Manage\CourseModuleTest::it_shows_the_course_list";d:0.11;s:62:"Tests\Feature\Manage\CourseModuleTest::admin_can_create_course";d:0.218;s:59:"Tests\Feature\Manage\ExamModuleTest::it_shows_the_exam_list";d:0.198;s:70:"Tests\Feature\Manage\ExamModuleTest::can_view_active_exams_of_a_school";d:0.139;s:70:"Tests\Feature\Manage\ExamModuleTest::admin_can_view_exam_creation_form";d:0.201;s:58:"Tests\Feature\Manage\ExamModuleTest::admin_can_create_exam";d:0.116;s:60:"Tests\Feature\Manage\ExamModuleTest::admin_can_activate_exam";d:0.11;s:62:"Tests\Feature\Manage\ExamModuleTest::admin_can_deactivate_exam";d:0.118;s:60:"Tests\Feature\Manage\SchoolModuleTest::it_shows_schools_list";d:0.209;s:62:"Tests\Feature\Manage\SchoolModuleTest::it_creates_a_new_school";d:0.106;s:59:"Tests\Feature\Manage\SchoolModuleTest::it_shows_edit_school";d:0.145;s:64:"Tests\Feature\Manage\SchoolModuleTest::a_school_can_being_edited";d:0.108;s:47:"Tests\Feature\Manage\SectionModuleTest::view_is";d:0.118;s:65:"Tests\Feature\Manage\SectionModuleTest::it_shows_the_section_list";d:0.112;s:64:"Tests\Feature\Manage\SectionModuleTest::admin_can_create_section";d:0.119;s:66:"Tests\Feature\Manage\SettingModuleTest::it_shows_the_teachers_list";d:0.114;s:69:"Tests\Feature\Manage\SettingModuleTest::it_shows_the_departments_list";d:0.114;s:65:"Tests\Feature\Manage\SettingModuleTest::it_shows_the_classes_list";d:0.112;s:66:"Tests\Feature\Manage\SettingModuleTest::it_shows_the_sections_list";d:0.124;s:71:"Tests\Feature\Manage\SettingModuleTest::admin_can_create_new_department";d:0.121;s:62:"Tests\Feature\PaymentModuleTest::student_can_view_payment_page";d:0.161;s:63:"Tests\Feature\PaymentModuleTest::student_can_view_receipts_page";d:0.145;s:59:"Tests\Feature\UserModuleTest::can_view_students_of_a_school";d:0.112;s:59:"Tests\Feature\UserModuleTest::can_view_teachers_of_a_school";d:0.119;s:62:"Tests\Feature\UserModuleTest::can_view_accountants_of_a_school";d:0.141;s:61:"Tests\Feature\UserModuleTest::can_view_librarians_of_a_school";d:0.114;s:60:"Tests\Feature\UserModuleTest::can_view_students_of_a_section";d:0.167;s:68:"Tests\Feature\UserModuleTest::can_view_promote_section_students_form";d:0.161;s:58:"Tests\Feature\UserModuleTest::can_promote_section_students";d:0.121;s:85:"Tests\Feature\UserModuleTest::admin_redirected_to_register_with_register_role_student";d:0.117;s:68:"Tests\Feature\UsersExcelExportTest::admin_can_download_students_list";d:0.108;s:68:"Tests\Feature\UsersExcelExportTest::admin_can_download_teachers_list";d:0.107;s:82:"Tests\Feature\UsersExcelExportTest::non_admin_users_can_not_see_export_users_forms";d:0.112;s:60:"Test\Unit\App\AccountTest::the_accounts_are_filter_by_school";d:0.124;s:73:"Tests\Unit\App\AttendanceTest::an_attendance_is_an_instance_of_Attendance";d:0.136;s:63:"Tests\Unit\App\AttendanceTest::an_attendance_belongs_to_student";d:0.146;s:63:"Tests\Unit\App\AttendanceTest::an_attendance_belongs_to_section";d:0.172;s:60:"Tests\Unit\App\AttendanceTest::an_attendance_belongs_to_exam";d:0.106;s:55:"Tests\Unit\App\BookTest::a_class_is_an_instance_of_Book";d:0.105;s:49:"Tests\Unit\App\BookTest::a_book_belongs_to_school";d:0.107;s:48:"Tests\Unit\App\BookTest::a_book_belongs_to_class";d:0.115;s:47:"Tests\Unit\App\BookTest::a_book_belongs_to_user";d:0.104;s:55:"Tests\Unit\App\BookTest::the_books_are_filter_by_school";d:0.109;s:66:"Test\Unit\App\DepartmentTest::the_departments_are_filter_by_school";d:0.049;s:56:"Test\Unit\App\EventTest::the_events_are_filter_by_school";d:0.107;s:54:"Test\Unit\App\ExamTest::the_exams_are_filter_by_school";d:0.109;s:52:"Test\Unit\App\FeeTest::the_fees_are_filter_by_school";d:0.117;s:54:"Test\Unit\App\FormTest::the_forms_are_filter_by_school";d:0.11;s:57:"Tests\Unit\App\GradeTest::a_grade_is_an_instance_of_Grade";d:0.114;s:51:"Tests\Unit\App\GradeTest::a_grade_belongs_to_course";d:0.113;s:52:"Tests\Unit\App\GradeTest::a_grade_belongs_to_student";d:0.111;s:52:"Tests\Unit\App\GradeTest::a_grade_belongs_to_teacher";d:0.114;s:49:"Tests\Unit\App\GradeTest::a_grade_belongs_to_exam";d:0.124;s:75:"Tests\Unit\App\GradesystemTest::a_gradesystem_is_an_instance_of_Gradesystem";d:0.103;s:63:"Tests\Unit\App\GradesystemTest::a_gradesystem_belongs_to_school";d:0.105;s:69:"Tests\Unit\App\GradesystemTest::the_gradesystems_are_filter_by_school";d:0.107;s:73:"Tests\Unit\App\IssuedBookTest::an_Issuedbook_is_an_instance_of_Issuedbook";d:0.107;s:60:"Tests\Unit\App\IssuedBookTest::an_issuedbook_belongs_to_book";d:0.109;s:68:"Tests\Unit\App\IssuedBookTest::the_issued_books_are_filter_by_school";d:0.113;s:60:"Test\Unit\App\MessageTest::the_messages_are_filter_by_school";d:0.121;s:61:"Tests\Unit\App\MyclassTest::a_class_is_an_instance_of_Myclass";d:0.051;s:53:"Tests\Unit\App\MyclassTest::a_class_belongs_to_school";d:0.047;s:48:"Tests\Unit\App\MyclassTest::a_class_has_sections";d:0.049;s:45:"Tests\Unit\App\MyclassTest::a_class_has_books";d:0.045;s:57:"Tests\Unit\App\MyclassTest::my_class_are_filter_by_school";d:0.059;s:58:"Test\Unit\App\NoticeTest::the_notices_are_filter_by_school";d:0.121;s:60:"Test\Unit\App\RoutineTest::the_routines_are_filter_by_school";d:0.125;s:60:"Tests\Unit\App\SchoolTest::a_school_is_an_instance_of_School";d:0.047;s:45:"Tests\Unit\App\SchoolTest::a_school_has_users";d:0.045;s:51:"Tests\Unit\App\SchoolTest::a_school_has_departments";d:0.046;s:63:"Tests\Unit\App\SectionTest::a_section_is_an_instance_of_Section";d:0.044;s:54:"Tests\Unit\App\SectionTest::a_section_belongs_to_class";d:0.044;s:63:"Test\Unit\App\SyllabusTest::the_syllabuses_are_filter_by_school";d:0.119;s:56:"Tests\Unit\App\UsersTest::an_user_is_an_instance_of_User";d:0.104;s:52:"Tests\Unit\App\UsersTest::an_user_belongs_to_section";d:0.105;s:51:"Tests\Unit\App\UsersTest::an_user_belongs_to_school";d:0.104;s:55:"Tests\Unit\App\UsersTest::an_user_belongs_to_department";d:0.105;s:42:"Tests\Unit\App\UsersTest::an_user_has_role";d:0.114;s:56:"Tests\Unit\App\UsersTest::the_users_are_filter_by_school";d:0.121;s:37:"Tests\Unit\ExampleTest::testBasicTest";d:0.012;s:84:"Tests\Unit\IssuedBookTest::test_insert_each_issued_book_in_an_array with data set #0";d:0.039;s:59:"Tests\Unit\MarkCalculationTest::getMarkSum with data set #0";d:0.039;s:59:"Tests\Unit\MarkCalculationTest::getMarkSum with data set #1";d:0.038;s:59:"Tests\Unit\MarkCalculationTest::getMarkSum with data set #2";d:0.04;s:66:"Tests\Unit\MarkCalculationTest::getFieldFinalMark with data set #0";d:0.038;s:66:"Tests\Unit\MarkCalculationTest::getFieldFinalMark with data set #1";d:0.038;s:66:"Tests\Unit\MarkCalculationTest::getFieldFinalMark with data set #2";d:0.049;s:72:"Tests\Unit\MarkCalculationTest::getTotalCalculatedMarks with data set #0";d:0.038;s:72:"Tests\Unit\MarkCalculationTest::getTotalCalculatedMarks with data set #1";d:0.042;}}}
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: php
php:
- 7.4
- 7.3
- 7.2
- 7.1
before_script:
- cp .env.example .env
- composer install
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
\jdavidbakr\LaravelCacheGarbageCollector\LaravelCacheGarbageCollector::class,
// \jdavidbakr\LaravelCacheGarbageCollector\LaravelCacheGarbageCollector::class,
];

/**
Expand Down
10 changes: 5 additions & 5 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand Down Expand Up @@ -31,10 +31,10 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
Expand All @@ -43,10 +43,10 @@ public function report(Exception $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Expand Down
1 change: 1 addition & 0 deletions app/Homework.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class Homework extends Model
{
protected $table = 'homeworks';
/**
* Get the teacher record associated with the user.
*/
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
Expand Down Expand Up @@ -50,7 +51,7 @@ public function username()
public function credentials(Request $request)
{
$credentials = $request->only($this->username(), 'password');
$credentials = array_add($credentials, 'active', '1');
$credentials = Arr::add($credentials, 'active', '1');
return $credentials;
}
}
3 changes: 2 additions & 1 deletion app/Http/Controllers/GradeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Requests\Grade\CalculateMarksRequest;
use App\Http\Traits\GradeTrait;
use App\Services\Grade\GradeService;
use Mavinoo\LaravelBatch\LaravelBatch;

class GradeController extends Controller
{
Expand Down Expand Up @@ -166,7 +167,7 @@ public function update(Request $request)
$tbc = $this->gradeService->updateGrade($request);
try{
if(count($tbc) > 0)
\Batch::update('grades', (array) $tbc,'id');
LaravelBatch::update('grades', (array) $tbc,'id');
}catch(\Exception $e){
return __("Ops, an error occured");
}
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Notification as Notification;
use App\Http\Resources\NotificationResource;
use Illuminate\Http\Request;
use Mavinoo\LaravelBatch\LaravelBatch;

class NotificationController extends Controller
{
Expand All @@ -24,7 +25,7 @@ public function index($id)
'updated_at' => date('Y-m-d H:i:s'),
];
}
\Batch::update('notifications',(array) $msgs,'id');
LaravelBatch::update('notifications',(array) $msgs,'id');
return view('message.all',['messages'=>$msg]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use App\Http\Requests\User\ImpersonateUserRequest;
use App\Http\Requests\User\CreateLibrarianRequest;
use App\Http\Requests\User\CreateAccountantRequest;
use Mavinoo\LaravelBatch\Batch;
use Mavinoo\LaravelBatch\LaravelBatch;
use App\Events\UserRegistered;
use App\Events\StudentInfoUpdateRequested;
use Illuminate\Support\Facades\Log;
Expand Down
4 changes: 2 additions & 2 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Http\Resources\Json\Resource;
use Illuminate\Http\Resources\Json\JsonResource;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -16,7 +16,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
Schema::defaultStringLength(191);
Resource::withoutWrapping();
JsonResource::withoutWrapping();
}

/**
Expand Down
5 changes: 3 additions & 2 deletions app/Services/Attendance/AttendanceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use App\User;
use App\Attendance;
use Illuminate\Support\Facades\Auth;
use Mavinoo\LaravelBatch\LaravelBatch;

class AttendanceService {
public $request;
Expand Down Expand Up @@ -35,7 +36,7 @@ public function adjustPost($request){
'updated_at' => date('Y-m-d H:i:s'),
];
}
\Batch::update('attendances',(array) $atts,'id');
LaravelBatch::update('attendances',(array) $atts,'id');
return back()->with('status', 'Updated');
}catch(\Exception $ex){
return false;
Expand All @@ -44,7 +45,7 @@ public function adjustPost($request){

public function getTodaysAttendanceBySectionId($section_id){
return Attendance::where('section_id', $section_id)
->whereDate('created_at', \DB::raw('CURDATE()'))
->whereDate('created_at', '=', date('Y-m-d'))
->orderBy('created_at', 'desc')
->get()
->unique('student_id');
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Grade/GradeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Myclass;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Mavinoo\LaravelBatch\LaravelBatch;

class GradeService {

Expand Down Expand Up @@ -175,7 +176,7 @@ public function getCourseByCourseId(){
public function saveCalculatedGPAFromTotalMarks($tbc){
try{
if(count($tbc) > 0)
return \Batch::update('grades',(array) $tbc,'id');
return LaravelBatch::update('grades',(array) $tbc,'id');
}catch(\Exception $e){
return "OOps, an error occured";
}
Expand Down
14 changes: 8 additions & 6 deletions app/Services/User/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
use App\User;
use App\StudentInfo;
use Illuminate\Support\Facades\DB;
use Mavinoo\LaravelBatch\Batch;
use Mavinoo\LaravelBatch\LaravelBatch;
use Illuminate\Support\Facades\Log;

class UserService {

protected $user;
protected $student_info;
protected $db;
protected $batch;
protected $st, $st2;

public function __construct(User $user, DB $db, Batch $batch){
public function __construct(User $user, StudentInfo $student_info, DB $db, LaravelBatch $batch){
$this->user = $user;
$this->student_info = $student_info;
$this->db = $db;
$this->batch = $batch;
}
Expand Down Expand Up @@ -94,10 +96,10 @@ public function promoteSectionStudentsPost($request)

public function promoteSectionStudentsPostDBTransaction(){
return $this->db::transaction(function () {
$table1 = 'users';
$this->batch->update($table1, (array) $this->st, 'id');
$table2 = 'student_infos';
$this->batch->update($table2, (array) $this->st2, 'student_id');
// $table1 = 'users';
$this->batch->update($this->user, (array) $this->st, 'id');
// $table2 = 'student_infos';
$this->batch->update($this->student_info, (array) $this->st2, 'student_id');
});
}

Expand Down
Loading