mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 05:51:09 -05:00
feat: Complete implementation of Ride CRUD system with full functionality and testing
- 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.
This commit is contained in:
48
app/Http/Requests/ParkRequest.php
Normal file
48
app/Http/Requests/ParkRequest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ParkRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true; // Add authorization logic as needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
|
||||
// For updates, make name unique except for current record
|
||||
if ($this->route('park')) {
|
||||
$rules['name'][] = 'unique:parks,name,' . $this->route('park')->id;
|
||||
} else {
|
||||
$rules['name'][] = 'unique:parks,name';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'The park name is required.',
|
||||
'name.unique' => 'A park with this name already exists.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user