Return to homepage

Comments

Farooq

I have a proplem with Horizon on windows,, is there any way to make run on window 11 or 10?

  • 0
arjan

Hi, im getting a ''No property found for validation: [ColumnsToMap.id]'' hope you can help me out.

public function rules() { $columnRules = collect($this->requiredColumns) ->mapWithKeys(function ($column) { return ['ColumnsToMap.' . $column => ['required']]; }) ->toArray();

1 return array_merge($columnRules, [
2
3 'file' => ['required', 'file', 'mimes:csv', 'max:51200'],
4
5 ]);
6}
  • 0
krekas

Is ColumnsToMap really in capital?

  • 0
arjan

Thanks! 🤣

  • 0
Jesper

Instead of turning columnsToMap into a collection, mapping and using toArray, you could just use: array_fill_keys($this->columnsToMap, ‘’);

  • 0
Eugene

Can we use another file extension (xlsx,xls,ods) to import with LeagueCSV? I investigated and seems to me we can't ((. Maybe it possible to add this functionality by adding adapterю If we have other mime type (not CSV) then use another lib or smth like that)?

  • 0
Eugene

I have an issue: in CsvImporter.php in rules() method I try to define rule for file: 'file' => ['required', 'mimes:csv,xlsx,xls,ods', 'max:51200'] (the same as in cource), but this rule accept all mime type except csv ))). Anyone has an idea? P.S.: I use Ubuntu 20.04, Laravel 7 and php 7.4.

  • 0
Eugene

I find the answer: just add txt to mime types ---> 'mimes:csv,txt,xlsx,xls,ods',

  • 0
ossama

Quick Tip:

If you want to make an invokable controller, you may pass i flag into the artisan command.

An example:

php artisan make:controller CustomerIndexController -i

or

php artisan make:controller CustomerIndexController --invoke
  • 1
Ozan

Will there be a source download available?

  • 1
krekas

Usually source download is available after course is fully uploaded

  • 0
Manuel

Any ideas about how to auto detect the CSV format?

My CSV is splitted with ";" so I had to set in readCsv method

$csv->setDelimiter(';');

  • 0
Emil

You can use the static Info-class that are in the League package

1$delimiters = Info::getDelimiterStats($csv, [',', ';'], 2);
2if ($delimiters[';'] > 0)
3 $csv->setDelimiter(';');

If I find any ; as delimiters, I set that as the default.

  • 0
Lloric

thanks for this course, by the way have no knowledge of javascript so that is why i'm choosing livewire to easy manage by using php laravel backend.

  • 0
Farooq

thanks for your work,,, i tried the code but the non-CSV file still uploaded event the validation shown an error. and i have question/requiest i am trying to make master/detail form with livewire ( like invoice with multiple lines of products ) with livewire is there any project avaible you recommend? thanks

  • 0