source: app/Models/File.php@ c6b84df

develop
Last change on this file since c6b84df was c6b84df, checked in by beratkjufliju <kufliju@…>, 3 years ago

added fileTypes controller, notifications, excel export, edited views

  • Property mode set to 100644
File size: 521 bytes
Line 
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Model;
6use Illuminate\Support\Facades\Storage;
7
8class File extends Model
9{
10 protected $table = "files";
11 protected $fillable = ["name", "location", "document_id"];
12
13 public function folder()
14 {
15 return $this->belongsTo(Folder::class);
16 }
17
18 public function getSize($location)
19 {
20 $fileSize = Storage::disk('uploads')->size($location) / 1024 / 1024;
21 $fileSize = round($fileSize, 2);
22 return $fileSize;
23 }
24}
Note: See TracBrowser for help on using the repository browser.