当我将excel工作表导入Laravel时,我遇到了这个问题,我试图在导入它时立即创建表,并动态地创建字段:
Symfony\Component\Debug\Exception\FatalThrowableError语法错误,意外的'if‘(T_IF),期待']'
这是导入文件的导入模型。
<?php
namespace App\Imports;
use DB;
use App\People;
use Maatwebsite\Excel\Concerns\ToModel;
use Illuminate\Support\Facades\Schema;
我有使用的导出功能。目前,我的数据正在导出,但我希望将相关的表数据添加到我的csv中,而不是只添加id。
示例
这就是我现在得到的
id-name-core_id-created_at-updated_at
我想要的
id-name-core_name-created_at-updated_at
为此,我发现映射()可能是解决方案,但它导出空白csv。
代码
Export class
<?php
namespace App\Exports;
use App\CableAlokasi;
use Maatwebsite\Excel\Excel;
use Maatwebsi
您好,我有一个有130.000行的大型csv文件 我用的是laravel excel 3.1和lavaravel 5.8 导入类: <?php
namespace App\Imports;
use App\UsoSuelo;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithChunkReading;
use Maatwebsite\Excel\Concerns\WithBatchInser
我正在使用Maatwebsite / laravel导出数据,我需要重命名工作表,
在我的班级下面:
<?php
namespace App\Exports;
use App\Models\Client;
use App\Models\Item;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\ShouldAut
我是导出一个excel使用LaravelExcel3.1由excel网站。我想用两个标题来映射它,并把它显示在另一个下面。
我使用的是WithHeadings,WithMapping,FromArray,我得到的是记录,只是需要更正的格式
<?php
namespace App\Exports;
use Modules\Program\Entities\Program;
use Modules\report\Entities\report;
use DB;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\
我使用maatwebsite/excel包从数据库表生成excel文件。导出是成功的,但我需要一些格式化它的帮助。
事实上,我希望excel有更大的字体大小为标题,突出显示标题和边框。
到目前为止,我只成功地使用setSize()创建了更大的标题字体,正如您在代码摘录中看到的那样。
我的导出文件(\laravel\app\Exports\MembersExport.php)如下:
<?php
namespace App\Exports;
use App\Member;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatweb
我试着用maatwebsite excel package把数据从excel文件导入数据库, 我使用了以下代码: namespace App\Imports;
use Maatwebsite\Excel\Facades\Excel;
use PhpOffice\PhpSpreadsheet\Spreadsheet\Shared\Date;
use App\Models\Casting;
use Carbon\Carbon;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Concerns\ToModel;
use Maa
我尝试在控制器内的laravel上使用Excel: @package maatwebsite/excel包,但我得到了以下错误:
Non-static method Maatwebsite\Excel\Excel::create()
should not be called statically, assuming $this from incompatible context
我的路线是:
Route::get('all_users_report/{format}', 'SystemExportDataController@all_users_report'
我正在使用Maatwebsite/excel组件导入excel文件。在本例中,导入用户。我需要验证邮件不存在,然后导入唯一数据
我在导入文件中有以下代码
namespace App\Imports;
use App\User;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\Importable;
use Maatwebsite\Excel\Concerns\WithValidation;
class UsersImpor
我使用Laravel 5.6和maatwebsite(laravel-excel) 3.1,我的php是7.1
下面是ReportExport类:
<?php
namespace App\Exports;
use App\Report;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatweb
我需要通过导出一个带有复杂标题的表。我需要一个主航向和另一个分级别航向。
我就像这样,
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
class InvoicesExport implements FromQuery, WithHeadings
{
public function headings(): array
{
return [
'Account 1' =>[
我正在构建我的第一个laravel网站,并尝试设置Maatwebsite\laravel-excel包 视图中的表单值已经传递给了控制器变量。现在我使用FromQuery和WithMapping设置模型。 但我在尝试获取内部返回时遇到了问题 IndustriesExport.php <?php
namespace App\Exports;
use App\Industry;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Exc
我正在尝试使用laravel导出一些excel格式的数据。但在这种格式中,我想显示一些我不知道的其他行。
<?php
namespace App\Exports;
use App\SalesLog;
use App\SalesLogItem;
use RegistersEventListeners;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite
我使用导入标头&一些记录。
使用,我应该能够获得标题:
$headings = (new HeadingRowImport)->toArray($myFile);
如果$myFile是CSV,没关系;但是如果我尝试使用XLS或XLSX (使用有效的Mimetype:application/vnd.ms-excel和application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ),我会得到这样的问题:
ZipArchive::getFromName():
Invalid or uninitialized Zip
在laravel 5.8生成csv文件时,我使用了https://github.com/Maatwebsite/Laravel-Excel插件,它工作得很好,但因为我使用headings方法来生成https://docs.laravel-excel.com/3.1/exports/mapping.html头 根据我从db获得的结果集,我需要有标头: <?php
namespace App\Exports;
use Auth;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\W
我正在使用,并且对从csv文件导入我的数据有问题。
当我试图导入CSV文件时,它会返回验证错误。
errors: {name: ["The name field is required."], stock: ["The stock field is required."],…}
name: ["The name field is required."]
price: ["The price field is required."]
stock: ["The stock field is required.
我刚用作曲家得到了玛特网站,拉拉维尔-Excel。我即将使用它,但我是全新的安装/使用软件包。到目前为止,我只使用了拉拉维尔装运的东西。我正在阅读,并遵循这些步骤(我已经完成了前三个步骤),但我对这一行感到困惑;
The class is binded to the ioC as excel
$excel = App::make('excel');
我真的不知道这意味着什么。我读过一些关于ioC的内容,然后是依赖注入(对我来说也是新的)。但我还是不知道-这部分医生让我做些什么吗?我在命令行上运行了php artisan (另一个目的),并得到了它;
[2015-04-23 1
我试着用laravel从一个集合导出一个Excel文件。下面的代码,返回给我这个。我需要在列的开头增加两个新行,这可能吗?我该怎么办?
<?php
namespace App\Traits;
namespace App\Exports;
// use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHead
<?php
namespace App\Imports;
use App\Models\Customer;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithValidation;
class CustomerImport implements To
我正在尝试使用WithValidation关注点在导入数组中查找重复的行(稍后将使用SkipsOnError删除重复的行)。但是我的导入类中用于查找重复行的验证集似乎不起作用。当我上传包含重复数据的excel文件(只是一个没有标题的列)时,没有返回错误,并且所有行都被导入到数据库中
<?php
namespace App\Imports;
use App\Contactlist;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\Importable;
use Maatwebsite\Exce