Commit 1962909d authored by unknown's avatar unknown
Browse files

criação e alteração dos models para a relação com a ODS

parent 0fb4cdf0
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ObjetivoDeDesenvolvimentoSustentavel extends Model
{
protected $fillable = [
'nome',
];
public function trabalhos(){
return $this->belongsToMany('App\Trabalho', 'objetivo_de_desenvolvimento_sustentavel_trabalhos', 'objetivo_de_desenvolvimento_sustentavel_id');
}
}
...@@ -125,4 +125,8 @@ class Trabalho extends Model ...@@ -125,4 +125,8 @@ class Trabalho extends Model
{ {
return $this->hasMany(Certificado::class, 'trabalho_id'); return $this->hasMany(Certificado::class, 'trabalho_id');
} }
public function ods(){
return $this->belongsToMany('App\ObjetivoDeDesenvolvimentoSustentavel', 'objetivo_de_desenvolvimento_sustentavel_trabalhos', 'trabalho_id');
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment