source: app/Models/Department.php@ 6b95845

develop
Last change on this file since 6b95845 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: 641 bytes
Line 
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7use Illuminate\Notifications\Notifiable;
8
9class Department extends Model
10{
11 use Notifiable;
12 use HasFactory;
13
14 protected $table = "departments";
15
16 protected $fillable = ["name", "code", "location", "user_id"];
17
18 protected $casts = [
19 'created_at' => 'datetime:d-m-Y',
20 ];
21
22 public function getCreatedByName()
23 {
24 return User::where('id', $this->user_id)->pluck('username')->first();
25 }
26
27 public function document(){
28 return $this->hasMany(Document::class);
29 }
30}
Note: See TracBrowser for help on using the repository browser.