PHP code example of justbetter / laravel-akeneo
1. Go to this page and download the library: Download justbetter/laravel-akeneo 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/ */
justbetter / laravel-akeneo example snippets
return [
'models' => [
'product_model' => \JustBetter\Akeneo\Models\ProductModel::class,
'product' => \JustBetter\Akeneo\Models\Product::class,
'attribute' => \JustBetter\Akeneo\Models\Attribute::class,
'channel' => \JustBetter\Akeneo\Models\Channel::class,
'attribute_types' => [
'Simpleselect' => \JustBetter\Akeneo\Models\Attribute\Simpleselect::class,
'Multiselect' => \JustBetter\Akeneo\Models\Attribute\Multiselect::class,
'Text' => \JustBetter\Akeneo\Models\Attribute\Text::class,
'Date' => \JustBetter\Akeneo\Models\Attribute\Date::class,
],
],
'connections' => [
'default' => [
'url' => env('AKENEO_URL'),
'client_id' => env('AKENEO_CLIENT_ID'),
'secret' => env('AKENEO_SECRET'),
'username' => env('AKENEO_USERNAME'),
'password' => env('AKENEO_PASSWORD'),
],
],
'cache_ttl' => 30,
];
$models = ProductModel::all();
$models = ProductModel::lazy();
$product = Product::find('code-123');
$product->product_name->setValue(
data: 'test product 3',
locale: null, # default
scope: null # default
);
$option = \JustBetter\Akeneo\DataObjects\Option::make(
data: 'tag 1',
locale: null,
scope: null
)
$product->tags->addOption($option);
$product->tags->removeOption($option);
$product->tags->syncOptions([$option1, $option2]);
$product = Product::find('code-123');
$product->product_name->setValue(
data: 'test product 3',
locale: null, # default
scope: null # default
);
$product->save();
bash
php artisan vendor:publish --provider="JustBetter\Akeneo\AkeneoServiceProvider" --tag="akeneo-config"