@@ -68,7 +68,7 @@ |
||
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 | $user = User::make([ |
73 | 73 | 'name' => $data['name'], |
74 | 74 | 'email' => $data['student_number'].'@alunos.uminho.pt', |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function boot() |
17 | 17 | { |
18 | - Validator::extend('student_number', function ($attribute, $value, $parameters, $validator) { |
|
18 | + Validator::extend('student_number', function($attribute, $value, $parameters, $validator) { |
|
19 | 19 | return preg_match('/^(a|pg)[0-9]+$/', $value) === 1; |
20 | 20 | }); |
21 | 21 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function register() |
27 | 27 | { |
28 | - $this->app->singleton(ExchangeRegistry::class, function ($app) { |
|
28 | + $this->app->singleton(ExchangeRegistry::class, function($app) { |
|
29 | 29 | return new EloquentExchangeRegistry(); |
30 | 30 | }); |
31 | 31 | |
32 | - $this->app->singleton('settings', function ($app) { |
|
32 | + $this->app->singleton('settings', function($app) { |
|
33 | 33 | return Settings::firstOrNew([]); |
34 | 34 | }); |
35 | 35 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function index(ExchangeRegistry $exchangeLogger) |
17 | 17 | { |
18 | - $history = DB::transaction(function () use ($exchangeLogger) { |
|
18 | + $history = DB::transaction(function() use ($exchangeLogger) { |
|
19 | 19 | return $exchangeLogger->paginate(); |
20 | 20 | }); |
21 | 21 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function export() |
24 | 24 | { |
25 | 25 | // Get the list of students enrolled on each course |
26 | - $enrollments = DB::transaction(function () { |
|
26 | + $enrollments = DB::transaction(function() { |
|
27 | 27 | $enrollments = Enrollment::with(['student', 'course']) |
28 | 28 | ->get() |
29 | 29 | ->sortByDesc('courses.name'); |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | }); |
33 | 33 | |
34 | 34 | // Export to CSV |
35 | - $result = Excel::create('enrollments', function ($excel) use ($enrollments) { |
|
36 | - $excel->sheet('Enrollments', function ($sheet) use ($enrollments) { |
|
35 | + $result = Excel::create('enrollments', function($excel) use ($enrollments) { |
|
36 | + $excel->sheet('Enrollments', function($sheet) use ($enrollments) { |
|
37 | 37 | $sheet->loadView('enrollments.export', compact('enrollments')); |
38 | 38 | }); |
39 | 39 | }); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | $file = $request->enrollments; |
55 | 55 | $path = $file->path(); |
56 | 56 | |
57 | - Excel::load($path, function ($reader) { |
|
58 | - DB::transaction(function () use ($reader) { |
|
57 | + Excel::load($path, function($reader) { |
|
58 | + DB::transaction(function() use ($reader) { |
|
59 | 59 | // Loop for all the rows of the table |
60 | - $reader->each(function ($row, $index) { |
|
60 | + $reader->each(function($row, $index) { |
|
61 | 61 | $index += 2; // Skip header |
62 | 62 | |
63 | 63 | // Get the models of the given ids |
@@ -65,11 +65,11 @@ |
||
65 | 65 | */ |
66 | 66 | public function setExchangeEnrollments(Enrollment $from, Enrollment $to) : Exchange |
67 | 67 | { |
68 | - if (! $from->availableForExchange() || is_null($to->shift)) { |
|
68 | + if ( ! $from->availableForExchange() || is_null($to->shift)) { |
|
69 | 69 | throw new EnrollmentCannotBeExchangedException(); |
70 | 70 | } |
71 | 71 | |
72 | - if (! $from->course->is($to->course)) { |
|
72 | + if ( ! $from->course->is($to->course)) { |
|
73 | 73 | throw new ExchangeEnrollmentsOnDifferentCoursesException(); |
74 | 74 | } |
75 | 75 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function confirm($id) |
32 | 32 | { |
33 | - $exchange = DB::transaction(function () use ($id) { |
|
33 | + $exchange = DB::transaction(function() use ($id) { |
|
34 | 34 | $exchange = Exchange::findOrFail($id); |
35 | 35 | $this->checkDecideAuthorization($exchange); |
36 | 36 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function decline($id) |
55 | 55 | { |
56 | - $exchange = DB::transaction(function () use ($id) { |
|
56 | + $exchange = DB::transaction(function() use ($id) { |
|
57 | 57 | $exchange = Exchange::findOrFail($id); |
58 | 58 | $this->checkDecideAuthorization($exchange); |
59 | 59 | $exchange->delete(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function store($courseId) |
27 | 27 | { |
28 | 28 | try { |
29 | - $course = DB::transaction(function () use ($courseId) { |
|
29 | + $course = DB::transaction(function() use ($courseId) { |
|
30 | 30 | $course = Course::findOrFail($courseId); |
31 | 31 | $student = auth()->user()->student; |
32 | 32 | $student->enroll($course); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function destroy($courseId) |
54 | 54 | { |
55 | - $course = DB::transaction(function () use ($courseId) { |
|
55 | + $course = DB::transaction(function() use ($courseId) { |
|
56 | 56 | $course = Course::findOrFail($courseId); |
57 | 57 | auth()->user()->student->removeEnrollmentInCourse($course); |
58 | 58 |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | public function create($enrollmentId) |
31 | 31 | { |
32 | 32 | try { |
33 | - $data = DB::transaction(function () use ($enrollmentId) { |
|
33 | + $data = DB::transaction(function() use ($enrollmentId) { |
|
34 | 34 | $enrollment = Enrollment::ownedBy(auth()->user()->student) |
35 | 35 | ->findOrFail($enrollmentId); |
36 | 36 | |
37 | - if (! $enrollment->availableForExchange()) { |
|
37 | + if ( ! $enrollment->availableForExchange()) { |
|
38 | 38 | throw new \LogicException('The enrollment is not available for exchange.'); |
39 | 39 | } |
40 | 40 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return compact('enrollment', 'matchingEnrollments'); |
46 | 46 | }); |
47 | 47 | |
48 | - $data['matchingEnrollments'] = $data['matchingEnrollments']->map(function ($item) { |
|
48 | + $data['matchingEnrollments'] = $data['matchingEnrollments']->map(function($item) { |
|
49 | 49 | return [ |
50 | 50 | 'id' => $item->id, |
51 | 51 | '_toString' => $item->present()->inlineToString(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function store($enrollmentId, CreateRequest $request) |
72 | 72 | { |
73 | 73 | try { |
74 | - DB::transaction(function () use ($enrollmentId, $request) { |
|
74 | + DB::transaction(function() use ($enrollmentId, $request) { |
|
75 | 75 | $this->validate($request, [ |
76 | 76 | 'to_enrollment_id' => 'exists:enrollments,id', |
77 | 77 | ]); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function destroy($id) |
115 | 115 | { |
116 | - DB::transaction(function () use ($id) { |
|
116 | + DB::transaction(function() use ($id) { |
|
117 | 117 | $exchange = Exchange::ownedBy(auth()->user()->student) |
118 | 118 | ->findOrFail($id); |
119 | 119 |