<?php
namespace App\Http\Controllers\Admin\Rating;
use App\Models\Rating;
use App\Models\Advisor;
use SebastianBergmann\Environment\Console;
use App\Models\Fail;
class RatingListController
{

    public function index($IdAdvisor)
    {


        $ratingList = Rating::where('IdAdvisor', $IdAdvisor)->orderBy("DateRating", "DESC")->get();
        if  (count($ratingList) <= 0){
            return json_encode( new Fail  (
                success:false,
                error:"There is no rating for this advisor"
            ));
        }
        return $ratingList;
    }

}
