Added handling of created_manual, revert some file_path()
This commit is contained in:
@@ -97,7 +97,21 @@ abstract class Catalog extends Model
|
||||
->orWhere(function($q) {
|
||||
// Or they have the same time taken with the same camera
|
||||
if ($this->attributes['created'] AND $this->software_id) {
|
||||
$q->where('created','=',$this->attributes['created'] ?: NULL);
|
||||
$q->where(function ($q) {
|
||||
$q->where('created','=',$this->attributes['created'])
|
||||
->orWhere('created_manual','=',$this->attributes['created']);
|
||||
});
|
||||
|
||||
if (static::$includeSubSecTime)
|
||||
$q->where('subsectime','=',Arr::get($this->attributes,'subsectime'));
|
||||
|
||||
$q->where('software_id','=',$this->attributes['software_id']);
|
||||
|
||||
} elseif ($this->attributes['created_manual'] AND $this->software_id) {
|
||||
$q->where(function ($q) {
|
||||
$q->where('created','=',$this->attributes['created_manual'])
|
||||
->orWhere('created_manual','=',$this->attributes['created_manual']);
|
||||
});
|
||||
|
||||
if (static::$includeSubSecTime)
|
||||
$q->where('subsectime','=',Arr::get($this->attributes,'subsectime'));
|
||||
@@ -272,6 +286,11 @@ abstract class Catalog extends Model
|
||||
return (! is_readable($this->file_path())) ? NULL : filesize($this->file_path());
|
||||
}
|
||||
|
||||
public function getCreatedAttribute(): Carbon
|
||||
{
|
||||
return $this->created_manual ?: $this->asDateTime($this->attributes['created']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return item dimensions
|
||||
*/
|
||||
@@ -314,10 +333,6 @@ abstract class Catalog extends Model
|
||||
return $this->HTMLCheckbox('ignore_duplicate',$this->id,$this->ignore_duplicate);
|
||||
}
|
||||
|
||||
public function getDateCreatedAttribute() {
|
||||
return $this->attributes['date_created'] ? Carbon::createFromTimestamp($this->attributes['date_created']) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
Reference in New Issue
Block a user