@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function show($id) |
28 | 28 | { |
29 | - $data = DB::transaction(function () use ($id) { |
|
29 | + $data = DB::transaction(function() use ($id) { |
|
30 | 30 | $course = Course::findOrFail($id); |
31 | 31 | $enrollments = $course->enrollments() |
32 | 32 | ->with('student.user') |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function export() |
33 | 33 | { |
34 | 34 | // Get the list of students enrolled on each course |
35 | - $enrollments = DB::transaction(function () { |
|
35 | + $enrollments = DB::transaction(function() { |
|
36 | 36 | $enrollments = Enrollment::with('student', 'course') |
37 | 37 | ->get() |
38 | 38 | ->sortByDesc('courses.name'); |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | }); |
42 | 42 | |
43 | 43 | // Export to CSV |
44 | - $result = Excel::create('enrollments', function ($excel) use ($enrollments) { |
|
45 | - $excel->sheet('Enrollments', function ($sheet) use ($enrollments) { |
|
44 | + $result = Excel::create('enrollments', function($excel) use ($enrollments) { |
|
45 | + $excel->sheet('Enrollments', function($sheet) use ($enrollments) { |
|
46 | 46 | $sheet->loadView('enrollments.export', compact('enrollments')); |
47 | 47 | }); |
48 | 48 | }); |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | $file = $request->enrollments; |
64 | 64 | $path = $file->path(); |
65 | 65 | |
66 | - Excel::load($path, function ($reader) { |
|
67 | - DB::transaction(function () use ($reader) { |
|
66 | + Excel::load($path, function($reader) { |
|
67 | + DB::transaction(function() use ($reader) { |
|
68 | 68 | // Loop for all the rows of the table |
69 | - $reader->each(function ($row, $index) { |
|
69 | + $reader->each(function($row, $index) { |
|
70 | 70 | $index += 2; // Skip header |
71 | 71 | |
72 | 72 | // Get the models of the given ids |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function update(UpdateRequest $request) |
39 | 39 | { |
40 | - DB::transaction(function () use ($request) { |
|
40 | + DB::transaction(function() use ($request) { |
|
41 | 41 | app('settings')->update($request->all()); |
42 | 42 | }); |
43 | 43 | flash('Settings were successfully updated.')->success(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function store($id) |
33 | 33 | { |
34 | 34 | try { |
35 | - $course = DB::transaction(function () use ($id) { |
|
35 | + $course = DB::transaction(function() use ($id) { |
|
36 | 36 | $course = Course::findOrFail($id); |
37 | 37 | Auth::student()->enroll($course); |
38 | 38 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function destroy($id) |
57 | 57 | { |
58 | 58 | try { |
59 | - $course = DB::transaction(function () use ($id) { |
|
59 | + $course = DB::transaction(function() use ($id) { |
|
60 | 60 | $course = Course::findOrFail($id); |
61 | 61 | Auth::student()->unenroll($course); |
62 | 62 |
@@ -140,7 +140,7 @@ |
||
140 | 140 | throw new StudentIsNotEnrolledInCourseException($course); |
141 | 141 | } |
142 | 142 | |
143 | - if (! $enrollment->isDeletable()) { |
|
143 | + if ( ! $enrollment->isDeletable()) { |
|
144 | 144 | throw new EnrollmentCannotBeDeleted($enrollment); |
145 | 145 | } |
146 | 146 |
@@ -72,11 +72,11 @@ |
||
72 | 72 | */ |
73 | 73 | public function setExchangeEnrollments(Enrollment $from, Enrollment $to) : self |
74 | 74 | { |
75 | - if (! $from->availableForExchange() || is_null($to->shift)) { |
|
75 | + if ( ! $from->availableForExchange() || is_null($to->shift)) { |
|
76 | 76 | throw new EnrollmentCannotBeExchangedException(); |
77 | 77 | } |
78 | 78 | |
79 | - if (! $from->course->is($to->course)) { |
|
79 | + if ( ! $from->course->is($to->course)) { |
|
80 | 80 | throw new ExchangeEnrollmentsOnDifferentCoursesException(); |
81 | 81 | } |
82 | 82 |
@@ -39,9 +39,9 @@ |
||
39 | 39 | */ |
40 | 40 | public function handle() |
41 | 41 | { |
42 | - DB::transaction(function () { |
|
42 | + DB::transaction(function() { |
|
43 | 43 | $students = Student::with('user')->get(); |
44 | - $students->each(function ($student) { |
|
44 | + $students->each(function($student) { |
|
45 | 45 | $user = $student->user; |
46 | 46 | if ($user->verified) { |
47 | 47 | return; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function validator(array $data) |
50 | 50 | { |
51 | - if (! is_null($data['student_number'])) { |
|
51 | + if ( ! is_null($data['student_number'])) { |
|
52 | 52 | $data['student_number'] = strtolower($data['student_number']); |
53 | 53 | } |
54 | 54 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function create(array $data) |
70 | 70 | { |
71 | - $user = DB::transaction(function () use ($data) { |
|
71 | + $user = DB::transaction(function() use ($data) { |
|
72 | 72 | $data['student_number'] = strtolower($data['student_number']); |
73 | 73 | $user = User::make([ |
74 | 74 | 'name' => $data['name'], |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | URL::forceScheme('https'); |
21 | 21 | } |
22 | 22 | |
23 | - Auth::macro('student', function () { |
|
23 | + Auth::macro('student', function() { |
|
24 | 24 | return Auth::check() ? Auth::user()->student : null; |
25 | 25 | }); |
26 | 26 | |
27 | - Validator::extend('student_number', function ($attribute, $value, $parameters, $validator) { |
|
27 | + Validator::extend('student_number', function($attribute, $value, $parameters, $validator) { |
|
28 | 28 | return preg_match('/^(a|pg)[0-9]+$/i', $value) === 1; |
29 | 29 | }); |
30 | 30 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function register() |
36 | 36 | { |
37 | - $this->app->singleton(ExchangeRegistry::class, function ($app) { |
|
37 | + $this->app->singleton(ExchangeRegistry::class, function($app) { |
|
38 | 38 | return new EloquentExchangeRegistry(); |
39 | 39 | }); |
40 | 40 | |
41 | - $this->app->singleton('settings', function ($app) { |
|
41 | + $this->app->singleton('settings', function($app) { |
|
42 | 42 | return Settings::firstOrNew([]); |
43 | 43 | }); |
44 | 44 | } |