register for sessions. photos with different settings, settings configurable
This commit is contained in:
1 parent
5fd29ef5f3
commit
17c1c2a521
14 files changed
+515
-71
No files matched your search
+12
-1
@@ -3,8 +3,19 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PhotoJob extends Model
|
||||
{
|
||||
protected $fillable = ['image_path', 'status'];
|
||||
protected $fillable = ['image_path', 'status', 'photo_session_id', 'photo_setting_id'];
|
||||
|
||||
public function session(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PhotoSession::class, 'photo_session_id');
|
||||
}
|
||||
|
||||
public function setting(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PhotoSetting::class, 'photo_setting_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PhotoSession extends Model
|
||||
{
|
||||
protected $fillable = ['original_image_path', 'selected_job_id'];
|
||||
|
||||
public function jobs(): HasMany
|
||||
{
|
||||
return $this->hasMany(PhotoJob::class)->with('setting')->orderBy('photo_setting_id');
|
||||
}
|
||||
|
||||
public function selectedJob(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PhotoJob::class, 'selected_job_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class PhotoSetting extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'gmic_command', 'sort_order', 'is_active'];
|
||||
|
||||
protected $casts = ['is_active' => 'boolean'];
|
||||
|
||||
public function jobs(): HasMany
|
||||
{
|
||||
return $this->hasMany(PhotoJob::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true)->orderBy('sort_order');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user