Changeset 0a1fb54 for app/Models
- Timestamp:
- 11/23/21 22:01:52 (3 years ago)
- Branches:
- master
- Children:
- dbc5976
- Parents:
- 4d73966
- Location:
- app/Models
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Models/Department.php
r4d73966 r0a1fb54 9 9 class Department extends Model 10 10 { 11 use Notifiable;12 11 use HasFactory; 13 12 … … 20 19 ]; 21 20 22 public function getCreatedByName()23 {24 return User::where('id', $this->user_id)->pluck('username')->first();25 }26 27 21 public function folder(){ 28 22 return $this->hasMany(Folder::class); 29 23 } 30 24 31 // public function getDeptId(){ 32 // return Department::where('id', $this->id)->get(); 33 // } 25 public function user(){ 26 return $this->belongsTo(User::class); 27 } 28 34 29 } -
app/Models/File.php
r4d73966 r0a1fb54 12 12 13 13 protected $table = "files"; 14 protected $fillable = ["name", "location", " document_id"];14 protected $fillable = ["name", "location", "folder_id"]; 15 15 16 16 public function folder() … … 21 21 public function getSize($location) 22 22 { 23 $fileSize = Storage::disk(' uploads')->size($location) / 1024 / 1024;23 $fileSize = Storage::disk('local')->size($location) / 1024 / 1024; 24 24 $fileSize = round($fileSize, 2); 25 25 return $fileSize; -
app/Models/User.php
r4d73966 r0a1fb54 134 134 } 135 135 136 public function getCreatedByUsername() 137 { 138 return User::where('id', $this->created_by)->pluck('username')->first(); 139 } 140 136 141 public function getCreatedByName() 137 142 { 138 return User::where('id', $this->created_by)->pluck('username')->first(); 143 $name = User::where('id', $this->created_by)->pluck('name')->first(); 144 $surname = User::where('id', $this->created_by)->pluck('surname')->first(); 145 146 return $name . " " . $surname; 139 147 } 140 148 … … 142 150 return $this->hasMany(Folder::class); 143 151 } 152 153 public function department() { 154 return $this->hasMany(Department::class); 155 } 144 156 }
Note:
See TracChangeset
for help on using the changeset viewer.