samedi 28 avril 2018

Condition in my view

i have a another problem in my view This condition @if dont work :

@if( ! empty($news))
    <div class="container">
        <div class="row justify-content-center">
            <h1 style="color:#fff;text-decoration:underline;margin-left:20px;">Any News !</h1>
        </div>
    </div>
@else
    <h1 style="color:#fff;text-decoration:underline;margin-left:20px;">Last News :</h1>
    <div class="col-md-8">
        <div class="row">
            @foreach($news as $new)
                <div class="card" style="width: 18rem; margin-left:30px;">
                    <img class="card-img-top img-responsive" style="height:160px;" src="img/.jpg" alt="Card-news-">
                    <div class="card-body">
                        <h5 class="card-title"></h5>
                        <p class="card-text">
                            @if(strlen($new['content'])>150)
                                ...
                            @else
                                
                            @endif
                        </p>
                        <a href="#" class="btn btn-primary">More.</a>
                        @if(@admin)
                            <a href="" class="btn btn-warning">Edit</a></td>
                            <form action="" method="post">
                                @csrf
                                <input name="_method" type="hidden" value="DELETE">
                                <button class="btn btn-danger" type="submit">Delete</button>
                            </form>
                        @endif
                    </div>
                </div>
            @endforeach
        </div>
    </div>
@endif

i would to show Any News ! when don't have news and Last News ! when i have news Can you help me ^^ ?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Kmx7uk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire