php - Laravel validation -


i have problem laravel validation when validation fails call block of code should successful...

i trying check user id if admin_id field equal user wich logged.

here code:

         $auth = auth::user()->id;          $inputs = array(             'id'      => input::get('id')          );          $rules = array(             'id'      => "required|exists:users,id,admin_id,$auth"         );          $validate = validator::make($inputs,$rules);          if($validate -> fails()){             return $validate -> messages() -> all();         }else{              return 'succes';         } 

try doing this:

$rules = array(   'id' => "required|exists:users,id,admin_id," . $auth ); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -