mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 05:31:10 -05:00
- Added Ride CRUD system documentation detailing implementation summary, generated components, and performance metrics. - Created Ride CRUD system prompt for future development with core requirements and implementation strategy. - Established relationships between rides and parks, ensuring Django parity and optimized performance. - Implemented waiting for user command execution documentation for Park CRUD generation. - Developed Livewire components for RideForm and RideList with basic structure. - Created feature tests for Park and Ride components, ensuring proper rendering and functionality. - Added comprehensive tests for ParkController, ReviewImage, and ReviewReport models, validating CRUD operations and relationships.
102 lines
2.1 KiB
PHP
102 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* ReviewImage Model
|
|
*
|
|
* Generated by ThrillWiki Model Generator
|
|
* Includes ThrillWiki optimization patterns and performance enhancements
|
|
*/
|
|
class ReviewImage extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasSoftDeletes;
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'review_images';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'description',
|
|
'is_active',
|
|
// Add more fillable attributes as needed
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
// Add more casts as needed
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for arrays.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $hidden = [
|
|
// Add hidden attributes if needed
|
|
];
|
|
|
|
// Query Scopes
|
|
|
|
/**
|
|
* Scope a query to only include active records.
|
|
*/
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('is_active', true);
|
|
}
|
|
|
|
/**
|
|
* Scope for optimized queries with common relationships.
|
|
*/
|
|
public function scopeOptimized($query)
|
|
{
|
|
return $query->with($this->getOptimizedRelations());
|
|
}
|
|
|
|
// ThrillWiki Methods
|
|
|
|
/**
|
|
* Get optimized relations for this model.
|
|
*/
|
|
public function getOptimizedRelations(): array
|
|
{
|
|
return [
|
|
// Define common relationships to eager load
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get cache key for this model instance.
|
|
*/
|
|
public function getCacheKey(string $suffix = ''): string
|
|
{
|
|
$key = strtolower(class_basename($this)) . '.' . $this->id;
|
|
return $suffix ? $key . '.' . $suffix : $key;
|
|
}
|
|
|
|
|
|
|
|
|
|
} |