I want to save style ratings that ranges from 1 - 4.9 on my mysql database please what datatype should i use? and i keep getting this error when i save it as a decimal(11,0)
ErrorException in helpers.php line 747: Method App\Wasamar\Rating::__toString() must return a string value
MY CODE
$allInputs = Input::all();
$catalogueStyleId = Input::get('catalogueStyleId');
$userId = Crypt::decrypt( Input::get('user') );
$rating = Input::get('rating');
$countUserStyleRating = count( Rating::where('catalogue_style_id',$catalogueStyleId)->where('user_id','=', $userId)->first() );
if ( $countUserStyleRating == 0 ) {
# add new rating data
$rating = new Rating;
$rating->user_id = $userId;
$rating->catalogue_style_id = $catalogueStyleId;
$rating->catalogue_style_rating = $rating;
$rating->save();
echo "Your rating has been noted thank you";
}