PHP code example of davidwesdijk / laravel-polymorphic-eav
1. Go to this page and download the library: Download davidwesdijk/laravel-polymorphic-eav 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/ */
davidwesdijk / laravel-polymorphic-eav example snippets
php
class ProductController extends Controller
{
public function update(AnyValidatedRequest $request, Product $product)
{
$product->props->details->color = $request->color; // E.g. 'red'
// That's it!
}
}
php
// This attribute has been set before
$product->props->details->color; // 'red'
// This attribute has never been set before
$product->props->details->sku; // null
// Even if the group has never been defined
$product->props->foo->bar; // null