mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 20:56:54 +01:00 
			
		
		
		
	 da195fd2fe
			
		
	
	
		da195fd2fe
		
			
		
	
	
	
	
		
			
			* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Requests\Api\Remote;
 | |
| 
 | |
| use Illuminate\Support\Collection;
 | |
| use Illuminate\Foundation\Http\FormRequest;
 | |
| 
 | |
| class ActivityEventRequest extends FormRequest
 | |
| {
 | |
|     public function authorize(): bool
 | |
|     {
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @return array<array-key, string|string[]>
 | |
|      */
 | |
|     public function rules(): array
 | |
|     {
 | |
|         return [
 | |
|             'data' => ['required', 'array'],
 | |
|             'data.*' => ['array'],
 | |
|             'data.*.user' => ['sometimes', 'nullable', 'uuid'],
 | |
|             'data.*.server' => ['required', 'uuid'],
 | |
|             'data.*.event' => ['required', 'string'],
 | |
|             'data.*.metadata' => ['present', 'nullable', 'array'],
 | |
|             'data.*.ip' => ['sometimes', 'nullable', 'ip'],
 | |
|             'data.*.timestamp' => ['required', 'string'],
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Returns all the unique server UUIDs that were received in this request.
 | |
|      *
 | |
|      * @return string[]
 | |
|      */
 | |
|     public function servers(): array
 | |
|     {
 | |
|         return Collection::make($this->input('data'))->pluck('server')->unique()->toArray();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Returns all the unique user UUIDs that were submitted in this request.
 | |
|      *
 | |
|      * @return string[]
 | |
|      */
 | |
|     public function users(): array
 | |
|     {
 | |
|         return Collection::make($this->input('data'))
 | |
|             ->filter(function ($value) {
 | |
|                 return !empty($value['user']);
 | |
|             })
 | |
|             ->pluck('user')
 | |
|             ->unique()
 | |
|             ->toArray();
 | |
|     }
 | |
| }
 |