develop
Last change
on this file since bd9e8e3 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
|
Rev | Line | |
---|
[24a616f] | 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 | 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.