Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
115
app/Models/CustomerFewoFile.php
Normal file
115
app/Models/CustomerFewoFile.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CustomerFewoFile
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $travel_user_id
|
||||
* @property int $customer_fewo_mail_id
|
||||
* @property string $identifier
|
||||
* @property string $filename
|
||||
* @property string $dir
|
||||
* @property string $original_name
|
||||
* @property string $ext
|
||||
* @property string $mine
|
||||
* @property int $size
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property CustomerFewoMail $customer_fewo_mail
|
||||
* @property TravelUser $travel_user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereCustomerFewoMailId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereDir($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereExt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereFilename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereIdentifier($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereMine($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereOriginalName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereSize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereTravelUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoFile whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CustomerFewoFile extends Model
|
||||
{
|
||||
protected $connection = 'mysql_stern';
|
||||
|
||||
protected $table = 'customer_fewo_files';
|
||||
|
||||
protected $casts = [
|
||||
'travel_user_id' => 'int',
|
||||
'customer_fewo_mail_id' => 'int',
|
||||
'size' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'travel_user_id',
|
||||
'customer_fewo_mail_id',
|
||||
'identifier',
|
||||
'filename',
|
||||
'dir',
|
||||
'original_name',
|
||||
'ext',
|
||||
'mine',
|
||||
'size'
|
||||
];
|
||||
|
||||
public static $icon_ext = [
|
||||
'default' => 'fa fa-file',
|
||||
'pdf'=> 'fa fa-file-pdf',
|
||||
'jpg'=> 'fa fa-file-image',
|
||||
'png'=> 'fa fa-file-image',
|
||||
];
|
||||
|
||||
public function customer_fewo_mail()
|
||||
{
|
||||
return $this->belongsTo(CustomerFewoMail::class);
|
||||
}
|
||||
|
||||
public function travel_user()
|
||||
{
|
||||
return $this->belongsTo(TravelUser::class);
|
||||
}
|
||||
|
||||
public function getIconExt(){
|
||||
return isset(self::$icon_ext[$this->ext]) ? self::$icon_ext[$this->ext] : self::$icon_ext['default'];
|
||||
}
|
||||
|
||||
public function getURL($do=false){
|
||||
return route('storage_file', [$this->id, 'travel_user', $do]);
|
||||
}
|
||||
|
||||
public function getPath(){
|
||||
return \Storage::disk('travel_user')->path($this->dir.$this->filename);
|
||||
|
||||
}
|
||||
|
||||
public function formatBytes($precision = 2)
|
||||
{
|
||||
$size = $this->size;
|
||||
|
||||
if ($size > 0) {
|
||||
$size = (int) $size;
|
||||
$base = log($size) / log(1024);
|
||||
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');
|
||||
|
||||
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
|
||||
} else {
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue