PHP code example of ganyicz / nova-temporary-fields
1. Go to this page and download the library: Download ganyicz/nova-temporary-fields 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/ */
ganyicz / nova-temporary-fields example snippets
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Ganyicz\NovaTemporaryFields\HasTemporaryFields;
class User extends Resource
{
use HasTemporaryFields;
public function fields(Request $request)
{
return [
Text::make('Non existent')->temporary()
];
}
}
class Product extends Model
{
// ...
public function pricing()
{
return $this->hasMany(Pricing::class);
}
}
use Illuminate\Http\Request;
use Ganyicz\NovaCallbacks\HasCallbacks;
use Ganyicz\NovaCallbacks\HasTemporaryFields;
class User extends Resource
{
use HasTemporaryFields,
HasCallbacks;
public function fields(Request $request)
{
return [
// For the sake of simplicity, I'm not resolving the current price
Number::make('USD')
->request->input('EUR')])->save();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.