Normalised photo table
This commit is contained in:
10
app/Models/Make.php
Normal file
10
app/Models/Make.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Make extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
}
|
15
app/Models/Model.php
Normal file
15
app/Models/Model.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as EloquentModel;
|
||||
|
||||
class Model extends EloquentModel
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function make()
|
||||
{
|
||||
return $this->belongsTo(Make::class);
|
||||
}
|
||||
}
|
@@ -19,6 +19,11 @@ class Photo extends Abstracted\Catalog
|
||||
8=>-90,
|
||||
];
|
||||
|
||||
public function software()
|
||||
{
|
||||
return $this->belongsTo(Software::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Date the photo was taken
|
||||
*/
|
||||
@@ -38,7 +43,7 @@ class Photo extends Abstracted\Catalog
|
||||
if ($new)
|
||||
$file = sprintf('%s.%s',((is_null($this->date_created) OR ! $this->date_created)
|
||||
? sprintf('UNKNOWN/%07s',$this->file_path_id())
|
||||
: sprintf('%s_%03s',date('Y/m/d-His',$this->date_created),$this->subsectime).
|
||||
: sprintf('%s_%03s',$this->date_created->format('Y/m/d-His'),$this->subsectime).
|
||||
($this->subsectime ? '' : sprintf('-%05s',$this->id))),$this->type());
|
||||
|
||||
return (($short OR preg_match('/^\//',$file)) ? '' : config('photo.dir').DIRECTORY_SEPARATOR).$file;
|
||||
|
15
app/Models/Software.php
Normal file
15
app/Models/Software.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Software extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function model()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Model::class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user