@@ -20,8 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($model = null) |
22 | 22 | { |
23 | - if (isset($model)) |
|
24 | - $this->model = $model; |
|
23 | + if (isset($model)) { |
|
24 | + $this->model = $model; |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | /** |
@@ -20,8 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($model = null) |
22 | 22 | { |
23 | - if (isset($model)) |
|
24 | - $this->model = $model; |
|
23 | + if (isset($model)) { |
|
24 | + $this->model = $model; |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function update($id, Request $request) |
31 | 31 | { |
32 | - $this->validate($request, [ 'value' => 'required' ]); |
|
32 | + $this->validate($request, ['value' => 'required']); |
|
33 | 33 | |
34 | 34 | $move = Base::getSettingsRepository()->findOrFail($id); |
35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $after = $move->value; |
41 | 41 | |
42 | - Base::Log('Website settings changed. Changed "' . $move->friendly_name . '" value from "' . $before . '" to "' . $after . '"'); |
|
42 | + Base::Log('Website settings changed. Changed "'.$move->friendly_name.'" value from "'.$before.'" to "'.$after.'"'); |
|
43 | 43 | |
44 | 44 | return redirect('admin/settings'); |
45 | 45 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getForgotPasswordConfirm($userId, $passwordResetCode) |
95 | 95 | { |
96 | 96 | // Find the user using the password reset code |
97 | - if(!$user = Sentinel::findById($userId)) |
|
97 | + if (!$user = Sentinel::findById($userId)) |
|
98 | 98 | { |
99 | 99 | // Redirect to the forgot password page |
100 | 100 | return Redirect::route('forgot-password')->with('error', Lang::get('base.auth.forgot_password_confirm.error')); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | // Find the user using the password reset code |
136 | - if(!$user = Sentinel::findById($userId)) |
|
136 | + if (!$user = Sentinel::findById($userId)) |
|
137 | 137 | { |
138 | 138 | // Redirect to the forgot password page |
139 | 139 | return Redirect::route('login')->with('error', Lang::get('base.auth.activate.error')); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return back()->withInput()->withErrors($validator); |
186 | 186 | } |
187 | 187 | try { |
188 | - foreach(Sentinel::createModel()->getLoginNames() as $loginName) |
|
188 | + foreach (Sentinel::createModel()->getLoginNames() as $loginName) |
|
189 | 189 | { |
190 | 190 | $data = array( |
191 | 191 | $loginName => Input::only('email')["email"], |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | ); |
194 | 194 | |
195 | 195 | // Try to log the user in |
196 | - if(Sentinel::authenticate($data, Input::get('remember-me', false))) |
|
196 | + if (Sentinel::authenticate($data, Input::get('remember-me', false))) |
|
197 | 197 | { |
198 | 198 | $user = Sentinel::check(); |
199 | 199 | $user->update(['ip' => Request::ip()]); |
200 | - Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') logged in with IP ' . Request::ip() ); |
|
200 | + Base::Log($user->username.' ('.$user->first_name.' '.$user->last_name.') logged in with IP '.Request::ip()); |
|
201 | 201 | |
202 | 202 | // Redirect to the dashboard page |
203 | 203 | return Redirect::route("home")->with('success', Lang::get('base.auth.signin.success')); |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | $this->messageBag->add('email', Lang::get('base.auth.account.not_activated')); |
210 | 210 | } catch (ThrottlingException $e) { |
211 | 211 | $delay = $e->getDelay(); |
212 | - $this->messageBag->add('email', Lang::get('base.auth.account.suspended', compact('delay' ))); |
|
212 | + $this->messageBag->add('email', Lang::get('base.auth.account.suspended', compact('delay'))); |
|
213 | 213 | } |
214 | - Base::Log('Login attempt registred for ' . Input::only('email')["email"] . ' from IP ' . Request::ip() ); |
|
214 | + Base::Log('Login attempt registred for '.Input::only('email')["email"].' from IP '.Request::ip()); |
|
215 | 215 | |
216 | 216 | // Ooops.. something went wrong |
217 | 217 | return back()->withInput()->withErrors($this->messageBag); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $rules = array(); |
246 | 246 | |
247 | 247 | // Declare the rules for the form validation |
248 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
248 | + foreach (Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
249 | 249 | $rules[$fieldid] = $field['validator']; |
250 | 250 | |
251 | 251 | $rules['g-recaptcha-response'] = 'required'; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $data = array(); |
269 | 269 | |
270 | 270 | // Set the data to the user from the User class |
271 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
271 | + foreach (Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
272 | 272 | $data[$fieldid] = Input::get($fieldid); |
273 | 273 | |
274 | 274 | // Set the standard data to the user |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $testing = Sentinel::createModel()->getRegisterFields(); |
289 | 289 | $user = Sentinel::findById($user->id); |
290 | 290 | |
291 | - foreach($data as $fieldid => $field) |
|
291 | + foreach ($data as $fieldid => $field) |
|
292 | 292 | if (!isset($testing[$fieldid]) || $testing[$fieldid]['save'] == true) |
293 | 293 | $user[$fieldid] = $field; |
294 | 294 | |
@@ -314,18 +314,18 @@ discard block |
||
314 | 314 | ); |
315 | 315 | |
316 | 316 | // Send the activation code through email |
317 | - Mail::queue('emails.auth.register-activate', $data, function ($m) use ($user) { |
|
318 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
319 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name); |
|
317 | + Mail::queue('emails.auth.register-activate', $data, function($m) use ($user) { |
|
318 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
319 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name); |
|
320 | 320 | }); |
321 | 321 | } |
322 | 322 | |
323 | 323 | // If the administrator needs to activate the account send the user a warning saying that |
324 | 324 | if ($adminActivation) |
325 | 325 | { |
326 | - Mail::queue('emails.auth.register-admin-activate', ['user' => $user], function ($m) use ($user) { |
|
327 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
328 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name); |
|
326 | + Mail::queue('emails.auth.register-admin-activate', ['user' => $user], function($m) use ($user) { |
|
327 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
328 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name); |
|
329 | 329 | }); |
330 | 330 | } |
331 | 331 | |
@@ -337,22 +337,22 @@ discard block |
||
337 | 337 | if (Activation::complete($user, $activation->code)) { |
338 | 338 | Sentinel::login($user, false); |
339 | 339 | |
340 | - Mail::queue('emails.auth.activated', ['user' => $user], function ($m) use ($user) { |
|
341 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
342 | - $m->subject(Lang::get('base.mails.welcome') . ' ' . $user->first_name); |
|
340 | + Mail::queue('emails.auth.activated', ['user' => $user], function($m) use ($user) { |
|
341 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
342 | + $m->subject(Lang::get('base.mails.welcome').' '.$user->first_name); |
|
343 | 343 | }); |
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | - Base::Log('New account registred for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() ); |
|
347 | + Base::Log('New account registred for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip()); |
|
348 | 348 | |
349 | 349 | // Redirect to the home page with success menu |
350 | - return Redirect::to("login")->with('success', Lang::get('base.auth.signup.success') . $adminActivation ? Lang::get('base.auth.signup.admin') : $userActivation ? Lang::get('base.auth.signup.self') : Lang::get('base.auth.signup.ready')); |
|
350 | + return Redirect::to("login")->with('success', Lang::get('base.auth.signup.success').$adminActivation ? Lang::get('base.auth.signup.admin') : $userActivation ? Lang::get('base.auth.signup.self') : Lang::get('base.auth.signup.ready')); |
|
351 | 351 | } catch (UserExistsException $e) { |
352 | 352 | $this->messageBag->add('email', Lang::get('base.auth.account.already_exists')); |
353 | 353 | } |
354 | 354 | |
355 | - Base::Log('New account registration attempt from IP ' . Request::ip() ); |
|
355 | + Base::Log('New account registration attempt from IP '.Request::ip()); |
|
356 | 356 | |
357 | 357 | // Ooops.. something went wrong |
358 | 358 | return Redirect::back()->withInput()->withErrors($this->messageBag); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | // Get the user password recovery code |
383 | 383 | $user = Sentinel::findByCredentials(['email' => Input::get('email')]); |
384 | 384 | |
385 | - if($user) |
|
385 | + if ($user) |
|
386 | 386 | { |
387 | 387 | //get reminder for user |
388 | 388 | $reminder = Reminder::exists($user) ?: Reminder::create($user); |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | // Data to be used on the email view |
391 | 391 | $data = array( |
392 | 392 | 'user' => $user, |
393 | - 'forgotPasswordUrl' => URL::route('forgot-password-confirm',[$user->id, $reminder->code]), |
|
393 | + 'forgotPasswordUrl' => URL::route('forgot-password-confirm', [$user->id, $reminder->code]), |
|
394 | 394 | ); |
395 | 395 | |
396 | - Base::Log('Forgot password request for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() ); |
|
396 | + Base::Log('Forgot password request for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip()); |
|
397 | 397 | |
398 | 398 | // Send the activation code through email |
399 | - Mail::queue('emails.auth.forgot-password', $data, function ($m) use ($user) { |
|
400 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
399 | + Mail::queue('emails.auth.forgot-password', $data, function($m) use ($user) { |
|
400 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
401 | 401 | $m->subject(Lang::get('base.mails.recovery')); |
402 | 402 | }); |
403 | 403 | } |
@@ -427,26 +427,26 @@ discard block |
||
427 | 427 | // If validation fails, we'll exit the operation now. |
428 | 428 | if ($validator->fails()) { |
429 | 429 | // Ooops.. something went wrong |
430 | - return Redirect::route('forgot-password-confirm', compact(['userId','passwordResetCode']))->withInput()->withErrors($validator); |
|
430 | + return Redirect::route('forgot-password-confirm', compact(['userId', 'passwordResetCode']))->withInput()->withErrors($validator); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | // Find the user using the password reset code |
434 | 434 | $user = Sentinel::findById($userId); |
435 | - if(!$reminder = Reminder::complete($user, $passwordResetCode, Input::get('password'))) |
|
435 | + if (!$reminder = Reminder::complete($user, $passwordResetCode, Input::get('password'))) |
|
436 | 436 | { |
437 | - Base::Log('Forgot password confirm failed for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() ); |
|
437 | + Base::Log('Forgot password confirm failed for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip()); |
|
438 | 438 | |
439 | 439 | // Ooops.. something went wrong |
440 | 440 | return Redirect::route('login')->with('error', Lang::get('base.auth.forgot_password_confirm.error')); |
441 | 441 | } else { |
442 | 442 | // Send the activation code through email |
443 | - Mail::queue('emails.auth.password-changed', [ 'user' => $user], function ($m) use ($user) { |
|
444 | - $m->to($user->email, $user->first_name . ' ' . $user->last_name); |
|
443 | + Mail::queue('emails.auth.password-changed', ['user' => $user], function($m) use ($user) { |
|
444 | + $m->to($user->email, $user->first_name.' '.$user->last_name); |
|
445 | 445 | $m->subject(Lang::get('base.mails.password_changed')); |
446 | 446 | }); |
447 | 447 | } |
448 | 448 | |
449 | - Base::Log('Forgot password confirmed for ' . $user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') from IP ' . Request::ip() ); |
|
449 | + Base::Log('Forgot password confirmed for '.$user->username.' ('.$user->first_name.' '.$user->last_name.') from IP '.Request::ip()); |
|
450 | 450 | |
451 | 451 | // Password successfully reseted |
452 | 452 | return Redirect::route('login')->with('success', Lang::get('base.auth.forgot_password_confirm.success')); |
@@ -49,10 +49,11 @@ discard block |
||
49 | 49 | // Is the user logged in? |
50 | 50 | if (Sentinel::check()) |
51 | 51 | { |
52 | - if (Sentinel::inRole('admin')) |
|
53 | - return Redirect::route('home'); |
|
54 | - else |
|
55 | - return Redirect::route('user.home'); |
|
52 | + if (Sentinel::inRole('admin')) { |
|
53 | + return Redirect::route('home'); |
|
54 | + } else { |
|
55 | + return Redirect::route('user.home'); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | // Show the page |
@@ -69,10 +70,11 @@ discard block |
||
69 | 70 | // Is the user logged in? |
70 | 71 | if (Sentinel::check()) |
71 | 72 | { |
72 | - if (Sentinel::inRole('admin')) |
|
73 | - return Redirect::route('home'); |
|
74 | - else |
|
75 | - return Redirect::route('user.home'); |
|
73 | + if (Sentinel::inRole('admin')) { |
|
74 | + return Redirect::route('home'); |
|
75 | + } else { |
|
76 | + return Redirect::route('user.home'); |
|
77 | + } |
|
76 | 78 | } |
77 | 79 | |
78 | 80 | // Show the page |
@@ -89,10 +91,11 @@ discard block |
||
89 | 91 | // Is the user logged in? |
90 | 92 | if (Sentinel::check()) |
91 | 93 | { |
92 | - if (Sentinel::inRole('admin')) |
|
93 | - return Redirect::route('home'); |
|
94 | - else |
|
95 | - return Redirect::route('user.home'); |
|
94 | + if (Sentinel::inRole('admin')) { |
|
95 | + return Redirect::route('home'); |
|
96 | + } else { |
|
97 | + return Redirect::route('user.home'); |
|
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | // Show the page |
@@ -145,10 +148,11 @@ discard block |
||
145 | 148 | // Is user logged in? |
146 | 149 | if (Sentinel::check()) |
147 | 150 | { |
148 | - if (Sentinel::inRole('admin')) |
|
149 | - return Redirect::route('home'); |
|
150 | - else |
|
151 | - return Redirect::route('user.home'); |
|
151 | + if (Sentinel::inRole('admin')) { |
|
152 | + return Redirect::route('home'); |
|
153 | + } else { |
|
154 | + return Redirect::route('user.home'); |
|
155 | + } |
|
152 | 156 | } |
153 | 157 | |
154 | 158 | // Find the user using the password reset code |
@@ -167,8 +171,7 @@ discard block |
||
167 | 171 | // Activation was successful |
168 | 172 | // Redirect to the login page |
169 | 173 | return Redirect::route('login')->with('success', Lang::get('base.auth.activate.success')); |
170 | - } |
|
171 | - else |
|
174 | + } else |
|
172 | 175 | { |
173 | 176 | // Activation not found or not completed. |
174 | 177 | $error = Lang::get('base.auth.activate.error'); |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | 'password' => 'required|between:3,32', |
193 | 196 | ); |
194 | 197 | |
195 | - if (!$isEmail) |
|
196 | - $rules['email'] = 'required'; |
|
198 | + if (!$isEmail) { |
|
199 | + $rules['email'] = 'required'; |
|
200 | + } |
|
197 | 201 | |
198 | 202 | // Create a new validator instance from our validation rules |
199 | 203 | $validator = Validator::make(Input::all(), $rules); |
@@ -258,14 +262,16 @@ discard block |
||
258 | 262 | $userActivation = $signupStatus == 2; |
259 | 263 | $adminActivation = $signupStatus == 3; |
260 | 264 | |
261 | - if (!$signupEnabled) |
|
262 | - return Redirect::to(URL::previous())->withInput()->with('error', Lang::get('base.auth.account.registration_disabled')); |
|
265 | + if (!$signupEnabled) { |
|
266 | + return Redirect::to(URL::previous())->withInput()->with('error', Lang::get('base.auth.account.registration_disabled')); |
|
267 | + } |
|
263 | 268 | |
264 | 269 | $rules = array(); |
265 | 270 | |
266 | 271 | // Declare the rules for the form validation |
267 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
268 | - $rules[$fieldid] = $field['validator']; |
|
272 | + foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) { |
|
273 | + $rules[$fieldid] = $field['validator']; |
|
274 | + } |
|
269 | 275 | |
270 | 276 | $rules['g-recaptcha-response'] = 'required'; |
271 | 277 | |
@@ -276,8 +282,9 @@ discard block |
||
276 | 282 | |
277 | 283 | // If validation fails, we'll exit the operation now. |
278 | 284 | if ($validator->fails() || ($err = $this->captchaCheck()) == false) { |
279 | - if ($err) |
|
280 | - return Redirect::to(URL::previous())->withInput()->withErrors(['g-recaptcha-response' => Lang::get('base.captcha.error')]); |
|
285 | + if ($err) { |
|
286 | + return Redirect::to(URL::previous())->withInput()->withErrors(['g-recaptcha-response' => Lang::get('base.captcha.error')]); |
|
287 | + } |
|
281 | 288 | |
282 | 289 | // Ooops.. something went wrong |
283 | 290 | return Redirect::to(URL::previous())->withInput()->withErrors($validator); |
@@ -287,15 +294,17 @@ discard block |
||
287 | 294 | $data = array(); |
288 | 295 | |
289 | 296 | // Set the data to the user from the User class |
290 | - foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) |
|
291 | - $data[$fieldid] = Input::get($fieldid); |
|
297 | + foreach(Sentinel::createModel()->getRegisterFields() as $fieldid => $field) { |
|
298 | + $data[$fieldid] = Input::get($fieldid); |
|
299 | + } |
|
292 | 300 | |
293 | 301 | // Set the standard data to the user |
294 | 302 | $data['ip'] = Request::getClientIP(); |
295 | 303 | $data['status'] = 0; |
296 | 304 | $data['staff'] = 0; |
297 | - if ($data['birthday'] != null) |
|
298 | - $data['birthday'] = \Carbon\Carbon::createFromFormat('d/m/Y', $data['birthday']); |
|
305 | + if ($data['birthday'] != null) { |
|
306 | + $data['birthday'] = \Carbon\Carbon::createFromFormat('d/m/Y', $data['birthday']); |
|
307 | + } |
|
299 | 308 | |
300 | 309 | // Find the user if it exists and needs to be created |
301 | 310 | $user = Sentinel::getUserRepository()->findByCredentials(['email' => Input::get('email')]); |
@@ -307,19 +316,21 @@ discard block |
||
307 | 316 | $testing = Sentinel::createModel()->getRegisterFields(); |
308 | 317 | $user = Sentinel::findById($user->id); |
309 | 318 | |
310 | - foreach($data as $fieldid => $field) |
|
311 | - if (!isset($testing[$fieldid]) || $testing[$fieldid]['save'] == true) |
|
312 | - $user[$fieldid] = $field; |
|
319 | + foreach($data as $fieldid => $field) { |
|
320 | + if (!isset($testing[$fieldid]) || $testing[$fieldid]['save'] == true) |
|
321 | + $user[$fieldid] = $field; |
|
322 | + } |
|
313 | 323 | |
314 | 324 | $user['password'] = bcrypt($user['password']); |
315 | 325 | Sentinel::update($user, ['email' => Input::get('email')]); |
316 | - } |
|
317 | - else |
|
318 | - return Redirect::to(URL::previous())->withInput()->with('error', Lang::get('base.auth.account.registration_failed')); |
|
326 | + } else { |
|
327 | + return Redirect::to(URL::previous())->withInput()->with('error', Lang::get('base.auth.account.registration_failed')); |
|
328 | + } |
|
319 | 329 | } |
320 | 330 | // Register the user |
321 | - else |
|
322 | - $user = Sentinel::register($data, false); |
|
331 | + else { |
|
332 | + $user = Sentinel::register($data, false); |
|
333 | + } |
|
323 | 334 | |
324 | 335 | // If the user needs to activate the account send him an email |
325 | 336 | if ($userActivation) |
@@ -17,8 +17,9 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, Closure $next) |
19 | 19 | { |
20 | - if (config('jlourenco.base.VisitCounter')) |
|
21 | - Base::RegisterVisit(); |
|
20 | + if (config('jlourenco.base.VisitCounter')) { |
|
21 | + Base::RegisterVisit(); |
|
22 | + } |
|
22 | 23 | |
23 | 24 | return $next($request); |
24 | 25 | } |
@@ -20,10 +20,11 @@ |
||
20 | 20 | { |
21 | 21 | if ($user->force_new_password) |
22 | 22 | { |
23 | - if ($request->ajax()) |
|
24 | - return response('New password is required. Login into the website.', 401); |
|
25 | - else |
|
26 | - return Redirect::route('change-password'); |
|
23 | + if ($request->ajax()) { |
|
24 | + return response('New password is required. Login into the website.', 401); |
|
25 | + } else { |
|
26 | + return Redirect::route('change-password'); |
|
27 | + } |
|
27 | 28 | } |
28 | 29 | } |
29 | 30 | return $next($request); |
@@ -179,7 +179,7 @@ |
||
179 | 179 | 'BlogPost.contents' => 1, |
180 | 180 | ], |
181 | 181 | 'joins' => [ |
182 | - 'BlogPost' => [ 'User.id', 'BlogPost.author' ], |
|
182 | + 'BlogPost' => ['User.id', 'BlogPost.author'], |
|
183 | 183 | ], |
184 | 184 | ]; |
185 | 185 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | if ($value > 0) |
39 | 39 | if ($user = Sentinel::findUserById($value)) |
40 | 40 | if ($user != null) |
41 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
41 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
42 | 42 | |
43 | 43 | return $value; |
44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($value > 0) |
55 | 55 | if ($user = Sentinel::findUserById($value)) |
56 | 56 | if ($user != null) |
57 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
57 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
58 | 58 | |
59 | 59 | return $value; |
60 | 60 | } |
@@ -35,10 +35,11 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function getCreatedByAttribute($value) |
37 | 37 | { |
38 | - if ($value > 0) |
|
39 | - if ($user = Sentinel::findUserById($value)) |
|
38 | + if ($value > 0) { |
|
39 | + if ($user = Sentinel::findUserById($value)) |
|
40 | 40 | if ($user != null) |
41 | 41 | return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
42 | + } |
|
42 | 43 | |
43 | 44 | return $value; |
44 | 45 | } |
@@ -51,10 +52,11 @@ discard block |
||
51 | 52 | */ |
52 | 53 | public function getTargetAttribute($value) |
53 | 54 | { |
54 | - if ($value > 0) |
|
55 | - if ($user = Sentinel::findUserById($value)) |
|
55 | + if ($value > 0) { |
|
56 | + if ($user = Sentinel::findUserById($value)) |
|
56 | 57 | if ($user != null) |
57 | 58 | return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
59 | + } |
|
58 | 60 | |
59 | 61 | return $value; |
60 | 62 | } |
@@ -28,13 +28,13 @@ |
||
28 | 28 | $str = explode("* ", $this->description); |
29 | 29 | $choices = array(); |
30 | 30 | |
31 | - foreach($str as $st) |
|
31 | + foreach ($str as $st) |
|
32 | 32 | { |
33 | 33 | preg_match('/(?P<digit>\d+) - (?P<name>\w+)/', $st, $matches); |
34 | 34 | if (sizeof($matches) > 0) { |
35 | - $st = str_replace("*/","",$st); |
|
36 | - $st = str_replace("/*","",$st); |
|
37 | - $choices[$matches[1]] = explode($matches[1] . ' - ', $st)[1]; |
|
35 | + $st = str_replace("*/", "", $st); |
|
36 | + $st = str_replace("/*", "", $st); |
|
37 | + $choices[$matches[1]] = explode($matches[1].' - ', $st)[1]; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 |