小编mik*_*olu的帖子

Angular - Could not find a declaration file for module 'file-saver'

In my Angular-12 project I installed file-saver:

npm install file-saver@2.0.5

npm install --save exceljs

ng generate service services/export-excel
Run Code Online (Sandbox Code Playgroud)

Then in the export-excel service, I added:

import * as fs from 'file-saver';
Run Code Online (Sandbox Code Playgroud)

I got file-saver highlighted

with this error:

Could not find a declaration file for module 'file-saver'. 'c:/xampp/htdocs/myapp/node_modules/file-saver/dist/FileSaver.min.js' implicitly has an 'any' type. Try npm i --save-dev @types/file-saver if it exists or add a new declaration (.d.ts) file containing declare module 'file-saver';

But I didn't use:

@types/file-saver

How do I …

angular file-saver

9
推荐指数
3
解决办法
2万
查看次数

Laravel - 无法使用用户名在 SMTP 服务器上进行身份验证

使用 Laravel-5.8 发送通知,我收到此错误:

\n\n
Failed to authenticate on SMTP server with username "noblemfd@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 23 \xe2\x96\xb6\n535 5.7.8  https://support.google.com/mail/?p=BadCredentials n13sm8684140wmd.21 - gsmtp\n". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 \nUsername and Password not accepted. Learn more at\n535 5.7.8  https://support.google.com/mail/?p=BadCredentials n13sm8684140wmd.21 - gsmtp\n". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 \nUsername and Password not accepted. Learn more at\n535 5.7.8 …
Run Code Online (Sandbox Code Playgroud)

laravel

6
推荐指数
1
解决办法
2万
查看次数

DateTime::__construct(): 无法解析位置 0 (1) 的时间字符串 (16/07/2020):意外字符

在我的 Laravel 5.8 应用程序中,我有:

config/app.php

'date_format' => 'd/m/Y',
'date_format_js' => 'dd/mm/yy',
Run Code Online (Sandbox Code Playgroud)

模型

use Carbon\Carbon;

class HrHolidayDate extends Model
{
    protected $table = 'hr_holiday_dates';

    protected $fillable = [
        'holiday_name',
        'holiday_date',

    ];

    protected $dates = [
        'holiday_date'
    ];


    protected $casts = [];


    public function setHolidayDateAttribute($input)
    {
        $this->attributes['holiday_date'] =
            Carbon::createFromFormat(config('app.date_format'), $input)->format('Y-m-d');
    }


    public function getHolidayDateAttribute($input)
    {
        return Carbon::createFromFormat('Y-m-d', $input)
            ->format(config('app.date_format'));
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试在 Blae 视图中对其进行格式化,如下所示:

view

@foreach($holidays as $key => $holiday)
    <td>
        {{Carbon\Carbon::parse($holiday->holiday_date)->format('d-m-Y') ?? '' }}
    </td>
@endforeach
Run Code Online (Sandbox Code Playgroud)

当我想渲染视图刀片时,出现此错误:

[2020-07-15 11:57:56] production.ERROR: DateTime::__construct(): …

laravel

4
推荐指数
1
解决办法
2万
查看次数

如何使用 Maatwebsites 在 Excel 表格中添加标题

我正在尝试使用 Maatwebsites 将我的报告导出到我的 Laravel 5.8 项目中:

在 Laravel-5.8 中,我尝试使用 Maatwebsite 导出到 Excel:

<?php

namespace App\Exports;

use App\User;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\BeforeExport;
use Maatwebsite\Excel\Events\BeforeWriting;
use Maatwebsite\Excel\Events\BeforeSheet;
use Maatwebsite\Excel\Events\AfterSheet;

use Maatwebsite\Excel\Concerns\FromView;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithMapping;
use \Maatwebsite\Excel\Sheet;
use Maatwebsite\Excel\Concerns\RegistersEventListeners;
use Illuminate\Support\Facades\DB;

use Auth;


class EmployeesGoalPublishedExport implements FromCollection, ShouldAutoSize, WithHeadings
{

    private $headings = [
        'Staff ID', 
        'Name',
        'Gender',
        'Official Email',
        'Department',
        'HOD',
        'HRBP',
        'Line Manager',
        'Goal …
Run Code Online (Sandbox Code Playgroud)

laravel maatwebsite-excel

1
推荐指数
1
解决办法
1042
查看次数

数组必须与 Laravel 中的 Maatwebsite\Excel\Concerns\WithMapping::map($row) 兼容

我正在使用 Laravel-5.8 和 Maatwebsite-3.1 导出到 Excel。

<?php

namespace App\Exports;

use App\User;
use Auth;

class StudentExport implements FromCollection, ShouldAutoSize, WithHeadings, WithMappings, WithCustomStartCell
{

    private $headings = [
        'Student ID', 
        'Name',
        'Class',
        'Status',
        'Teacher'
    ];

    public function collection()
    {
        $current_terms = DB::table('appraisal_identity')->select('term_name')->where('company_id', $userCompany)->where('is_current', 1)->first()->term_name;
        $publishedgoals = AppraisalGoal::select('employee_code')->where('is_published', 1)->where('company_id', $userCompany)->groupBy('employee_code')->get();  


        $published_goals = DB::table('hr_students AS e')
                    ->join('hr_employees AS em','em.id','=','e.teacher_id')
                     ->select(
                        'e.student_id',
                        DB::raw('CONCAT(e.first_name, " ", e.last_name) AS full_name'),
                        'e.student_class,
                        DB::raw('(CASE WHEN e.is_status = 3 THEN "Excellent" WHEN e.is_status = 2 THEN "Good" WHEN e.is_status = …
Run Code Online (Sandbox Code Playgroud)

laravel maatwebsite-excel

1
推荐指数
1
解决办法
8036
查看次数

标签 统计

laravel ×4

maatwebsite-excel ×2

angular ×1

file-saver ×1