Updates for Videos

This commit is contained in:
Deon George
2019-12-15 23:34:42 +11:00
parent 075d31e9f4
commit 49933382f3
14 changed files with 376 additions and 254 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models\Abstracted;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;
use DB;
@@ -108,7 +109,7 @@ abstract class Catalog extends Model
*/
public function date_taken(): string
{
return $this->date_created ? date('Y-m-d H:i:s',$this->date_created) : 'UNKNOWN';
return $this->date_created ? $this->date_created->format('Y-m-d H:i:s') : 'UNKNOWN';
}
public function device(): string
@@ -163,7 +164,7 @@ abstract class Catalog extends Model
if ($new)
$file = sprintf('%s.%s',((is_null($this->date_created) OR ! $this->date_created)
? sprintf('UNKNOWN/%07s',$this->file_path_id())
: date('Y/m/d-His',$this->date_created)),$this->type());
: $this->date_created->format('Y/m/d-His')),$this->type());
return (($short OR preg_match('/^\//',$file)) ? '' : config('video.dir').DIRECTORY_SEPARATOR).$file;
}
@@ -227,6 +228,10 @@ abstract class Catalog extends Model
return $this->HTMLCheckbox('flag',$this->id,$this->flag);
}
public function getDateCreatedAttribute() {
return Carbon::createFromTimestamp($this->attributes['date_created']);
}
/**
* @deprecated
*/
@@ -337,6 +342,8 @@ abstract class Catalog extends Model
->first();
}
abstract public function property(string $property);
/**
* Return my class shortname
*/
@@ -368,13 +375,12 @@ abstract class Catalog extends Model
*/
public function signature($short=FALSE)
{
return $short ? static::signaturetrim($this->signature) : $this->signature;
return ($short AND $this->signature) ? static::stringtrim($this->signature) : $this->signature;
}
/**
* Trim a string
*
* @todo rename stringtrim
* @param string $string
* @param int $chrs
* @return string