私は、データベースからデータを出力悩みを持っている、それは画像やHTMLファイルのファイルの場所ですが、私は取得していますエラーは次のとおりです。は、画像とhtmlファイルを表示することはできません - laravel
未定義のプロパティ:雄弁\コレクション\ \データベースを照らす:: $の画像(閲覧:C:\ xamppの\ htdocsに\ fyproject \リソース\ビュー\レイアウト\ homepage.blade.php)
マイコード:
ビュー:
@extends('layouts.master')
@section('title', 'Best programmer ever')
@section('content')
<h1>Home Page</h1>
@endsection
@section('template')
<!-- <img src="{{asset('img/1.jpg')}}">-->
@foreach ($templates as $template)
{{$templates->image}}
{{$templates->file}}
@endforeach
@show
コントローラー:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Template;
class BuilderController extends Controller
{
function templates()
{
$templates = Template::all();
return view('layouts/homepage', ['templates' => $templates]);
}
}
モデル:私はどんな関係がdefinnedしていないこれが唯一のテーブルであるデータベース
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Template extends Model
{
//
}
私が間違って何をやっているのですか?
の神私のああを使用実際の画像/ファイルはテキストではなく表示されるようになります。 –
img src = "{{asset( 'img /'。$ template-> image)} –
画像であるというアイコンが表示されます。表示されない –