我正在尝试运行一些基本的Laravel Dusk测试,但总是遇到Facebook WebDriver的问题:
我已将chrome更新到最新版本,并使用Hombrew手动更新了Chrome WebDriver:
有什么建议?
干杯,斯坦
错误:
Tests\Browser\Tests\Auth\SignUpTest::a_user_can_sign_up
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textarea[name='input[name="name"]']"}
(Session info: headless chrome=64.0.3282.119)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64)
Run Code Online (Sandbox Code Playgroud)
MySignUpTest:
public function a_user_can_sign_up()
{
$this->browse(function (Browser $browser) {
$browser->visit(new SignUpPage)
->signUp('Erika Musterfrau', 'erika.musterfrau@socialite.ch', 'password', 'password')
->assertPathIs('/dashboard')
->assertSeeIn('.navbar', 'Erika Musterfrau');
});
}
Run Code Online (Sandbox Code Playgroud)
MySignUpPage:
public function assert(Browser $browser)
{
$browser->assertPathIs('/register');
}
public function signUp(Browser $browser, $name = null, $email = null, $password = null, $passwordConfirmation = null)
{
$browser->type('@name', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用额外的模型和防护来验证我的 Laravel 应用程序 (5.8)。问题,我在以下登录方法中收到“未定义索引:模型”错误。任何想法我做错了什么?我在 5.7 版本的 Laravel 中使用了这种集成,它在那里工作没有任何问题。
auth()->guard('partner')->login($partner);
Run Code Online (Sandbox Code Playgroud)
代码片段:
合作伙伴模型(附加设置)
class Partner extends Authenticatable {
protected $guard = 'partner';
public function getRouteKeyName()
{
return 'uuid';
}
}
Run Code Online (Sandbox Code Playgroud)
守卫(config.auth.php)
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'partner' => [
'driver' => 'session',
'provider' => 'partners',
],
],
Run Code Online (Sandbox Code Playgroud)
提供者(config.auth.php)
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'partners' => [
'driver' => 'eloquent',
'table' => \App\Models\Partner::class,
], …Run Code Online (Sandbox Code Playgroud) 我们最近部署了一个 Laravel 应用程序,并在我们的应用程序上遇到了一些 Safari 版本的奇怪问题。
当在我们的应用程序上冲浪时,尤其是在用户未经授权的情况下,我们有时会在 Safari 上遇到请求/响应标头中不存在 XSRF 令牌的问题。
在申请表上,缺少令牌会导致 419 页面过期问题。
该问题仅有时出现在某些版本的 Safari 中。大多数情况下,重置缓存和 Cookie 可以解决 1 或 2 个表单请求的问题。
我彻底重置了 Safari
技术
我们使用 PHP 8.0 和最新的 Laravel 版本。对于前端,有一个 vue.js 应用程序,以惯性.js 作为连接器。关于将 csrf-token 传递到前端,不需要进一步配置来传递 csrf-token。(来源)
我尝试捕获 TokenMismatchExpection 但不可能只有 HTTPException 有效。
我的问题是:
附上一些 Laravel 调试栏屏幕截图。
Safari 14.03 | 左侧 右侧镀铬
页面过期屏幕
我想将数据发送到NewsletterStore作业。但是失败,并显示以下错误。有什么建议么?
我还尝试删除了SerializesModels模型特征。没有任何成功。
错误
Exception
Serialization of 'Closure' is not allowed
Run Code Online (Sandbox Code Playgroud)
控制者
public function store(StoreNewsletterRequest $request)
{
StoreNewsletterJob::dispatch($request);
return view('backend.dashboard.index');
}
Run Code Online (Sandbox Code Playgroud)
工作
protected $request;
public function __construct($request)
{
$this->request = $request;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if(!Newsletter::isSubscribed($this->request->email))
{
Newsletter::subscribe($this->request->email, [
config('newsletter.list_fields.firstname') => $this->request->firstname,
config('newsletter.list_fields.lastname') => $this->request->lastname
]);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的新 M1 Mac Book 上设置 PhpStorm CLI 解释器。PHP 8.0 本身运行良好,但我无法将其添加为 PhpStorm 中的 CLI 解释器。
// 安装命令
brew install php
brew link php@8.0
Run Code Online (Sandbox Code Playgroud)
//which php
/opt/homebrew/bin/php
Run Code Online (Sandbox Code Playgroud)
//php -v
PHP 8.0.2 (cli) (built: Feb 4 2021 12:48:26) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies
sebastian@nbch003 ~ %
Run Code Online (Sandbox Code Playgroud)
//php --ini
Configuration File (php.ini) Path: /opt/homebrew/etc/php/8.0
Loaded Configuration File: /opt/homebrew/etc/php/8.0/php.ini
Scan for additional .ini …Run Code Online (Sandbox Code Playgroud) 更新
这个问题似乎与 PECL 本身有关:
https://github.com/Imagick/imagick/issues/331
我无法运行构建过程,pecl install imagick也无法从错误日志中获取任何信息。我使用装有最新 Apple M1 处理器的 Mac (OS 11.2.1)。该库与 PHP 8.0.2 结合使用
在开始构建过程之前,我安装了以下 brew 包:
所需的库
brew install pkg-config
brew install imagemagick
Run Code Online (Sandbox Code Playgroud)
构建命令
pecl install imagick
Run Code Online (Sandbox Code Playgroud)
构建过程日志
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/imagick -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/include -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/main -I/private/tmp/pear/temp/imagick -I/opt/homebrew/Cellar/php/8.0.2/include/php -I/opt/homebrew/Cellar/php/8.0.2/include/php/main -I/opt/homebrew/Cellar/php/8.0.2/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.2/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext/date/lib -I/opt/homebrew/Cellar/imagemagick/7.0.11-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 …Run Code Online (Sandbox Code Playgroud) 是否可以通过在nova后端不输入表单来生成模型值?
例如,每次存储/更新后,我想用当前经过身份验证的用户更新created_by值。
例
$model->created_by = aut()->user()->id
Run Code Online (Sandbox Code Playgroud) Laravel Nova 中是否有选项可以显示可读的日期时间输出和/或限制输出?
例如: 2018 年 10 月 29 日 / 2018 年 11 月 11 日,上午 12:10
代码:
DateTime::make('Start')
->rules('required')
->sortable(),
Run Code Online (Sandbox Code Playgroud)