Completed
Push — master ( 8b7bfc...a46512 )
by claudio
06:10 queued 01:48
created
app/Http/Controllers/Employees/Auth/AuthController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
      * en = employee normal
43 43
      * @var array
44 44
      */
45
-    protected $custom = ['mode' => 'en'];
45
+    protected $custom = [ 'mode' => 'en' ];
46 46
 
47 47
     /**
48 48
      * unique identifiers of the user
49 49
      * @var array
50 50
      */
51
-    protected $username = ['company_id', 'email'];
51
+    protected $username = [ 'company_id', 'email' ];
52 52
 
53 53
     /**
54 54
      * @var company
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function __construct()
63 63
     {
64
-        config(['auth.model' => \plunner\Employee::class]);
65
-        config(['jwt.user' => \plunner\Employee::class]);
64
+        config([ 'auth.model' => \plunner\Employee::class ]);
65
+        config([ 'jwt.user' => \plunner\Employee::class ]);
66 66
     }
67 67
 
68 68
     public function postRegister(Request $request)
69 69
     {
70
-        $this->validate($request, ['company' => 'required|exists:companies,name']);
70
+        $this->validate($request, [ 'company' => 'required|exists:companies,name' ]);
71 71
         $this->company = Company::whereName($request->input('company'))->firstOrFail();
72 72
         return $this->postRegisterOriginal($request);
73 73
     }
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
     public function postLogin(Request $request)
76 76
     {
77 77
         //get company ID and impiled it in the request
78
-        $this->validate($request, ['company' => 'required|exists:companies,name']);
78
+        $this->validate($request, [ 'company' => 'required|exists:companies,name' ]);
79 79
         $this->company = Company::whereName($request->input('company'))->firstOrFail();
80
-        $request->merge(['company_id' => $this->company->id]);
80
+        $request->merge([ 'company_id' => $this->company->id ]);
81 81
 
82 82
         //remember me
83
-        $this->validate($request, ['remember' => 'required|boolean']);
83
+        $this->validate($request, [ 'remember' => 'required|boolean' ]);
84 84
         if ($request->input('remember', false)) {
85
-            config(['jwt.ttl' => '43200']); //30 days
86
-            $this->custom = array_merge($this->custom, ['remember' => 'true']);
85
+            config([ 'jwt.ttl' => '43200' ]); //30 days
86
+            $this->custom = array_merge($this->custom, [ 'remember' => 'true' ]);
87 87
         } else
88
-            $this->custom = array_merge($this->custom, ['remember' => 'false']);
88
+            $this->custom = array_merge($this->custom, [ 'remember' => 'false' ]);
89 89
 
90 90
         return $this->postLoginOriginal($request);
91 91
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         return Validator::make($data, [
102 102
             'name' => 'required|min:1|max:255',
103
-            'email' => 'required|email|max:255|unique:employees,email,NULL,id,company_id,' . $this->company->id,
103
+            'email' => 'required|email|max:255|unique:employees,email,NULL,id,company_id,'.$this->company->id,
104 104
             'password' => 'required|confirmed|min:6',
105 105
         ]);
106 106
     }
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
     protected function create(array $data)
115 115
     {
116 116
         return $this->company->save(new employee([
117
-            'name' => $data['name'],
118
-            'email' => $data['email'],
119
-            'password' => bcrypt($data['password']),
117
+            'name' => $data[ 'name' ],
118
+            'email' => $data[ 'email' ],
119
+            'password' => bcrypt($data[ 'password' ]),
120 120
         ]));
121 121
     }
122 122
 }
Please login to merge, or discard this patch.