2016-02-18 32 views
0

什麼是從數據庫中檢索數據UND在格式化他們算賬的好方法數據:Laravel從數據庫中檢索和格式

現在我有這樣的表演方法在我的控制器:

public function showProduct($productID = 0) 
{ 
    $product = Product::find($productID); 
    $companies = Companies::where('active', '=', 1)->orderBy('sort', 'Asc')->get(); 

    return view('product.show', ['product' => $product, 'companies' => $companies]); 
} 

,並在我的show.blade.php檢索到的數據是這樣的:

@extends('layouts.master') 

@section('content') 
    {{ $product }} 
@endsection 

,但它只是表明我在陣列中的數據,我怎樣才能使這個更漂亮像創建表和排序....

回答

0

例如:

@extends('layouts.master') 

@section('content') 
    <h1>{{$product->title}}</h1> 
    <p>{{$product->text}}</p> 
@endsection 
+0

感謝幫我 –