Files
Antonio Lopes dos Santos afec302c3e
All checks were successful
build-api-image / build (push) Successful in 51s
init commit
2026-08-04 16:52:02 -03:00

60 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use App\Models\Model;
class Example extends Model
{
protected $table = '';
protected $casts = [
// ...
];
protected $fillable = [
// ...
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
protected $with = [
// ...
];
protected $appends = [
// ...
];
public function user()
{
return $this->belongsTo(User::class);
}
public function roles()
{
return $this->belongsToMany(Role::class, 'table')
->using(RolePivot::class)
->as('pivotName')
->withPivot(/*'field_1', 'field_2', ... */)
->withTimestamps();
}
public function post()
{
return $this->hasOne(Post::class);
}
public function comments()
{
return $this->hasMany(Comment::class);
}
}