Laravel 5 从laravel中的数据库中检索

Laravel 5 从laravel中的数据库中检索,laravel-5,Laravel 5,我试图使用laravel framework从localhost db检索列,但出现以下错误: cd582248476d4ab73365f604ce058f390fc48144.php行中出现错误异常 10:未定义变量:交付(视图: C:\xampp\htdocs\testt\resources\views\Delivered.blade.php) @extends('layouts.master')) @章节(“标题”) 药房 @端部 @节(“内容”) 已交付订单的详细信息 @foreach(

我试图使用laravel framework从localhost db检索列,但出现以下错误:

cd582248476d4ab73365f604ce058f390fc48144.php行中出现错误异常 10:未定义变量:交付(视图: C:\xampp\htdocs\testt\resources\views\Delivered.blade.php)

@extends('layouts.master'))
@章节(“标题”)
药房
@端部
@节(“内容”)
已交付订单的详细信息
@foreach($Delivery作为$Delivery交付){
echo$Delivery->Address;
}
@endforeach
}
@端部

您不需要在
all()
之后使用
->get()

此外,最好对集合和项目使用不同的变量

对于Blade中的“快速提示”部分,您可以使用:

@section('title', 'Pharmacies')
而不是这个

@section('title')
    Pharmacies
@endsection
以下是您的更新代码:
@extends('layouts.master'))
@章节(“标题”、“药房”)
@节(“内容”)
已交付订单的详细信息
@foreach($交付为$交付)
{{$delivery->Address}
@endforeach
@端部


Replace
echo$Delivery->Address
{{$delivery->Address}
编写。
@section('title')
    Pharmacies
@endsection
@extends('layouts.master')

@section('title', 'Pharmacies')

@section('content')
<section class="row posts">
    <div class="col-md-6 col-md-offset-3">
        <header><h3>Details of Delivered Orders</h3></header>
        @foreach ($deliveries as $delivery)
           {{ $delivery->Address }}
        @endforeach
    </div>
</section>
@endsection
<?php
namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Collection;

class DeliveredController extends Controller
{
    public function getDeliveredPage()
    {
        return view('Delivered');
    }

    public function index()
    {
        $deliveries = Delivery::all();

        return view('Delivered', compact('deliveries'));
    }