problem with exel uploader
I have form like this image is. I'm using
EightyNine ExcelImport
framework to import exel file. this is pivot table like i have holding company table and pivot table for this holding company dircetors, one holding company may have many directors with active statuses, i want to write all this in my exel file and next import it. my code at this moment looks like that its only adding internal_company_name and indefinitcation_code at this moment7 Replies
anyone? (
Check fillable on the model.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class HoldingCompany extends Model
{
use HasFactory;
protected $fillable = ['internal_company_name', 'identification_code', 'director_id'];
public function directors()
{
return $this->hasMany(Director::class, 'director_holding_company', 'holding_company_id', 'director_id');
}
public function directorHoldingCompany(): HasMany
{
return $this->hasMany(directorHoldingCompany::class);
}
}
this is my model of holdingcomapny
also there is direcor model for pivot table you are missing holding_company_id, is_active of the fillable array ?
ou wait i will try, may i need it in my holding company model
yes its works now but its not adding directors in pivot table :((
what i should do to also add directors in pivot table?
I'm not sure how you handle the pvitor tables with. Eightngiths importer.
Filamentphp's native importer uses definiton on the column:
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/import#importing-relationships
u mean use relationship?
can u refactor my code ? how i should add it there ?