以下术语是什么意思?
目前有各种各样的云服务,例如亚马逊的EC2和AWS,Apache Hadoop,Microsoft Azure等等.每个属于哪个类别,为什么?
我需要在vue.js文件中插入注释以供将来引用,但是我没有在文档中找到你如何做到这一点.
我已经试过//,/**/,{{-- --}},和{# #},但他们都不工作.
我正在使用Laravel的刀片.所以这是sample_file.vue:
<template>
<div class="media">
<like-button :post="post" v-if="post.likedByCurrentUser === false && "></like-button> {{--I want to comment this but I get an error from the gulp watch: post.canBeLikedByCurrentUser === true--}}
<div class="media-left">
<a href="#">
<img class="media-object" v-bind:src="post.user.avatar" v-bind:title="post.user.name + ' image from Gravatar'">
</a>
</div>
<div class="media-body">
<strong>{{ post.user.name }}</strong>
<p>{{post.body}}</p>
<p>{{post.likeCount}} {{ pluralize('like', post.likeCount) }}</p>
</div>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
有谁知道如何插入评论和/或如何评论代码片段?
我不知道错误是什么,到目前为止,我正在测试控制台日志,以便在选择文件(上传)后检查更改.
当我运行时$ npm run watch,我收到以下错误:
"Webpack正在观看文件......
95%的排放量
错误
19:42:29 无法编译1个错误./resources/assets/js/components/File.vue中的错误
(发出的值而不是Error的实例)Vue模板语法错误:
组件模板应该只包含一个根元素.如果您在多个元素上使用v-if,请使用v-else-if来链接它们.
@ ./resources/assets/js/components/AvatarUpload.vue 5:2-181 @ ./resources/assets/js/app.js @ multi ./resources/assets/js/app.js ./resources/assets/上海社会科学院/ app.scss"
我的File.vue是
<template>
<div class="form-group">
<label for="avatar" class="control-label">Avatar</label>
<input type="file" v-on:change="fileChange" id="avatar">
<div class="help-block">
Help block here updated 4 ...
</div>
</div>
<div class="col-md-6">
<input type="hidden" name="avatar_id">
<img class="avatar" title="Current avatar">
</div>
</template>
<script>
export default{
methods: {
fileChange(){
console.log('Test of file input change')
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
关于如何解决这个问题的任何想法?究竟是什么错误?
我已经成功地将Eloquent用作Slim Framework 2中的独立包.
但现在我想使用Illuminate\Support\Facades\DB,因为我需要通过从2个表中获取信息并使用数据库中的Left Join和Counter来显示一些统计信息,如下所示:
use Illuminate\Support\Facades\DB;
$projectsbyarea = DB::table('projects AS p')
->select(DB::raw('DISTINCT a.area, COUNT(a.area) AS Quantity'))
->leftJoin('areas AS a','p.area_id','=','a.id')
->where('p.status','in_process')
->where('a.area','<>','NULL')
->orderBy('p.area_id');
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Type: RuntimeException
Message: A facade root has not been set.
File: ...\vendor\illuminate\support\Facades\Facade.php
Line: 206
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
到目前为止,我已经发现,在此链接中我需要创建一个新的应用程序容器,然后将其绑定到Facade.但我还没有找到如何让它发挥作用.
这就是我开始其余的Eloquent和工作正常的方式:
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule();
$capsule->addConnection([
'my' => $app->config->get('settings'),
/* more settings ...*/
]);
/*booting Eloquent*/
$capsule->bootEloquent();
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
固定
为@ user5972059说,我不得不在$capsule->setAsGlobal();//This is important to make work the DB (Capsule)上面添加$capsule->bootEloquent();
然后,查询执行如下:
use …Run Code Online (Sandbox Code Playgroud) 在其他问题中,我找不到适合我的正确答案.这就是httpd-xampp.conf最初的样子:
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)
如果我想添加另外的IP地址,我该Require local怎么办?
例如,下面Require local我尝试了以下内容:
allow from xxx.xxx.xxx.xx
Run Code Online (Sandbox Code Playgroud)
也就是说:
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Require local
allow from xxx.xxx.xxx.xx
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)
但它仍然阻止了对外部IP的访问.
我该如何解决?如何添加更多IP地址以允许他们访问?
我在Windows环境下使用XAMPP 5.6.3.
我有这种形式,用户只应在文本区域内键入文本:
<form action="#" v-on:submit="postStatus">{{-- Name of the method in Vue.js --}}
<div class="form-group">
<textarea class="form-control" rows="5" maxlength="140" autofocus placeholder="What are you upto?" required v-model="post"></textarea>
</div>
<input type="submit" value="Post" class="form-control btn btn-info">
{{ csrf_field() }}
</form>
Run Code Online (Sandbox Code Playgroud)
然后,我有这个脚本代码,我将vue.js与ajax一起使用,以便将该文本传递给控制器并最终将其保存到数据库中:
//when we actually submit the form, we want to catch the action
new Vue({
el : '#timeline',
data : {
post : '',
},
http : {
headers: {
'X-CSRF-Token': $('meta[name=_token]').attr('content')
}
},
methods : {
postStatus : function (e) {
e.preventDefault();
console.log('Posted: '+this.post+ …Run Code Online (Sandbox Code Playgroud) 我有这个vue函数,其中基本上有两种方法.第一个postStatus用于在用户单击保存按钮后保存帖子,另一个getPosts用于从数据库中检索该用户的所有先前帖子.
这是vue.js,其中有一个对控制器的ajax调用(在Laravel 5.3中)
$(document).ready(function () {
var csrf_token = $('meta[name="csrf-token"]').attr('content');
/*Event handling within vue*/
//when we actually submit the form, we want to catch the action
new Vue({
el : '#timeline',
data : {
post : '',
posts : [],
token : csrf_token,
limit : 20,
},
methods : {
postStatus : function (e) {
e.preventDefault();
//console.log('Posted: '+this.post+ '. Token: '+this.token);
var request = $.ajax({
url : '/posts',
method : "POST",
dataType : 'json',
data : …Run Code Online (Sandbox Code Playgroud) 从文档中,我使用该->only()方法测试了以下示例
$collection = collect(['product_id' => 1, 'name' => 'Desk', 'price' => 100, 'discount' => false]);
$filtered = $collection->only(['product_id', 'name']);
$filtered->all();
// ['product_id' => 1, 'name' => 'Desk']
Run Code Online (Sandbox Code Playgroud)
它确实有效.
但是,当我将该方法应用于我从数据库(Model)获取的集合时,
$myCollection = MyModel::orderBy('id','desc')->paginate(5);
$filtered=$myCollection->only(['id']);
dd(filtered);
Run Code Online (Sandbox Code Playgroud)
返回的集合是空的!
Collection {#199 ?
#items: []
}
Run Code Online (Sandbox Code Playgroud)
如果我dd($myCollection);从数据库中获取了集合,它确实充满了追加,属性等等.数据在表刀片视图中正确显示.
但是,如果我申请任一->only()或->except()到$myCollection方法...返回的集合是空的.
例如,这是集合的一部分,我只想显示id属性,例如,或者更多但不是全部:
LengthAwarePaginator {#218 ?
#total: 3041
#lastPage: 609
#items: Collection {#219 ?
#items: array:5 [?
0 => MyModel {#220 ?
#dates: array:1 …Run Code Online (Sandbox Code Playgroud) 我有一段代码想要重用。我读过这篇Laravel 清洁代码文章和另一篇Laravel 服务模式文章,其中我意识到可以通过使用服务类在应用程序的多个位置重用代码。
在本例中,我MyService在新文件夹中创建了一个新类app/Services/MyService。
namespace App\Services;
class MyService
{
public function reuse_code($param){
return void;
}
}
Run Code Online (Sandbox Code Playgroud)
当我想通过 Livewire 类组件内的构造函数调用该类时,问题就出现了,如下所示:
<?php
namespace App\Http\Livewire;
use App\Services\MyService;
use Livewire\Component;
use Livewire\WithPagination;
class LivewireTable extends Component
{
use WithPagination;
private $myClassService;
public function __construct(MyService $myService)
{
$this->myClassService = $myService;
}
public function render()
{
$foo = $this->myClassService->reuse_code($param);
return view('my.view',compact('foo'));
}
}
Run Code Online (Sandbox Code Playgroud)
显示的错误如下:
传递给 App\Http\Livewire\LivewireTable::__construct() 的参数 1 必须是 App\Services\MyService 的实例,给定字符串
(但是,如果我使用一个特质,就没有问题。但我担心我的特质会与以前的经验发生冲突)
我如何解决它?我缺少什么?
mailhog我在向新用户发送电子邮件以创建密码时遇到错误。
错误:
Connection could not be established with host mailhog :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known.
Run Code Online (Sandbox Code Playgroud)
.env 配置:
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="dev@example.com"
MAIL_FROM_NAME="${APP_NAME}"
Run Code Online (Sandbox Code Playgroud) laravel ×5
vue.js ×4
javascript ×2
laravel-5.3 ×2
ajax ×1
apache ×1
blade ×1
cloud ×1
collections ×1
eloquent ×1
httpd.conf ×1
iaas ×1
jquery ×1
mailhog ×1
node.js ×1
paas ×1
saas ×1
xampp ×1