develop
Last change
on this file since 7fa13fa was 4b7e2d3, checked in by beratkjufliju <kufliju@…>, 3 years ago |
bug fixes, edited export, added fileSeeder for DB testing
|
-
Property mode
set to
100644
|
File size:
654 bytes
|
Rev | Line | |
---|
[194a359] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Models;
|
---|
| 4 |
|
---|
[24a616f] | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory;
|
---|
[194a359] | 6 | use Illuminate\Database\Eloquent\Model;
|
---|
| 7 | use Illuminate\Notifications\Notifiable;
|
---|
| 8 |
|
---|
| 9 | class Department extends Model
|
---|
| 10 | {
|
---|
| 11 | use Notifiable;
|
---|
[24a616f] | 12 | use HasFactory;
|
---|
[194a359] | 13 |
|
---|
| 14 | protected $table = "departments";
|
---|
| 15 |
|
---|
[4b7e2d3] | 16 | protected $fillable = ["name", "code", "location", "user_id", "no_of_folders"];
|
---|
[194a359] | 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 | }
|
---|
[24a616f] | 26 |
|
---|
[c6b84df] | 27 | public function folder(){
|
---|
| 28 | return $this->hasMany(Folder::class);
|
---|
[24a616f] | 29 | }
|
---|
[194a359] | 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.