This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this function to your post model; | |
// reading time | |
//The average reader reads about 200 words per minute, so I decided to have less to make estimates more accurate | |
public function postReadingTimeEstimation($averageReadsPerMunite = 180) | |
{ | |
$textOfTheBody = $this->body; | |
$totalWords = str_word_count(strip_tags($textOfTheBody)); | |
$minutes = floor($totalWords / $averageReadsPerMunite); |
OlderNewer