【发布时间】:2020-05-02 12:33:04
【问题描述】:
我正在处理 laravel 项目,现在它给了我这个错误:使用未定义的常量类别 - 假定为“类别”(这将在 PHP 的未来版本中引发错误) 它指向26号车道 即使我声明了变量“类别”,任何想法如何解决它?谢谢你
@extends('layouts.app')
@section('content')
<div class="card">
<div class="card-body">
<table class="table table-hover">
<thead>
<th>
Category Name
</th>
<th>
Editing
</th>
<th>
Deleting
</th>
</thead>
<tbody>
@foreach($categories as $category)
<tr>
<td>{{$category->name}}</td>
<td>
<a href="{{ route(category.edit, ['id=>$category->id']) }}" class="btn btn-light btn-xs">
Edit
</a>
</td>
<td>
<a href="{{route(category.delete, ['id => $category->id'])}}" class="btn btn-danger btn-xs">
Delete
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop
【问题讨论】:
-
请分享你的控制器和路由