我使用Angular-Chart.js(AngularJS Chart.js版本)来创建条形图.图表正在使用除颜色之外的选项.
即使我设置它们,它在文档中指出,它们仍然是灰色的.
<div class="graph-display" ng-controller="chartController">
<canvas class="chart chart-bar"
data="bilans.data"
labels="bilans.labels"
series="bilans.series"
options="{
scaleShowHorizontalLines: true,
scaleShowVerticalLines: false,
tooltipTemplate: '<%= value %> $',
responsive: true
}"
colours="{
fillColor: 'rgba(47, 132, 71, 0.8)',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}"
></canvas>
</div>
Run Code Online (Sandbox Code Playgroud)
实际上,选项是有效的,但颜色不是.难道我做错了什么?
我正在 Laravel 5 应用程序中工作。我尝试保存项目的评论,但不知道如何获取$comment->project_id值。
这是我的简化控制器
public function store( CommentsFormRequest $request )
{
$comment = new Note;
$comment->message = Input::get('message');
$comment->project_id = $note->project->id;
$comment->user_id = Auth::id();
$comment->save();
return Redirect::back();
}
Run Code Online (Sandbox Code Playgroud)
这是我的简化表格
{!! Form::open(array('route' => 'notes.store')) !!}
{!! Form::textarea('message', '', array('placeholder'=>'Message')) !!}
{!! Form::submit('Ajouter la note') !!}
{!! Form::close() !!}
Run Code Online (Sandbox Code Playgroud)
当我尝试保存时,出现以下错误:
Trying to get property of non-object
Run Code Online (Sandbox Code Playgroud)
我猜这是因为它试图获取新对象的 sollicitation_id 为空。我应该如何获取当前的project_id值?
更新
结论:我使用了隐藏字段并遵循了 @tommy 的建议。我的控制器现在使用
$note->project_id = $request->input('project_id');
Run Code Online (Sandbox Code Playgroud)
我的隐藏字段是
{!! Form::hidden('project_id', $project->id ) !!}
Run Code Online (Sandbox Code Playgroud) 我正在尝试返回特定列,包括reviews_count 列。
这是未优化的查询(工作):
Model::withCount('reviews')->get();
Run Code Online (Sandbox Code Playgroud)
这是我试图实现的目标(不起作用):
Model::withCount('reviews')->select('id','name','reviews_count')->get();
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能使用 eloquent 在选择查询中包含reviews_count?
我在一个网站上工作,我得到了一个在Internet Explorer 6中不起作用的javascript函数.我知道
document.querySelector(selector)
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能让它在IE6中运行?
(我不会试图让它变得有趣;))
我尝试在Laravel中返回单个对象而不是集合.实际上这段代码有效:
public function show($id)
{
$facture = Facture::where('id', '=', $id)->with('items')->with('client')->get();
return Response::json($facture[0]);
}
Run Code Online (Sandbox Code Playgroud)
但我想知道这是否是正确的方法呢?
我使用filesystems.php文件来配置我的S3。当我尝试将内容放入存储桶时,出现以下错误:
Encountered a permanent redirect while requesting https://s3-us-west-2.amazonaws.com/MYBUCKET... Are you sure you are using the correct region for this bucket?
Run Code Online (Sandbox Code Playgroud)
然后,我尝试访问该网址,然后收到以下消息:
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
Run Code Online (Sandbox Code Playgroud)
在同一页面上,我得到:
<Endpoint>s3.amazonaws.com</Endpoint>
Run Code Online (Sandbox Code Playgroud)
然后如何从Laravel生成的URL中删除该区域?
我尝试做的是:
我尝试将布尔值传递给我的视图以检查其是否正确。如果将其设置为true,我想添加一个类。我用Laravel。实际上,这是我的情况:
这是我的代码:
index.blade.php
@foreach($finances as $finance)
@if ($finance->depense = 1)
<tr class="red">
@elseif ($finance->depense = 0)
<tr>
@endif
<td><a href="{{ URL::to('finances/' . $finance->id) }}">{{$finance->description}}</a></td>
<td>{{ $finance->depense }}</td>
<td>{{ $finance->prix }}</td>
<td>{{ $finance->tps }}</td>
<td>{{ $finance->tvq }}</td>
<td>{{ $finance->grandtotal }}</td>
</tr>
@endforeach
Run Code Online (Sandbox Code Playgroud)
FinancesController.php
public function index()
{
$finances = Finance::all();
return View::make('finances.index')->withFinances($finances);
}
Run Code Online (Sandbox Code Playgroud)
怎么了?