mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 10:16:51 +01:00 
			
		
		
		
	* 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>
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Transformers\Api\Client;
 | 
						|
 | 
						|
use App\Models\EggVariable;
 | 
						|
 | 
						|
class EggVariableTransformer extends BaseClientTransformer
 | 
						|
{
 | 
						|
    public function getResourceName(): string
 | 
						|
    {
 | 
						|
        return EggVariable::RESOURCE_NAME;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @param  EggVariable  $variable
 | 
						|
     */
 | 
						|
    public function transform($variable): array
 | 
						|
    {
 | 
						|
        // This guards against someone incorrectly retrieving variables (haha, me) and then passing
 | 
						|
        // them into the transformer and along to the user. Just throw an exception and break the entire
 | 
						|
        // pathway since you should never be exposing these types of variables to a client.
 | 
						|
        if (!$variable->user_viewable) {
 | 
						|
            throw new \BadMethodCallException('Cannot transform a hidden egg variable in a client transformer.');
 | 
						|
        }
 | 
						|
 | 
						|
        return [
 | 
						|
            'name' => $variable->name,
 | 
						|
            'description' => $variable->description,
 | 
						|
            'env_variable' => $variable->env_variable,
 | 
						|
            'default_value' => $variable->default_value,
 | 
						|
            'server_value' => $variable->server_value,
 | 
						|
            'is_editable' => $variable->user_editable,
 | 
						|
            'rules' => implode('|', $variable->rules),
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |