<?php

namespace App\Providers;

use App\Models\Advisor;
use App\Models\Fail;

class AdvisorProvider
{

    public function findAdvisor ( $IdAdvisor)
    {
        $result = Advisor::where('IdAdvisor', $IdAdvisor) ->get();
        if (count($result)>0){
            return  $result[0];
        }
        else return null;
    }
    public function findAdvisorFail ()
    {
        return json_encode( new Fail (
            success:false,
            error:"This Id does not exist"
        ));
    }
}
