我有一个视图,我想显示数据库中的记录
但是他告诉我这个错误:
6361dda302a0f162671ee5b36a4abe93第26行中的FatalErrorException:语法错误,意外的'endif'(T_ENDIF)
welcome.blade.php:
@extends('layouts.master')
@section('title')
Welcom!
@endsection
@section('content')
<div class="container">
<div class="row">
<legend>List</legend>
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>ID</th>
<th>lastaname</th>
<th>firstname</th>
<th>phone</th>
</tr>
</thead>
<tbody>
@if (count($customers) > 0 )
@foreach($customers->all() as $customer)
<tr>
<td>{{ $customer->id }}</td>
<td>{{ $customer->lastaname }}</td>
<td>{{ $customer->firstname }}</td>
<td>{{ $customer->phone }}</td>
</tr>
@enforeach
@endif
</tbody>
</table>
</div>
</div>
@endsection
Run Code Online (Sandbox Code Playgroud)
CreatesController:
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Customer;
class CreatesController extends Controller {
public function …Run Code Online (Sandbox Code Playgroud) 我有两个数组,第一个数组是由属性组成的文章数组,第二个数组由第一个数组的元素articles_id组成,如果articles.id =,我想将第一个数组与new_array_articles_sub_categories中的第二个数组合并= subcategories.article_id
articles = [
{
id: 1,
title: xxx,
description: desc1
},
{
id: 2,
title: yyy,
description: desc2
}
]
subcategories = [
{
id: 1,
name: xxx,
article_id: 1
},
{
id: 2,
name: yyy,
article_id: 1
}
]
new_array_articles_sub_categories = [
{
id: 1,
title: xxx,
description: desc1
subcategories: [
[0] : [
id: 1,
name: xxx,
]
[1] : [
id: 2,
name: yyy,
]
]
},
{
id: 2,
title: yyy,
description: desc2, …Run Code Online (Sandbox Code Playgroud)