1. Go to this page and download the library: Download outhebox/nova-hidden-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
outhebox / nova-hidden-field example snippets
use Outhebox\NovaHiddenField\HiddenField;
HiddenField::make('User', 'user_id')
->current_user_id(),
use Outhebox\NovaHiddenField\HiddenField;
HiddenField::make('User', 'column_name')
->defaultValue($this->get_client_id()),
/**
* Function will return your value
* the returned value should be string
*
* @return string
*/
public function get_client_id()
{
$client = Client::find(1)->first();
return $client->id;
}
use Laravel\Nova\Fields\BelongsTo;
use Outhebox\NovaHiddenField\HiddenField;
HiddenField::make('User', 'user_id')
->hideFromIndex(),
->hideFromDetail(),
->current_user_id()
BelongsTo::make('User')
->hideWhenCreating(),
->hideWhenUpdating(),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.