Bulletinboard/app/Models/Post.php

35 lines
709 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasFactory;
protected $fillable = [
"title",
"text",
"post_time",
"time"
];
public function timePeriod(){
return $this->belongsTo(TimePeriod::class);
}
public function occupation(){
return $this->belongsTo(Occupation::class);
}
public function status(){
return $this->belongsTo(Status::class);
}
public function user(){
return $this->belongsTo(User::class);
}
public function files(){
return $this->hasMany(File::class);
}
}