PHP code example of marshmallow / prefiller-field
1. Go to this page and download the library: Download marshmallow/prefiller-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/ */
marshmallow / prefiller-field example snippets
public function fields(Request $request)
{
return [
BelongsTo::make('Product')->nullable()->searchable(),
PrefillerText::make('Test', 'field_2')
->sourceField('product')
->sourceModel(\Marshmallow\Product\Models\Product::class)
->prefillWith('name'), // This can be a field or a method on your target resource
PrefillerCurrency::make('Test 3', 'field_3')
->sourceField('product')
->sourceModel(\Marshmallow\Product\Models\Product::class)
->prefillWith('price')
->currency('EUR')
->default(0)
->nullable(),
]
}