小编Pet*_*ovo的帖子

如何使用广播身份验证修复 419 错误

在我的 Laravel Framework 5.7 / Vuejs 2.6 中,我使用 jwt.auth 并安装 pusher

我检查了我的页面https://imgur.com/a/CveJ6jh 的xsfr 令牌,但我在http://local/broadcasting/auth请求中遇到了 419 错误,并打开了这个 url 的响应,我看到页面已过期消息。
在 app/Events/NewMessage.php 中:

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use App\Message;

class NewMessage
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $message;
    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Message $message)
    {
        $this->message= $message;
    }

    /**
     * Get the channels the event …
Run Code Online (Sandbox Code Playgroud)

broadcast pusher laravel-5

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

vue/cli中router中的base参数有什么用?

我创建了新的 @vue/cli 4.0.5 应用程序,并在文件 src/router/index.js 中看到:

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
Run Code Online (Sandbox Code Playgroud)

我在本地的 .env 中没有任何 BASE_URL 参数,并且在本地主机下使用命令运行:

npm run serve
Run Code Online (Sandbox Code Playgroud)

我在本地工作没问题

我将 apache(ubuntu 16) 下的实时服务器下的应用程序部署到托管根目录中,也没有使用此参数。

它是什么 ?它与 publicPath ( https://cli.vuejs.org/config/#publicPath )相同吗?

vue.js vue-router vuejs2

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

使用 localhost:8080 注册新的 google.com recaptcha 站点引发错误

对于 @vue/cli 4.1.1 应用程序,我尝试注册新的 google.com recaptcha 网站并收到错误:

The following domains are invalid: localhost:8080. A valid domain requires a host and must not include any protocol, path, port, query or fragment.
Run Code Online (Sandbox Code Playgroud)

像往常一样,我在 localhost:8080 端口(默认)下开发 @vue/cli 应用程序。可以用什么方法来挽救呢?

谢谢!

recaptcha vuejs2

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

如何使用 vuejs 3 将路由器添加到 @vue/cli 应用程序?

学习 vuejs3 我用命令创建了新的 @vue/cli 应用程序

vue create myapp
Run Code Online (Sandbox Code Playgroud)

选择 vuejs 3 后,我将 Router 添加到我的项目中,并在我的 src/main.js 中添加了 Router 引用:

import { createApp } from 'vue'

import { createRouter/*, createWebHistory */ } from 'vue-router'
import WelcomeScreen from './pages/WelcomeScreen.vue'
import UsersList from './pages/UsersList.vue'

import App from './App.vue'

const router = createRouter({
  // history: createWebHistory(),
  mode: 'history',
  routes: [
    { path: '/', component: WelcomeScreen },
    { path: '/users', component: UsersList }
  ]
})
const app = createApp(App)
app.use(router)

app.mount('#app')
Run Code Online (Sandbox Code Playgroud)

但在控制台中我看到警告:

"export 'createRouter' was not …
Run Code Online (Sandbox Code Playgroud)

vue-cli vuejs3

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

迁移中的数组到字符串转换错误

在我的 Laravel 5.8 中,我设置了 json 字段:

Schema::create('vote_categories', function (Blueprint $table) { $table->increments('id');

$table->string('meta_description', 255)->nullable();
$table->json('meta_keywords')->nullable();


$table->timestamp('created_at')->useCurrent();
Run Code Online (Sandbox Code Playgroud)

和播种机中的一些初始化数据:

DB::table( 'vote_categories' )->insert([
    'id'                 => 1,
    'name'               => 'Classic literature',
    'slug'               => 'classic-literature',
    'active'             => true,
    'in_subscriptions'   => true,
    'meta_description'   => '',
    'meta_keywords'      => ['Classic literature'],
]);
Run Code Online (Sandbox Code Playgroud)

并在模型中:

class VoteCategory extends MyAppModel
{

    protected $table      = 'vote_categories';
    protected $primaryKey = 'id';
    public $timestamps    = false;

    protected $casts = [
        'meta_keywords' => 'array'
    ];
Run Code Online (Sandbox Code Playgroud)

但是运行迁移时出现错误:

$ php artisan migrate
Migration table created successfully.
... …
Run Code Online (Sandbox Code Playgroud)

migration laravel-5

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

将参数传递给组件时出错

在我的 Laravel Framework 7.6.2 应用程序中阅读如何在此处制作组件 https://laravel.com/docs/7.x/blade#components我收到错误:

Unresolvable dependency resolving [Parameter #0 [ <required> $is_auto_hide ]] in class App\View\Components\AppBackendHeader (View:
Run Code Online (Sandbox Code Playgroud)

对于我在组件 app/View/Components/AppBackendHeader.php 中定义的第一个 var :

<?php

namespace App\View\Components;

use Illuminate\View\Component;

class AppBackendHeader extends Component
{

    public $is_auto_hide;

    public $message;
    public function __construct($is_auto_hide, $message)
    {
        $this->is_auto_hide = $is_auto_hide;
        $this->message = $message;
    }
    public function render()
    {
        return view('components.app-backend-header');
    }
}


calling this component from blade page : 
        <x-app-backend-header is_auto_hide="true" message="message 1234" />


In app/Providers/AppServiceProvider.php I added line :

    public function boot() …
Run Code Online (Sandbox Code Playgroud)

laravel

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