In my Deegre model I have a method fullName () that returns string
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Deegre extends Model
{
public function fullName(){
$level = [
"1" => "Primer ",
"2" => "Segundo ",
"3" => "Tercer ",
"4" => "Cuarto ",
"5" => "Quinto ",
"6" => "Sexto ",
];
return $this->code . $level[$this->type] . " Grado de Secundaria";
}
I want to call fullName () in my eloquent query
<?php
namespace App\Repositories;
use App\Deegre;
class DeegreRepository
{
public function index(){
return Deegre::where("year", now()->year)->get();
// aqui quiero que mi metodo fullName sea llamado :(
}
}
What I want is to call the method fullName that I have created in my query, so for each record that brings also bring me the value of my method, Thank you very much