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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -