我在laravel做项目.在我的项目中有两个表类别和子类别.子类别表将categoryid作为外键.
subcategoryModel.php具有以下功能
public function category(){
return $this->belongsTo('App\Category');
}
Run Code Online (Sandbox Code Playgroud)
在我的刀片文件中,我使用类别对象显示我的子类别,如下所示,
blade.php
<div class="col-sm-6 col-align-left">
@foreach($category as $c)
<div class="form-group clearfix">
@if($c->subcategories->count() > 0)
<h4><b>Subcategories: </b></h4>
<div class="form-group clearfix">
@foreach($c->subcategories as $subcategory)
<h4>{{$subcategory->subcategoryname}}</h4>
@endforeach
</div>
@endif
<h4><a href="{{ url('subcategories/'.$c->categoryid.'') }}" class = "btn btn-primary">Add Subcategories</a></h4>
</div>
@endforeach
</div>
Run Code Online (Sandbox Code Playgroud)
这显示正确的数据,但现在我想按照更新/创建的顺序显示数据.有没有办法按要求显示数据?我想在刀片文件中加入一些东西.这该怎么做?请给出建议.
我正在 Laravel 中做项目。我正在使用 plivo api 发送短信。为此,我遵循了在
https://www.plivo.com/docs/getting-started/send-a-single-sms/。
但是当我尝试运行我的 php 文件时,我收到错误消息
“致命错误:未捕获的异常 'GuzzleHttp\Exception\RequestException' 带有消息 'cURL 错误 60:SSL 证书问题:证书链中的自签名证书(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors。 html)' 在 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 堆栈跟踪:#0 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler \CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory .php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 G:\Xampp\htdocs \plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp \Handler\CurlFactory)) #3 G:\Xampp\htdocs\plivoTria in G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php 在线 187"。
我的 php 文件看起来像,
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "xxxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$p = new RestAPI($auth_id, $auth_token);
// Set message parameters
$params = array(
'src' => 'xxxxxxxxxxx',
'dst' => '91xxxxxxxxxx',
'text' …Run Code Online (Sandbox Code Playgroud) 我正在用 laravel 做项目。我已将数据表实现为,
刀片.php
<table id="userprofaneword-table" class="table table-condensed table-hover">
<thead>
<tr>
<th>{{ trans('labels.backend.report.profaneword.table.id') }}</th>
<th>{{ trans('labels.backend.report.profaneword.table.user') }}</th>
</tr>
</thead>
<tbody>
@foreach($profaneData as $profaneUser)
<tr>
<td>{{$profaneUser->user->id ?? '---'}}</td>
<td>{{$profaneUser->user->first_name ?? '---'}}
</td>
</tr>
@endforeach
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
脚本
{{ Html::script("https://cdn.datatables.net/v/bs/dt-1.10.15/datatables.min.js") }}
{{ Html::script("js/backend/plugin/datatables/dataTables-extend.js") }}
{{ Html::script("https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js") }}
{{ Html::script("https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js") }}
{{ Html::script("https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js") }}
<script>
$(function () {
$('#userprofaneword-table').DataTable({
"dom": "Bfrtip",
"lengthChange": true,
"autoWidth": true,
"searching": true,
"order": [[ 0, "desc" ]],
"language": {
"searchPlaceholder": "Search",
},
"buttons": [
{
"extend": 'excelHtml5',
"text": …Run Code Online (Sandbox Code Playgroud)