小编Sha*_*lom的帖子

货币英镑显示为 £ 导出为 csv 时

我需要将数据导出为 csv。除了货币符号,一切都在变。例如。货币 £ 显示为£ 我的项目是 Laravel 4.2 应用程序。

$filename   = $customer['firstname']."_".date('Y-m-d h:i').".csv";
$file_path  = storage_path(). "/transactions"."/".$filename;  
$handle     = fopen($file_path,"w+");
fputcsv($handle, array('Date', 'Type', 'Ticket', 'Quantity', 'Ticket type', 'Block', 'Event date', 'Paid', 'Recieved'));

foreach($ticket as $row) {
    if($row->type == 'purchased')
    {
        $p_amount = trans('homepage.currencyInUse') .' '.number_format($row->amount, 2).' '.trans('homepage.currencyAfter');
        $s_amount = ' ';
    }
    elseif($row->type == 'sold')
    {
        $p_amount = ' ';
        $s_amount = trans('homepage.currencyInUse').' '.number_format($row->amount, 2).' '.trans('homepage.currencyAfter');
    }
    fputcsv($handle, array(
            date('d/m/Y', strtotime($row->orderDate)), 
            $row->type,
            $row->event->title,
            $row->qty,
            $row->ticketType,
            trans('homepage.Block').':'.$row->ticket['ticketInformation']['loc_block'] ,
            date('d/m/Y', strtotime($row->event->datetime)),
            $p_amount, …
Run Code Online (Sandbox Code Playgroud)

php csv export-to-csv laravel laravel-4.2

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

删除的迁移文件正在执行:Laravel 应用程序

我删除了一些迁移文件。但是当我执行 php artisan migrate 命令时,旧迁移文件中显示错误。

[Illuminate\Database\QueryException]
SQLSTATE[HY000]:一般错误:1215 无法添加外键约束(SQL :在删除级联上更改表cushbu_notifications添加约束 cushbu_notifications_art_id_foreign外键 ( art_id) 引用cushbu_arts( ))id

现在我没有 cushbu_notifications 的迁移文件,而是为 cushbu_user_notifications 创建了一个新的迁移文件。我从数据库中删除了 cushbu_notifications 表,也从迁移表中删除了相应的条目。

database-migration laravel laravel-5.4 laravel-artisan

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

Laravel:某些字段的自定义验证不起作用

在我的应用程序中,地址字段的自定义验证不起作用,但其他文件正在工作.不知道这个问题.

视图

<div class="col-md-4">
    <label for="email">Location:</label>
    <div class="form-group">
        <input name="address" id="autocomplete" placeholder="Enter your address"
         onFocus="geolocate()" class="form-control" value="{!!$company->address!!}" type="text"></input>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

调节器

$this->validate($request, [
    'name' => 'required|regex:/^[a-zA-Z .0-9]+$/',
    'office_mail' => 'required|email|max:255',
    'address' => 'required|regex:/^[a-zA-Z ,0-9]+$/',
    'industry_id' => 'required',
    'contact_number' => 'numeric|digits_between:10,12',
    'company_website_url' => 'required|url',
]);
Run Code Online (Sandbox Code Playgroud)

Validation.php

'custom' => [
    'name' => [
        'required' => 'Your name is required',
    ],
    'address' => [
        'required' => 'The location field is required',
    ],
    'address' => [
        'regex' => 'Please enter a valid location',
    ], …
Run Code Online (Sandbox Code Playgroud)

php validation laravel laravel-5.4

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