Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to calculate percentage profile completion in laravel

 $maximumPoints  = 100;
 $profile = !empty($user->profile) ? 16.7 : 0;
 $username = !empty($user->username) ? 16.7 : 0;
 $zip_code = !empty($user->zip_code) ? 16.7 : 0;
 $gender = !empty($user->gender) ? 16.7 : 0;
 $aboutus = !empty($user->about_us) ? 16.7 : 0;
 $sportDetail = (count($userSportCategory) > 0) ? 16.7 : 0;
 $percentage = intval(($profile+$username+$zip_code+$gender+$sportDetail+$aboutus)*$maximumPoints/100);
 $user['percentage'] = $percentage.'%';
 
PREVIOUS NEXT
Tagged: #calculate #percentage #profile #completion #laravel
ADD COMMENT
Topic
Name
8+3 =