Search
 
SCRIPT & CODE EXAMPLE
 

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.'%';
Comment

PREVIOUS NEXT
Code Example
Php :: codeigniter update query return value 
Php :: laravel insert array 
Php :: php code for video upload 
Php :: wordpress get user data from email 
Php :: call to a member function setcookie() on null laravel middleware 
Php :: Laravel create foreign key column in migration 
Php :: woocommerce phone number not required 
Php :: file could not be downloaded: Unable to find the wrap per "https" - did you forget to enable it when you configured PHP? failed to open stream: No such file or directory 
Php :: php receive post 
Php :: laravel migration alter column unique 
Php :: Laravel eloquent restore soft delete 
Php :: laravel download file from s3 
Php :: foreach ph 
Php :: laravel 8 query builder 
Php :: php online editor 
Php :: json encode 
Php :: array reverse php 
Php :: get previous url symfony 4 in formpage 
Php :: share wordpress post on whatsapp without plugin 
Php :: Clear and delete the folder after the time specified in php 
Php :: laravel model fillable vs guarded 
Php :: laravel query order by relation 
Php :: laravel faker example 
Php :: php ip log 
Php :: adding data dynamically to empty array in php 
Php :: TRANSACTON LARAVEL QUERY BUILDER 
Php :: wordpress display menu by name 
Php :: show images laravel 8 showJobImage($filename) 
Php :: How to calculate the sum of values in a list PHP 
Php :: reset id auto increment after deleting a table row in phpmyadmin 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =