小编Mat*_*ieu的帖子

重新加载Bootstrap自定义

http://getbootstrap.com/customize/上,可以创建和下载自定义Bootstrap配置.下载中包含一个名为config.json的文件

是否可以以某种方式使用该文件来重新填充值并调整自定义引导程序配置?

如果没有,有人知道为什么包含该文件?

twitter-bootstrap

10
推荐指数
2
解决办法
8358
查看次数

覆盖 Laravel 中的 trait 以改变 Dusk 的行为

我有一个 Laravel 5.4 项目,正在尝试使用 Dusk 运行一些测试。我想在运行测试之前重置、迁移和播种。我已将其设置为使用 SQLite,并且理想情况下希望在内存中运行它,但物理文件也可以。

我能够通过更改 Illuminate\Foundation\Testing\DatabaseMigrations 来获得我想要的东西;原文:

public function runDatabaseMigrations()
{
    $this->artisan('migrate');

    $this->app[Kernel::class]->setArtisan(null);

    $this->beforeApplicationDestroyed(function () {
        $this->artisan('migrate:rollback');
    });
}
Run Code Online (Sandbox Code Playgroud)

我的版本:

public function runDatabaseMigrations()
{
    $this->artisan('migrate:refresh');
    $this->artisan('db:seed');

    $this->app[Kernel::class]->setArtisan(null);

    $this->beforeApplicationDestroyed(function () {
        $this->artisan('migrate:rollback');
    });
}
Run Code Online (Sandbox Code Playgroud)

但是当然我会在未来的一些更新中失去它,所以我需要覆盖我的特征。

我将特征复制到 App\Traits\DatabaseMigrations.php 并更改了命名空间。

<?php

namespace App\Traits;

use Illuminate\Contracts\Console\Kernel;

trait DatabaseMigrations
{
    /**
     * Define hooks to migrate the database before and after each test.
     *
     * @return void
     */
    public function runDatabaseMigrations()
    {
        $this->artisan('migrate:refresh');
        $this->artisan('db:seed');

        $this->app[Kernel::class]->setArtisan(null);

        $this->beforeApplicationDestroyed(function () {
            $this->artisan('migrate:rollback');
        });
    }
} …
Run Code Online (Sandbox Code Playgroud)

php traits laravel-5.4 laravel-dusk

5
推荐指数
0
解决办法
688
查看次数

包含模型到数组的 Laravel 集合

我有一个包含多个用户模型的 Laravel 集合。

Collection([
    User,
    User,
])
Run Code Online (Sandbox Code Playgroud)

该模型包含例如用户名、名字、姓氏、电子邮件、出生日期。我只需要用户名、电子邮件、日期并将其放在这样的数组中。

array(
    array('jonhdoe', 'johndoe@example.com', '1-1-1970')
)
Run Code Online (Sandbox Code Playgroud)

这样我就可以访问它

$username = $array[0][0]
$email = $array[0][1]
Run Code Online (Sandbox Code Playgroud)

并不是

$username = $array[0]['username']
$email = $array[0]['email']
Run Code Online (Sandbox Code Playgroud)

我正在查看每个 Laravel 助手或地图,但不知何故我无法让它工作。

php phpexcel laravel laravel-5.5

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