@@ -272,7 +272,7 @@ protected function logError($item, $field)
272272 }
273273 }
274274
275- protected function addErrorToBag ($ item , $ field , $ error_message )
275+ protected function addErrorToBag ($ item , $ field , $ error_message )
276276 {
277277 if ($ this ->errorCallback ) {
278278 call_user_func ($ this ->errorCallback , $ item , $ field , [$ field => [$ error_message ]]);
@@ -299,8 +299,8 @@ protected function createOrFetchUser($row, $type = 'user')
299299 'first_name ' => $ this ->findCsvMatch ($ row , 'first_name ' ),
300300 'last_name ' => $ this ->findCsvMatch ($ row , 'last_name ' ),
301301 'email ' => $ this ->findCsvMatch ($ row , 'email ' ),
302- 'manager_id ' => '' ,
303- 'department_id ' => '' ,
302+ 'manager_id ' => '' ,
303+ 'department_id ' => '' ,
304304 'username ' => $ this ->findCsvMatch ($ row , 'username ' ),
305305 'activated ' => $ this ->fetchHumanBoolean ($ this ->findCsvMatch ($ row , 'activated ' )),
306306 'remote ' => $ this ->fetchHumanBoolean (($ this ->findCsvMatch ($ row , 'remote ' ))),
@@ -314,7 +314,7 @@ protected function createOrFetchUser($row, $type = 'user')
314314 // Maybe we're lucky and the username was passed and it already exists.
315315 if (!empty ($ user_array ['username ' ])) {
316316 if ($ user = User::where ('username ' , $ user_array ['username ' ])->first ()) {
317- $ this ->log ('User ' . $ user_array ['username ' ]. ' already exists ' );
317+ $ this ->log ('User ' . $ user_array ['username ' ] . ' already exists ' );
318318 return $ user ;
319319 }
320320 }
@@ -352,7 +352,7 @@ protected function createOrFetchUser($row, $type = 'user')
352352
353353 // Check for a matching username one more time after trying to guess username.
354354 if ($ user = User::where ('username ' , $ user_array ['username ' ])->first ()) {
355- $ this ->log ('User ' . $ user_array ['username ' ]. ' already exists ' );
355+ $ this ->log ('User ' . $ user_array ['username ' ] . ' already exists ' );
356356 return $ user ;
357357 }
358358 }
@@ -363,7 +363,7 @@ protected function createOrFetchUser($row, $type = 'user')
363363 }
364364
365365 // No luck finding a user on username or first name, let's create one.
366- $ user = new User ;
366+ $ user = new User () ;
367367
368368 $ user ->first_name = $ user_array ['first_name ' ];
369369 $ user ->last_name = $ user_array ['last_name ' ];
@@ -374,14 +374,14 @@ protected function createOrFetchUser($row, $type = 'user')
374374 $ user ->activated = 1 ;
375375 $ user ->password = $ this ->tempPassword ;
376376
377- Log::debug ('Creating a user with the following attributes: ' . print_r ($ user_array , true ));
377+ Log::debug ('Creating a user with the following attributes: ' . print_r ($ user_array , true ));
378378
379379 if ($ user ->save ()) {
380- $ this ->log ('User ' . $ user_array ['username ' ]. ' created ' );
380+ $ this ->log ('User ' . $ user_array ['username ' ] . ' created ' );
381381 return $ user ;
382382 }
383383
384- $ this ->logError ($ user , 'User " ' . $ user_array ['username ' ]. '" was not able to be created. ' );
384+ $ this ->logError ($ user , 'User " ' . $ user_array ['username ' ] . '" was not able to be created. ' );
385385
386386 return false ;
387387 }
@@ -395,7 +395,7 @@ protected function findUserByNumber($user_name)
395395 {
396396 // A number was given instead of a name
397397 if (is_numeric ($ user_name )) {
398- $ this ->log ('User ' . $ user_name. ' is a number - lets see if it matches a user id ' );
398+ $ this ->log ('User ' . $ user_name . ' is a number - lets see if it matches a user id ' );
399399
400400 return User::find ($ user_name );
401401 }
@@ -521,7 +521,7 @@ public function createOrFetchDepartment($user_department_name)
521521 $ department = Department::where ('name ' , '= ' , $ user_department_name )->first ();
522522
523523 if ($ department ) {
524- $ this ->log ('A matching Department ' . $ user_department_name. ' already exists ' );
524+ $ this ->log ('A matching Department ' . $ user_department_name . ' already exists ' );
525525
526526 return $ department ->id ;
527527 }
@@ -530,7 +530,7 @@ public function createOrFetchDepartment($user_department_name)
530530 $ department ->name = $ user_department_name ;
531531
532532 if ($ department ->save ()) {
533- $ this ->log ('Department ' . $ user_department_name. ' was created ' );
533+ $ this ->log ('Department ' . $ user_department_name . ' was created ' );
534534
535535 return $ department ->id ;
536536 }
@@ -554,11 +554,11 @@ public function fetchManager($user_manager_first_name, $user_manager_last_name)
554554 $ manager = User::where ('first_name ' , '= ' , $ user_manager_first_name )
555555 ->where ('last_name ' , '= ' , $ user_manager_last_name )->first ();
556556 if ($ manager ) {
557- $ this ->log ('A matching Manager ' . $ user_manager_first_name. ' ' . $ user_manager_last_name. ' already exists ' );
557+ $ this ->log ('A matching Manager ' . $ user_manager_first_name . ' ' . $ user_manager_last_name . ' already exists ' );
558558
559559 return $ manager ->id ;
560560 }
561- $ this ->log ('No matching Manager ' . $ user_manager_first_name. ' ' . $ user_manager_last_name. ' found. If their user account is being created through this import, you should re-process this file again. ' );
561+ $ this ->log ('No matching Manager ' . $ user_manager_first_name . ' ' . $ user_manager_last_name . ' found. If their user account is being created through this import, you should re-process this file again. ' );
562562
563563 return null ;
564564 }
@@ -573,16 +573,15 @@ public function fetchManager($user_manager_first_name, $user_manager_last_name)
573573 * @return string|null
574574
575575 */
576- public function parseOrNullDate ($ field , $ format = 'date ' ) {
577-
576+ public function parseOrNullDate ($ field , $ format = 'date ' )
577+ {
578578 $ date_format = 'Y-m-d ' ;
579579
580580 if ($ format == 'datetime ' ) {
581581 $ date_format = 'Y-m-d H:i:s ' ;
582582 }
583583
584584 if (array_key_exists ($ field , $ this ->item ) && $ this ->item [$ field ] != '' ) {
585-
586585 try {
587586 $ value = CarbonImmutable::parse ($ this ->item [$ field ])->format ($ date_format );
588587 return $ value ;
0 commit comments