PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 1.4.7
Fluent Support – Helpdesk & Customer Support Ticket System v1.4.7
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Models / Attachment.php

Attachment.php in Fluent Support – Helpdesk & Customer Support Ticket System 1.4.7, at app/Models/Attachment.php

51 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Models;
4
5 class Attachment extends Model
6 {
7 protected $table = 'fs_attachments';
8
9 protected $hidden = ['full_url', 'file_path'];
10
11 protected $appends = ['secureUrl'];
12
13 /**
14 * The attributes that are mass assignable.
15 *
16 * @var array
17 */
18 protected $fillable = [
19 'ticket_id',
20 'person_id',
21 'conversation_id',
22 'file_type',
23 'file_path',
24 'full_url',
25 'title',
26 'driver',
27 'file_size',
28 'status'
29 ];
30
31 public static function boot()
32 {
33 static::creating(function ($model) {
34 $uid = wp_generate_uuid4();
35 $model->file_hash = md5($uid.mt_rand(0,1000));
36 });
37 }
38
39 /**
40 * Accessor to get dynamic full_name attribute
41 * @return string
42 */
43 public function getSecureUrlAttribute()
44 {
45 return add_query_arg([
46 'fst_file' => $this->file_hash,
47 'secure_sign' => md5($this->id.date('YmdH'))
48 ], site_url('/index.php'));
49 }
50 }
51