从文档中我看到可以通过laravel安装程序创建一个laravel项目:
$laravel new blog
Run Code Online (Sandbox Code Playgroud)
或通过作曲家:
$composer create-project laravel/laravel --prefer-dist
Run Code Online (Sandbox Code Playgroud)
如果我尝试第一种方式.env文件未创建.我怎么能请求laravel,artisan或composer为我创建一个.env文件?
我在我的 Github 存储库上设置了一个关于主分支检查(激活)以下内容的分支保护规则:
然后我面临的情况是,团队中至少有一个人必须批准 PR,然后有人才能将自己的 dev 分支合并到 master 分支。
除了上述内容之外,我还想只选择一些有权合并已审查和批准的 PR 的人。并非每个人都有权访问该存储库。
可以这样设置吗?
我有我的vue应用程序使用:
由component-child组成的组件父组件
在component-parent里面我有按钮,当有人点击我想发出一个事件的按钮,以便由vue处理并传递给另一个组件
到目前为止我做了什么:
var vm = new Vue({
el: '#app',
methods:{
itemSelectedListener: function(item){
console.log('itemSelectedListener', item);
}
}
});
Vue.component('component-child', {
template: ' <span v-on:click="chooseItem(pty )" >Button </span>'
,
methods: {
chooseItem: function(pty){
console.log(pty);
this.$emit('itemSelected', {
'priority' : pty
});
}
}
});
Vue.component('component-parent', {
template: '<component-child v-for="q in items" ></component-child>'
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<component-parent v-on:itemSelected="itemSelectedListener" ></component-parent>
Run Code Online (Sandbox Code Playgroud)
它到达我的console.log(pty); 但似乎这个.$ emit('itemSelected'不会通过:
console.log('itemSelectedListener',item); //这不会被称为......
暗示?
我应该从child-> parent-> Vue-instance冒泡事件?(我也试过但没有成功)
假设我有一个如下所示的方法
def validate(self, item:dict, attrs:dict)-> list:
Run Code Online (Sandbox Code Playgroud)
如果我想更具体地告诉我我的返回类型是一个 ValidationMessages 列表?
我应该如何/我能做到这一点吗?
(我会将标记标记为重复项,因为这与扩展列表或展平无关)我问的是如何更具体地识别方法的返回类型......
我有我的Laravel项目,它会在进行一些计算后保存文件(txt或csv).
我正在寻找保存这些文件的最佳实践.也许/ resources/csv/...?
第二个问题如何从类中引用此路径的最佳方法?在.env文件中设置abs路径?是否有laravel方法将返回资源的路径?
我已经用laradock设置了docker.
我正在使用以下包
"adldap2/adldap2-laravel": "^2.1"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Call to undefined function Adldap\ldap_explode_dn()
Run Code Online (Sandbox Code Playgroud)
我应该进入我的docker工作区并尝试安装它吗?
docker-compose exec workspace bash
Run Code Online (Sandbox Code Playgroud)
我该如何安装?好像我找不到apt-get或apt-cache的php7.0-ldap包......
是否可以通过docker-compose或通过编辑某个docker文件来启用它?(php-fpm/Dockerfile-70?
编辑:(DockerFile-70全内容,提供解决方案)
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
# To edit the 'php-fpm' base Image, visit its repository on Github
# https://github.com/LaraDock/php-fpm
#
# To change its version, see the available Tags on the Docker Hub:
# https://hub.docker.com/r/laradock/php-fpm/tags/
#
FROM laradock/php-fpm:7.0--1.2
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
# …Run Code Online (Sandbox Code Playgroud) 我正在使用Laravel,这是我的./phpunit.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="FeatureTests">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="UnitTests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite_testing" />
</php>
</phpunit>
Run Code Online (Sandbox Code Playgroud)
我用以下命令触发了我的一个测试套件:
./vendor/phpunit/phpunit/phpunit --testsuite UnitTests
Run Code Online (Sandbox Code Playgroud)
在我的测试方法中,我有:
public function testAllMandatoryData()
{
dump(env('APP_ENV'));
....
}
Run Code Online (Sandbox Code Playgroud)
它正在显示"本地",我期待phpunit.xml中指定的"测试"
<env name="APP_ENV" value="testing"/>
Run Code Online (Sandbox Code Playgroud)
编辑:其他详细信息 我在Docker容器中运行此laravel应用程序
在docker-compose.yml上我设置了一些环境变量,如:
environment:
- APP_ENV=local
- DB_HOST=192.168.0.22
- DB_PORT=33306
- DB_DATABASE=mydatabase …Run Code Online (Sandbox Code Playgroud) 我想创建一个请求集合,以便保存它们并与协作者共享。
我没有找到任何按钮、菜单操作来将新请求(或当前请求)添加到新创建的文件夹集合中?
不太直观...
我正在开发一个Illuminate\Console\Command.使用php artisan通过cli运行.此Command类正在使用其他类.我很欣赏Command-> info(),Command-> error(),方法......我怎样才能在依赖中使用它们?
到现在为止,我将其作为参数传递给其他类$ this
例如
class MyClass extends Command {
....
$g = new MyOtherClass($this, $param...);
$g->find();
....
}
class MyOtherClass {
$command;
....
public function __construct($command){
$this->command=$command;
}
public function find(){
if($error)
$this->command->error($error);
}
....
}
Run Code Online (Sandbox Code Playgroud)
我希望方法可以静态访问,如:Command :: error("some error");
但也许这不是预期的用途?
我在我的打字稿玩笑测试中写了以下内容:
beforeEach(() => {
jest
.spyOn<MyParentClass, any>(MyChildClass.prototype, "doRequest")
.mockImplementation(async function (this:MyChildClass) {
/// do my mock
} as () => never);
Run Code Online (Sandbox Code Playgroud)
添加该部分as () => never是为了跳过异步上的类型检查器错误,表示
Argument of type '(this:MyChildClass) => Promise<any>' is not assignable to parameter of type '() => unknown'
Run Code Online (Sandbox Code Playgroud)
我找不到改进以下内容的方法,将任何内容缩小为更精确的类型:.spyOn<MyParentClass, any>
根据定义
function jest.spyOn<T extends {}, M extends jest.NonFunctionPropertyNames<Required<T>>>(object: T, method: M, accessType: "get"): jest.SpyInstance<Required<T>[M], []> (+3 overloads)
Run Code Online (Sandbox Code Playgroud)
我尝试了其他可能适合的类型,但没有成功......
测试运行成功,我能够监视和模拟,只是想知道如何编写更好的打字定义。
laravel ×4
laravel-5 ×3
php ×3
docker ×2
command-line ×1
composer-php ×1
console ×1
debugging ×1
environment ×1
file ×1
git ×1
github ×1
install ×1
javascript ×1
laradock ×1
ldap ×1
mocking ×1
phpunit ×1
postman ×1
python ×1
python-3.x ×1
return-type ×1
ts-jest ×1
typescript ×1
vuejs2 ×1
xml ×1