Article From:https://segmentfault.com/q/1010000012046130
Question:


The following diagram is a print of the $post result


@extends(“layout.main”)

@section(“content”)

<div class="col-sm-8 blog-main">
    <div class="blog-post">
        <div style="display:inline-flex">
                <h2 class="blog-post-title">{{$post->title}}</h2>
              
                <a style="margin: auto"  href="/posts/{{$post->id}}/edit">
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                </a>
                
               
                <a style="margin: auto"  href="/posts/{{$post->id}}/delete">
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                </a>
                
        </div>

        <p class="blog-post-meta">{{$post->created_at->toFormattedDateString()}} by <a href="#">{{$post->user->name}}</a></p>

        <p>{!! $post->content !!}</p>
        <div>
          

        </div>
    </div>

    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading">Review < /div><! - - List group -->< UL class= "list-group" >@foreach ($post-> comments as $comment)< Li class= "list-group-item" >< h5> {{$comment-> created_at}} by {{$comment-> user-> name}}< /h5>< div>{{$comment-> content}}< /div>< /li>@endforeach< /ul>< /div>< div class= "panelPanel-default "><! -- Default panel contents -->< div class= "panel-headinG "> comment on < /div><! - - List group -->< UL class= "list-group" >< form action= "/posts/comment" method= "post" >{{csrf_field ())]]< input type= "hidden" name= "post_id" value= "{{$post-> id}}" />< LiClass= "list-group-item" >< textarea name= "content" class= "form-control" rowS= "10" > < /textarea>< button class= "BTN btn-default" type= "submit" >Submit < /button>< /li>< /form>< /ul></div>< /div> <! -- /.blog-main -->

@endsection

Answer 0:

Well, do you want to take perPage – Direct

$post->getPerPage();

The second problem is the use of a non object or object is empty. It is recommended to paste the code light. = =

Answer 1:

Agree upstairs, it is suggested that the landlord put the blade part together. It is still a waste of time to guess.

Leave a Reply

Your email address will not be published. Required fields are marked *