CRMCallArchive.php 1.28 KB
<?php namespace App\Models;
use Illuminate\Database\Eloquent\Model;

use Auth;

class CRMCallArchive extends Model{

	protected $table = 'crmcalls_archive';

	//protected $fillable = array('status','data','log','group');
	
	 public function getRecFilePath()
        {
                $file="";
                $data=json_decode($this->data,true);
                if(isset($data['recFolder']))
                {
                        $file=storage_path("app/".$data['recFolder'])."/".$this->id.".".$data['recExt'];
                }
                return $file;
        }
        public function getRecFileExt()
        {
                $ext="";
                $data=json_decode($this->data,true);
                if(isset($data['recExt']))
                {
                        $ext=$data['recExt'];
                }
                return $ext;
        }

        public function saveRecFileSize()
        {
                $fsize=0;
                $data=json_decode($this->data,true);
                if(isset($data['recFolder']))
                {
                        $fpath=storage_path("app/".$data['recFolder'])."/".$this->id.".".$data['recExt'];
                        if(file_exists($fpath))$fsize=filesize($fpath);
                }
                $this->recsize=$fsize;
        }

	
}