@@ -271,7 +271,7 @@ public function store(Request $request)
271271
272272 // Update the Custom Fields.
273273 foreach ($ items as $ item ) {
274- $ value = Arr::get ($ input , $ name = $ item ->name );
274+ $ value = Arr::get ($ input , $ name = $ item ->getAttribute ( ' name ' ) );
275275
276276 $ field = Field::create (array (
277277 'name ' => $ name ,
@@ -393,9 +393,11 @@ public function update(Request $request, $id)
393393
394394 // Update the Custom Fields.
395395 foreach ($ items as $ item ) {
396- $ value = Arr::get ($ input , $ name = $ item ->name );
396+ $ value = Arr::get ($ input , $ name = $ item ->getAttribute ( ' name ' ) );
397397
398- if (! is_null ($ field = $ user ->fields ->findBy ('name ' , $ name ))) {
398+ $ field = $ user ->fields ->findBy ('name ' , $ name );
399+
400+ if (! is_null ($ field )) {
399401 $ field ->value = $ value ;
400402
401403 $ field ->save ();
@@ -451,56 +453,4 @@ public function destroy($id)
451453 return Redirect::to ('admin/users ' )
452454 ->with ('success ' , __d ('users ' , 'The User <b>{0}</b> was successfully deleted. ' , $ user ->username ));
453455 }
454-
455- public function search ()
456- {
457- // Authorize the current User.
458- if (Gate::denies ('lists ' , User::class)) {
459- throw new AuthorizationException ();
460- }
461-
462- // Validation rules
463- $ rules = array (
464- 'query ' => 'required|min:4|valid_query '
465- );
466-
467- $ messages = array (
468- 'valid_query ' => __d ('users ' , 'The :attribute field is not a valid query string. ' ),
469- );
470-
471- $ attributes = array (
472- 'query ' => __ ('Search Query ' ),
473- );
474-
475- // Add the custom Validation Rule commands.
476- Validator::extend ('valid_query ' , function ($ attribute , $ value , $ parameters )
477- {
478- return (preg_match ('/^[\p{L}\p{N}_\-\s]+$/ ' , $ value ) === 1 );
479- });
480-
481- // Validate the Input data.
482- $ input = Input::only ('query ' );
483-
484- $ validator = Validator::make ($ input , $ rules , $ messages , $ attributes );
485-
486- if ($ validator ->fails ()) {
487- return Redirect::back ()->withErrors ($ validator ->errors ());
488- }
489-
490- // Search the Records on Database.
491- $ search = $ input ['query ' ];
492-
493- $ users = User::where ('username ' , 'LIKE ' , '% ' .$ search .'% ' )
494- ->orWhere ('email ' , 'LIKE ' , '% ' .$ search .'% ' )
495- ->orWhere ('realname ' , 'LIKE ' , '% ' .$ search .'% ' )
496- ->paginate (15 );
497-
498- // Prepare the Query for displaying.
499- $ search = htmlentities ($ search );
500-
501- return $ this ->createView ()
502- ->shares ('title ' , __d ('users ' , 'Searching Users for: {0} ' , $ search ))
503- ->with ('search ' , $ search )
504- ->with ('users ' , $ users );
505- }
506456}
0 commit comments