develop
Last change
on this file since e6c1f87 was e6c1f87, checked in by beratkjufliju <kufliju@…>, 3 years ago |
added pagination, is_important
|
-
Property mode
set to
100644
|
File size:
685 bytes
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Models;
|
---|
4 |
|
---|
5 | use Illuminate\Database\Eloquent\Factories\HasFactory;
|
---|
6 | use Illuminate\Database\Eloquent\Model;
|
---|
7 |
|
---|
8 | class Document extends Model
|
---|
9 | {
|
---|
10 | use HasFactory;
|
---|
11 | protected $table = "documents";
|
---|
12 |
|
---|
13 | protected $fillable = ["arch_id", "name", "description", "user_id", "department_id", "is_important"];
|
---|
14 |
|
---|
15 |
|
---|
16 | public function user() {
|
---|
17 | return $this->belongsTo(User::class);
|
---|
18 | }
|
---|
19 |
|
---|
20 | public function department() {
|
---|
21 | return $this->belongsTo(Department::class);
|
---|
22 | }
|
---|
23 |
|
---|
24 | public function ago() {
|
---|
25 | return Carbon::parse($this->created_at)->diffForHumans();
|
---|
26 | }
|
---|
27 |
|
---|
28 | public function files()
|
---|
29 | {
|
---|
30 | return $this->hasMany(File::class);
|
---|
31 | }
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.