我在 Laravel mix 中的 URL 处理方面遇到问题。
这是我的 app.css
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
/*---------- import LightGallery from node_modules ----------*/
@import 'lightgallery.js';
/*---------- my styles for thumbnails ----------*/
@import 'includes/thumbnails';
Run Code Online (Sandbox Code Playgroud)
这是我的 webpack.mix.js
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.scripts([
'public/js/app.js',
'resources/js/includes/script.js'
], 'public/js/app.js')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
require('postcss-extend'),
require('postcss-nested'),
require('autoprefixer'),
]);
Run Code Online (Sandbox Code Playgroud)
包.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll", …Run Code Online (Sandbox Code Playgroud) 当我在 Laravel 7.2.0 中执行这段代码时
$news = NewsPost::select('title','slug','category_id', 'image', 'fulltext', 'created_at')->with('category:id,title,slug')->orderBy('created_at', 'desc')->simplePaginate(10);
Run Code Online (Sandbox Code Playgroud)
我页面上有 3 个查询
select `title`, `slug`, `category_id`, `image`, `fulltext`, `created_at` from `news_posts` where `news_posts`.`deleted_at` is null order by `created_at` desc limit 11 offset 0
select `id`, `title`, `slug` from `news_categories` where `news_categories`.`id` in (2, 4)
select * from `news_categories` where 0 = 1
Run Code Online (Sandbox Code Playgroud)
我无法理解上次查询的目的是什么以及意味着什么where 0 = 1
我有集成了Vue.js的Laravel 5.3项目,我想CSRF-TOKEN在表单中使用。表单html代码位于Vue组件文件中
resources / assets / js / bootstrap.js
我有这个:
Vue.http.interceptors.push((request, next) => {
request.headers.set('X-CSRF-TOKEN', MyApp.csrfToken);
next();
});
Run Code Online (Sandbox Code Playgroud)
然后我有主Vue文件/resources/assets/js/app.js:
require('./bootstrap');
Vue.component('callbackwindow', require('./components/callbackwindow.vue'));
const app = new Vue({
el: '#app',
data: { },
});
Run Code Online (Sandbox Code Playgroud)
然后在Vue文件中,我需要使用它csrf_field,但是我不知道如何到达那里,因为标准php csrf_field()不在Vue组件中呈现,并且我也不知道如何导入MyApp.csrfToken。
<template>
<div class="modal fade" >
<form @submit.prevent="submitForm" name="callback" method="POST" action="/" role="form" class="form-horizontal" enctype="multipart/form-data">
{!! csrf_field() !!}
...form code here...
</form>
</div>
</template>
<script>
export default { }
</script>
Run Code Online (Sandbox Code Playgroud)
是否可以MyApp.csrfToken从此处将变量导入我的Vue模板文件?
在我的新Debian 9中无法获得静态IP.
在我的etc/network/interfaces中,我有以下内容
# This file describes the network interfaces available on your system
# and how to activate them
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.88.10
netmask 255.255.255.0
gateway 192.168.88.1 // this is my router ip
network 192.168.88.0 // this is I don't know why, but I saw it in most of instructions
broadcast 192.168.88.255
dns-nameservers 192.168.88.1
Run Code Online (Sandbox Code Playgroud)
然后我这样做 …
laravel ×2
csrf ×1
debian ×1
eloquent ×1
laravel-5.3 ×1
laravel-mix ×1
php ×1
vue.js ×1
vuejs2 ×1