我希望用户上传图片并返回同一页面,但我只能有一件事,无论是网址还是文件
这是我无法弄清楚的代码行
{!! Form::open(['url' => 'home',files =>true]) !!}
这是home.blade.php
的全班@extends('layouts.app')
@section('content')
<div class="container">
@include('flash::message')
<div class="row">
<div class="col-md-8 col-md-offset-2">
{!! Form::open(['url' => 'home',files =>true]) !!}
<div class="panel panel-default">
<div class="panel-heading">Add a new status</div>
<div class="panel-body">
<div class="form-group">
<label>Write a new status</label>
<textarea class="form-control" name="status-text" id="status-text"></textarea>
</div>
</div>
<div class="panel-footer clearfix">
<div class="row">
<div class="col-md-6=">
<label for="file upload" class="custom-file-upload">
<i class="fa fa-image"></i>
<input id="file-upload" name="status_image_upload" type="file"/>
</label>
</div>
<div class="col-md-6=">
<button class="btn btn-info pull-right btn-sm"><i class="fa fa-plus"></i>Add status</button>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
@foreach($top_15_posts as $status)
{!!
view('layouts.app-internal.user-status-layout',[
'status' => $status,
'user' => \App\Eloquent\User::find($status->user_id),
'comments' => \App\Eloquent\StatusComments::where('status_id',$status->id)->orderBy('id','DESC')->get(),
'comment_count' => \App\Eloquent\StatusComments::where('status_id',$status->id)->count(),
'like_count' => \App\Eloquent\StatusLikes::where('status_id',$status->id)->count()
])
!!}
@endforeach
</div>
</div>
</div>
@endsection
答案 0 :(得分:0)
可能是缓存错误,请尝试运行:
php artisan view:clear
这样就可以避免在视图中加载上次更改
答案 1 :(得分:0)
这是一个简单的错误,我简单地在home.blade.php类的开头取出@include('flash::message')
。