Laravel 5.4 - 控制器逻辑,用于显示博客文章的状态

new to Laravel, and just having this problem that I couldn't figure it out.

I have a post controller set up to query out all blog posts. On the database, I have a integer column and named as "status", 0 as inactive, 1 as active. The question is how and where to place the logic to check whetherthe status is 0 or 1, and show "inactive" or "active" in the view. Thanks in advance.

public function index()
{

    $posts = Post::where('user_id', 1)->orderBy('id', 'desc')->paginate(5);

    return view('post.index')->withPosts($posts);
}

Here is the view

<table class="table"> 
        <tr>
            <th>Date Created</th>
            <th>Title</th>
            <th>Status</th>
        </tr>
    @foreach ($posts as $post)
        <tr>
            <td>{{datePretty($post->created_at) }}</td>
            <td><a href="/posts/{{ $post->id }}">{{ $post->title }}</a></td>
            <td></td>
        </tr>


        <br>

    @endforeach
</table>

you can have that logic inside your blade template:

@foreach ($posts as $post)
    <tr>
        <td>{{datePretty($post->created_at) }}</td>
        <td><a href="/posts/{{ $post->id }}">{{ $post->title }}</a></td>
        <td>@if($post->status) active @else inactive @endif</td>
    </tr>


    <br>

@endforeach