You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, the file works just fine and imports with 'group_id' being nullable, because it wasn't contained in the file... but is there anyway to inject 'group_id' => 2 into the importable so that it may be included automatically with the import?
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
The text was updated successfully, but these errors were encountered:
class UsersImport implements ToModel
{
use Importable;
protected $data;
public function __construct($data){
$this->data = $data;
}
}
...
(new UsersImport($request->data))->import($request->file);
Prerequisites
Versions
Description
Is there anyway to pass additional values of an array to the importable?
IE: If my spreadsheet has the following:
Users
ID,FNAME,LNAME
1,SEO,ROMAN
2,MAAT,EXCEL
and I want to import this file, but put them in the Group ID with an ID of 2
->postJson('/users/import', [ 'group_id' => 2, 'file' => $excel ]);
Now, the file works just fine and imports with 'group_id' being nullable, because it wasn't contained in the file... but is there anyway to inject 'group_id' => 2 into the importable so that it may be included automatically with the import?
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
The text was updated successfully, but these errors were encountered: