@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @return string |
56 | 56 | */ |
57 | - public function findUsername(){ |
|
57 | + public function findUsername() { |
|
58 | 58 | $login = request()->input('username'); |
59 | 59 | |
60 | - $fieldType = filter_var($login,FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; |
|
60 | + $fieldType = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; |
|
61 | 61 | |
62 | 62 | request()->merge([$fieldType => $login]); |
63 | 63 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @return string |
69 | 69 | */ |
70 | - public function username(){ |
|
70 | + public function username() { |
|
71 | 71 | return $this->username; |
72 | 72 | } |
73 | 73 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | |
8 | 8 | trait HasPermissionsTrait |
9 | 9 | { |
10 | - public function roles(){ |
|
11 | - return $this->belongsToMany(Security_group_user::class,'security_group_users'); |
|
10 | + public function roles() { |
|
11 | + return $this->belongsToMany(Security_group_user::class, 'security_group_users'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
15 | - public function hasRole( ... $roles ) { |
|
15 | + public function hasRole(... $roles) { |
|
16 | 16 | foreach ($roles as $role) { |
17 | 17 | if ($this->roles->contains('code', $role)) { |
18 | 18 | return true; |
@@ -18,10 +18,10 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | - * @param array $row |
|
22 | - * |
|
23 | - * @return \Illuminate\Database\Eloquent\Model|null |
|
24 | - */ |
|
21 | + * @param array $row |
|
22 | + * |
|
23 | + * @return \Illuminate\Database\Eloquent\Model|null |
|
24 | + */ |
|
25 | 25 | |
26 | 26 | public function sheets(): array |
27 | 27 | { |
@@ -40,7 +40,7 @@ |
||
40 | 40 | // TODO: Implement registerEvents() method. |
41 | 41 | |
42 | 42 | return [ |
43 | - BeforeSheet::class => function(BeforeSheet $event){ |
|
43 | + BeforeSheet::class => function(BeforeSheet $event) { |
|
44 | 44 | $this->sheetNames[] = $event->getSheet()->getTitle(); |
45 | 45 | |
46 | 46 | } |
@@ -25,11 +25,11 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function boot() |
|
29 | - { |
|
30 | - // |
|
31 | - if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
32 | - URL::forceScheme('https'); |
|
33 | - } |
|
34 | - } |
|
28 | + public function boot() |
|
29 | + { |
|
30 | + // |
|
31 | + if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
32 | + URL::forceScheme('https'); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function boot() |
29 | 29 | { |
30 | 30 | // |
31 | - if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
31 | + if ((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
32 | 32 | URL::forceScheme('https'); |
33 | 33 | } |
34 | 34 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | public function boot() { |
13 | 13 | $this->app->validator->resolver( function( $translator, $data, $rules, |
14 | - $messages = array(), $customAttributes = array() ) { |
|
14 | + $messages = array(), $customAttributes = array() ) { |
|
15 | 15 | return new ValidatorExtended( $translator, $data, $rules, $messages, |
16 | 16 | $customAttributes ); |
17 | 17 | } ); |
@@ -10,10 +10,10 @@ |
||
10 | 10 | public function register() {} |
11 | 11 | |
12 | 12 | public function boot() { |
13 | - $this->app->validator->resolver( function( $translator, $data, $rules, |
|
14 | - $messages = array(), $customAttributes = array() ) { |
|
15 | - return new ValidatorExtended( $translator, $data, $rules, $messages, |
|
16 | - $customAttributes ); |
|
13 | + $this->app->validator->resolver(function($translator, $data, $rules, |
|
14 | + $messages = array(), $customAttributes = array()) { |
|
15 | + return new ValidatorExtended($translator, $data, $rules, $messages, |
|
16 | + $customAttributes); |
|
17 | 17 | } ); |
18 | 18 | } |
19 | 19 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function register() |
14 | 14 | { |
15 | - $this->app->singleton('hash',function (){ |
|
15 | + $this->app->singleton('hash', function() { |
|
16 | 16 | return new SHAHasher($this->app); |
17 | 17 | }); |
18 | 18 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | $this->start_time = microtime(TRUE); |
47 | 47 | ini_set('memory_limit', '2048M'); |
48 | 48 | $students = $this->students->query() |
49 | - ->where('is_student',1) |
|
49 | + ->where('is_student', 1) |
|
50 | 50 | ->limit(100000) |
51 | 51 | ->offset($this->argument('offset')) |
52 | 52 | ->get()->toArray(); |
53 | 53 | $this->output->writeln('no of students'.count($students)); |
54 | 54 | $this->output->writeln('Update started'); |
55 | - array_walk($students,array($this,'updateNewUUID')); |
|
55 | + array_walk($students, array($this, 'updateNewUUID')); |
|
56 | 56 | $this->end_time = microtime(TRUE); |
57 | 57 | $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
58 | - $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete'); |
|
58 | + $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete'); |
|
59 | 59 | $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
60 | 60 | } |
61 | 61 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | * @param $student |
65 | 65 | * @throws \Exception |
66 | 66 | */ |
67 | - public function updateNewUUID($student){ |
|
68 | - if(!MoeUuid::isValidMoeUuid(3)){ |
|
67 | + public function updateNewUUID($student) { |
|
68 | + if (!MoeUuid::isValidMoeUuid(3)) { |
|
69 | 69 | $newId = MoeUuid::getUniqueAlphanumeric(3); |
70 | 70 | $this->output->writeln('Updating student:'.$student['id']); |
71 | - Security_user::query()->where('id',$student['id']) |
|
72 | - ->update(['openemis_no' => $newId , 'username' => str_replace('-','',$newId)]); |
|
71 | + Security_user::query()->where('id', $student['id']) |
|
72 | + ->update(['openemis_no' => $newId, 'username' => str_replace('-', '', $newId)]); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | { |
46 | 46 | $files = $this->getFiles(); |
47 | 47 | try { |
48 | - if(!empty($files)){ |
|
49 | - array_walk($files,array($this,'process')); |
|
48 | + if (!empty($files)) { |
|
49 | + array_walk($files, array($this, 'process')); |
|
50 | 50 | unset($files); |
51 | 51 | exit(); |
52 | 52 | |
53 | - }else{ |
|
53 | + }else { |
|
54 | 54 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
55 | 55 | $output->writeln('No files found,Waiting for files'); |
56 | 56 | exit(); |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | - }catch (Exception $e){ |
|
60 | + }catch (Exception $e) { |
|
61 | 61 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
62 | 62 | $output->writeln($e); |
63 | 63 | sleep(300); |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | |
68 | 68 | } |
69 | 69 | |
70 | - protected function getFiles(){ |
|
70 | + protected function getFiles() { |
|
71 | 71 | $files = Upload::where('is_processed', '=', 3) |
72 | - ->where('is_email_sent','=',0) |
|
72 | + ->where('is_email_sent', '=', 0) |
|
73 | 73 | ->where('updated_at', '<=', Carbon::now()->tz('Asia/Colombo')->subHours(3)) |
74 | 74 | ->limit(50) |
75 | 75 | ->get()->toArray(); |
76 | 76 | return $files; |
77 | 77 | } |
78 | 78 | |
79 | - protected function process($file){ |
|
79 | + protected function process($file) { |
|
80 | 80 | $time = Carbon::now()->tz('Asia/Colombo'); |
81 | 81 | $this->processSheet($file); |
82 | 82 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
83 | 83 | $now = Carbon::now()->tz('Asia/Colombo'); |
84 | - $output->writeln('=============== Time taken to batch ' .$now->diffInMinutes($time)); |
|
84 | + $output->writeln('=============== Time taken to batch '.$now->diffInMinutes($time)); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
88 | - protected function processSheet($file){ |
|
88 | + protected function processSheet($file) { |
|
89 | 89 | $this->startTime = Carbon::now()->tz('Asia/Colombo'); |
90 | 90 | $user = User::find($file['security_user_id']); |
91 | 91 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | Mail::to($user->email)->send(new TerminatedReport($file)); |
96 | 96 | DB::table('uploads') |
97 | 97 | ->where('id', $file['id']) |
98 | - ->update(['is_processed' => 3, 'is_email_sent' => 1,'updated_at' => now()]); |
|
99 | - } else { |
|
98 | + ->update(['is_processed' => 3, 'is_email_sent' => 1, 'updated_at' => now()]); |
|
99 | + }else { |
|
100 | 100 | exit(); |
101 | 101 | } |
102 | 102 | } |