validate all object value with the same validation function php laravel -
above result of dd() 1 of object , right did is
//$car object variable $car->corporate_id = some_function($car->corporate_id); $car->corporate_name = some_function($car->corporate_name); $car->member_id = some_function($car->member_id);
instead doing above ways , how can achieve
$data = some_function($car); //it go through $car properties , run same validation
can tell me how achieve this?
the function body this
if(!is_object($car)) return 'function expect car object'; if(isset($car->corporate_id)) $car->corporate_id = some_other_function($car->corporate_id); if(isset($car->corporate_name)) $car->corporate_id = some_other_function($car->corporate_name); ........... return $car;
Comments
Post a Comment