我已经实现了 Laravel Telescope,我只能在以下情况下访问 APP_ENV=local
我遵循了 Laravel 的文档并更改了代码TelescopeServiceProvider.php(注意我的环境被称为 loca、dev、testing 和 prod)。
我可以访问的唯一方法Telescope是APP_ENV=local在每个环境中进行更改。
有谁知道哪个可能是问题?
问候
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Laravel\Telescope\TelescopeApplicationServiceProvider;
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Telescope::night();
$this->hideSensitiveRequestDetails();
Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local') || $this->app->environment('dev') || $this->app->environment('test') || $this->app->environment('prod')) {
return true;
}
return $entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
}); …Run Code Online (Sandbox Code Playgroud) 当我尝试创建与其父级关联的子模型时遇到问题。
我有 2 个型号:
当我单击一个机构并转到 show.blade.php 时,我有一个表单可以为该机构创建地址,但我无法从请求中获取将子项与父项相关联的字段“instituion_id”。
这在请求中显示:
请求数据
从表单中,我调用以下路由:action="/institution/{{ $institution->id }}/addresses"
这是AddressController中的代码:
public function store(Request $request)
{
// dd($request->all());
Address::create($request->all());
return back();
}
Run Code Online (Sandbox Code Playgroud)
当我测试它时,数据库询问 istitution_id 列:
SQLSTATE [ HY000]:一般错误:1364 字段“institution_id ”没有默认值(SQL:插入(
addresses、、、、、、、、、、、)值(aaddress_name、 a 、 a、a、a、a、a , 2017-12-14 14:06:47, 2017-12-14 14:06:47))address_numberaddress_full_nameaddress_cityaddress_stateaddress_postal_codeaddress_countryupdated_atcreated_at
那么,如何从表单传递字段“institution_id”以及如何将其获取到控制器中并将其关联到子记录?
我读了很多帖子,但在所有帖子中,它们都只是创建一个包含一个字段的子记录,但我想处理包含所有地址字段的完整请求。
问候
我有以下数组,我需要对其进行过滤并仅获取具有的元素 type = 1
array:5 [
0 => array:3 [
"id" => 1
"name" => "Agua Corriente"
"type" => 1
]
1 => array:3 [
"id" => 2
"name" => "Cloaca"
"type" => 1
]
2 => array:3 [
"id" => 3
"name" => "Gas Natural"
"type" => 2
]
3 => array:3 [
"id" => 4
"name" => "Internet"
"type" => 3
]
4 => array:3 [
"id" => 5
"name" => "Electricidad"
"type" => 3
]
]
Run Code Online (Sandbox Code Playgroud)
这是预期的结果: …
我已经在开发、测试和生产环境中实现了 SSL。我必须更改一些刀片功能secure_asset()以secure_url防止 Chrome 阻止内容。但要知道,由于我之前解释过的变化,我的本地环境存在很多问题。
哪种方式可以在服务器环境中使用 SSL,但不能在本地环境中使用?
问候