source: app/Models/Document.php@ 24a616f

develop
Last change on this file since 24a616f was 24a616f, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

added documents crud, added last_seen_to_user, edited views

  • Property mode set to 100644
File size: 648 bytes
RevLine 
[24a616f]1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7
8class Document extends Model
9{
10 protected $table = "documents";
11
12 protected $fillable = ["arch_id", "name", "description", "user_id", "department_id"];
13
14 public function user() {
15 return $this->belongsTo(User::class);
16 }
17
18 public function department() {
19 return $this->belongsTo(Department::class);
20 }
21
22 public function ago() {
23 return Carbon::parse($this->created_at)->diffForHumans();
24 }
25
26 public function files()
27 {
28 return $this->hasMany(File::class);
29 }
30}
Note: See TracBrowser for help on using the repository browser.