This commit is contained in:
2024-10-01 19:07:23 +05:00
parent 9fecfccf22
commit 4dde4b357a
26 changed files with 26396 additions and 262 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Nurmuhammet\NovaCustomHtml;
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('nova-custom-html', __DIR__.'/../dist/js/field.js');
Nova::style('nova-custom-html', __DIR__.'/../dist/css/field.css');
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Nurmuhammet\NovaCustomHtml;
use Laravel\Nova\Fields\Field;
use Laravel\Nova\Fields\SupportsDependentFields;
class NovaCustomHtml extends Field
{
use SupportsDependentFields;
/**
* The field's component.
*
* @var string
*/
public $component = 'nova-custom-html';
/**
* Make field html
*
* @var string
*/
public function html(string $html): self
{
return $this->withMeta(['html' => $html]);
}
/**
* Full width
*/
public function fullWidth(): self
{
return $this->withMeta(['fullWidth' => true]);
}
/**
* Alert if there is message
*
* @var string
*/
public function alert(string $message): self
{
return $this->withMeta(['alert_message' => $message]);
}
/**
* Hide
* @param bool|boolean
*/
public function hidden(bool $hidden = true): self
{
return $this->withMeta(['hidden' => $hidden]);
}
}