Import
class Import
Properties
protected string | $path | Path to the directory with the import files. |
Methods
Create a new instance.
Check if this import matches to the given import files.
Check if the files of this import are valid.
The files expected by this import.
Get the basename of each file of this import.
Validate a file of this import.
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
Validates a CSV file to contain the expected columns.
Read a JSON file containing an array and wrap it in a Laravel collection.
Details
at line 23
__construct(string $path)
Create a new instance.
at line 33
bool
filesMatch()
Check if this import matches to the given import files.
at line 48
validateFiles()
Check if the files of this import are valid.
at line 60
protected array
expectedFiles()
The files expected by this import.
at line 70
protected array
files()
Get the basename of each file of this import.
at line 84
protected
validateFile(string $basename)
Validate a file of this import.
at line 98
protected
expectKeysInJson(string $file, array $expectation, bool $array = true)
Validates a JSON file to contain an array of objects, each of which has all the expected keys.
at line 124
protected
expectColumnsInCsv(string $file, array $expectation)
Validates a CSV file to contain the expected columns.
at line 148
protected Collection
collectJson(string $file)
Read a JSON file containing an array and wrap it in a Laravel collection.