PHP code example of martin6363 / filament-smart-import
1. Go to this page and download the library: Download martin6363/filament-smart-import 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/ */
martin6363 / filament-smart-import example snippets
use Martin6363\FilamentSmartImport\FilamentSmartImportPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentSmartImportPlugin::make(),
]);
}
use App\Models\Article;
use Martin6363\FilamentSmartImport\Actions\SmartImportAction;
protected function getHeaderActions(): array
{
return [
SmartImportAction::make()
->model(Article::class)
->translatable(['title', 'content'])
->locales(['en', 'ru'])
->uniqueBy('id')
->validationRules([
'title.en' => ['
use App\Models\Vehicle;
use Martin6363\FilamentSmartImport\Actions\SmartImportAction;
protected function getHeaderActions(): array
{
return [
SmartImportAction::make()
->model(Vehicle::class)
->uniqueBy('name_en')
->validationRules([
'name_en' => ['
class Vehicle extends Model
{
protected $fillable = [
'name_en',
'name_hy',
'description_en',
'description_hy',
'is_available',
];
protected function casts(): array
{
return [
'is_available' => 'boolean',
];
}
}