wip import
This commit is contained in:
1 parent
7343c26955
commit
e7fe8de435
13 files changed
+367
-341
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ProjektOrientierungZuAbschlaege;
|
||||
use App\Models\ProjektRaeumealle;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
@@ -11,18 +12,39 @@ use Illuminate\Support\Number;
|
||||
class ProjektRaeumealleImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ProjektRaeumealle::class;
|
||||
|
||||
protected function beforeValidate(): void
|
||||
{
|
||||
$orientierung_zu_abschlaege = ProjektOrientierungZuAbschlaege::firstOrNew([
|
||||
'projekte_id' => $this->options['projekte_id'],
|
||||
'top_nummer' => $this->data['top_nummer'],
|
||||
]);
|
||||
$this->data['$orientierung_zu_abschlaege'] = $orientierung_zu_abschlaege->id;
|
||||
}
|
||||
|
||||
protected function beforeSave(): void
|
||||
{
|
||||
dd($this->data);
|
||||
}
|
||||
|
||||
public function resolveRecord(): ProjektRaeumealle
|
||||
{
|
||||
$raeumealle = new ProjektRaeumealle;
|
||||
$raeumealle->projekte_id = $this->options['projekte_id'];
|
||||
$orientierung_zu_abschlaege = ProjektOrientierungZuAbschlaege::firstOrNew([
|
||||
'projekte_id' => $this->options['projekte_id'],
|
||||
'top_nummer' => $this->data['top_nummer'],
|
||||
]);
|
||||
|
||||
return $raeumealle;
|
||||
return ProjektRaeumealle::firstOrNew([
|
||||
'projekt_orientierung_zu_abschlaege_id' => $orientierung_zu_abschlaege->id,
|
||||
'projekte_id' => $this->options['projekte_id'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
// ImportColumn::make('top_nummer')
|
||||
// ->relationship('orientierung_zu_abschlaege'),
|
||||
ImportColumn::make('top_nummer')
|
||||
->label('Top Nummer')
|
||||
->validationAttribute('Top Nummer')
|
||||
|
||||
Reference in new issue
Block a user