我正在使用Laravel 5.7,但此代码中出现错误。
CustomersController.php
<?php
use App\Customers;
use Illuminate\Http\Request;
class CustomersController extends Controller
{
public function list()
{
$customers = Customer::all();
return view('internals.costumers.blade.php',[
'customers' => $customers
]);
}
}
internals.costumers.blade.php
@extends('layout')
@section('content')
<h1>This is Customers</h1>
<ul>
@foreach ($customers as $customer)
<li>{{ $customer->name }}</li>
@endforeach
</ul>
@endsection
答案 0 :(得分:0)
请在控制器中定义名称空间,并在视图帮助器中仅传递带参数的刀片文件名称,而不是扩展名.blade.php