@extends('layouts.app')
<style type="text/css">
.avatar{
border-radius: 100%;
max-width:100px;
}
</style>
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-md-offset">
@if(count($errors) > 0)
@foreach($errors->all() as $error)
<div class="alert alert-danger">{{$error}}</div>
@endforeach
@endif
<div class="card-body">
@if (session('response'))
<div class="alert alert-success" role="alert">
{{ session('response') }}
</div>
@endif
<div class="card">
<div class="card-header">Dashboard</div>
<div class="panel-body">
<div class="col-md-4">
@if(!empty($profile))
<img src="{{ $profile->profile_pic}}" class="avatar" alt="" >
@else
<img src="{{ url('images/avatar.jpg')}}" class="avatar" alt="" >
@endif
@if(!empty($profile))
<p class="lead">{{ $profile->name}}</p>
@else
<p></p>
@endif
@if(!empty($profile))
<p class="lead">{{ $profile->designation}}</p>
@else
<p></p>
@endif
</div>
<div class="group-home-slideshow">
<div class="home-slideshow-inner col-sm-12">
<div class="home-slideshow">
<div id="home_main-slider" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
@foreach($posts as $post)
<li data-target="#home_main-slider" data-slide-to="{{ $loop->index }}" class="{{ $loop->first ? 'active' : '' }}"></li>
@endforeach
</ol>
<div class="carousel-inner">
@foreach($posts as $post)
<div class="item image {{ $loop->first ? ' active' : '' }}">
<img src="{{url('images')}}/{{$slider->photo}}" alt="slider" title="Image Slideshow">
<div class="slideshow-caption position-right">
<div class="slide-caption">
<div class="group-caption">
<div class="content">
@if(count($posts) >0)
@foreach($posts->all() as $post)
<h4>{{$post->post_title}}</h4>
<img src="{{$post->post_image}}" alt="">
<p>{{ substr($post->post_body , 0 , 150)}}</p>
</div>
<ul class="nav nav-pills">
<li role="presentation">
<a href='{{ url("/view/{$post->id}") }}'>
<span class="fa fa-eye"> View</span>
</a>
</li>
<li role="presentation">
<a href='{{ url("/edit/{$post->id}") }}'>
<span class="fa fa-edit"> Edit</span>
</a>
</li>
<li role="presentation">
<a href='{{ url("/delete/{$post->id}") }}'>
<span class="fa fa-trash-alt"> Delete</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
@endforeach
</div>
<a class="left carousel-control" href="#home_main-slider" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#home_main-slider" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
</div>
</div>
</div>
@endsection
我在消息中抛出了ErrorException错误
“语法错误,文件意外结束,期望elseif(T_ELSEIF)或 else(T_ELSE)或endif(T_ENDIF)(查看: C:\ xampp \ htdocs \ blog \ resources \ views \ home.blade.php)“
Stacktrace:
C中的0 Symfony \ Component \ Debug \ Exception \ FatalThrowableError:\ xampp \ htdocs \ blog \ storage \ framework \ views \ 78e09b18337fc09824b99eedafb8d772ac9d9d5d.php:125
答案 0 :(得分:0)
您尚未关闭一个if
和一个foreach
:
<div class="content">
@if(count($posts) >0)
@foreach($posts->all() as $post)
<h4>{{$post->post_title}}</h4>
<img src="{{$post->post_image}}" alt="">
<p>{{ substr($post->post_body , 0 , 150)}}</p>
@endforeach
@endif
</div>