lundi 2 septembre 2019

How to change the text color based on a value using php and html?

I have 2 values $minsRecoded and $totalMins and I would like if the minsRecorded is greater the the totalMins then display $totalMinsComplted in a danger badge.

Here is what I have in my controller

$sumMins = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60;
  $minsRecoded = Task::getTotalMinsCompleted()/60;


  $totalMin = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60;
  $this->totalMins = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60;

if ($minsRecoded < $totalMin) $this->totalMinsCompleted = '<span class="badge badge-danger">";

Here is my view

 /



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire