This commit is contained in:
2026-02-03 15:31:29 +05:00
commit 326c677e8d
2800 changed files with 1489388 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
<?php
namespace Nurmuhammet\DynamicFields;
use Laravel\Nova\Exceptions\NovaException;
use Laravel\Nova\Fields\Field;
use Laravel\Nova\Fields\SupportsDependentFields;
class DynamicFields extends Field
{
use SupportsDependentFields;
/**
* The field's component.
*
* @var string
*/
public $component = 'dynamic-fields';
/**
* Specify that the element should be visible on the index view.
*
* @param (callable():bool)|bool $callback
* @return $this
*
* @throws \Laravel\Nova\Exceptions\NovaException
*/
public function showOnIndex($callback = true)
{
throw NovaException::helperNotSupported(__FUNCTION__, static::class);
}
/**
* Fields to be rendered
*
* @param array $hues
* @return $this
*/
public function fields(array|callable $fields)
{
$fieldsForFrontEnd = $fields;
if (is_callable($fields)) {
$fieldsForFrontEnd = call_user_func($fields);
}
return $this->withMeta(['fields' => $fieldsForFrontEnd]);
}
/**
* Fill with array name
*
* @return $this
*/
public function fillWithArrayName(string $requestArrayName = '')
{
return $this->withMeta(['fillWithArrayName' => $requestArrayName]);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Nurmuhammet\DynamicFields;
use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;
class FieldServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Nova::serving(function (ServingNova $event) {
Nova::script('dynamic-fields', __DIR__.'/../dist/js/field.js');
Nova::style('dynamic-fields', __DIR__.'/../dist/css/field.css');
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}