@@ -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 |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function boot() |
18 | 18 | { |
19 | - Auth::macro('student', function () { |
|
19 | + Auth::macro('student', function() { |
|
20 | 20 | return Auth::check() ? Auth::user()->student : null; |
21 | 21 | }); |
22 | 22 | |
23 | - Validator::extend('student_number', function ($attribute, $value, $parameters, $validator) { |
|
23 | + Validator::extend('student_number', function($attribute, $value, $parameters, $validator) { |
|
24 | 24 | return preg_match('/^(a|pg)[0-9]+$/i', $value) === 1; |
25 | 25 | }); |
26 | 26 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function register() |
32 | 32 | { |
33 | - $this->app->singleton(ExchangeRegistry::class, function ($app) { |
|
33 | + $this->app->singleton(ExchangeRegistry::class, function($app) { |
|
34 | 34 | return new EloquentExchangeRegistry(); |
35 | 35 | }); |
36 | 36 | |
37 | - $this->app->singleton('settings', function ($app) { |
|
37 | + $this->app->singleton('settings', function($app) { |
|
38 | 38 | return Settings::firstOrNew([]); |
39 | 39 | }); |
40 | 40 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | protected function create(array $data) |
66 | 66 | { |
67 | - $user = DB::transaction(function () use ($data) { |
|
67 | + $user = DB::transaction(function() use ($data) { |
|
68 | 68 | $data['student_number'] = strtolower($data['student_number']); |
69 | 69 | $user = User::make([ |
70 | 70 | 'name' => $data['name'], |
@@ -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 |