Skip to content

Commit

Permalink
added user article
Browse files Browse the repository at this point in the history
  • Loading branch information
sawirricardo committed May 18, 2021
1 parent 0db0716 commit 5034e4b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

> ### [YOUR_FRAMEWORK] codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.

### [Demo](https://github.com/gothinkster/realworld)&nbsp;&nbsp;&nbsp;&nbsp;[RealWorld](https://github.com/gothinkster/realworld)


This codebase was created to demonstrate a fully fledged fullstack application built with **[YOUR_FRAMEWORK]** including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the **[YOUR_FRAMEWORK]** community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo.


# How it works

> Describe the general architecture of your app here
## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Livewire/Front/User/Show.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
class Show extends Component
{
public $user;
public $articles;

public function mount(\App\Models\User $user)
{
$user->load(['articles']);
$this->articles = $user->articles;
$this->user = $user->toArray();
}

Expand Down
23 changes: 14 additions & 9 deletions resources/views/livewire/front/user/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,30 @@
</ul>
</div>

@forelse ($articles as $article)
<div class="article-preview">
<div class="article-meta">
<a href=""><img src="http://i.imgur.com/Qr71crq.jpg" /></a>
<a href="{{ route('front.user.show',['user'=>$article->author->username]) }}"><img
src="{{ $article->author->image }}" /></a>
<div class="info">
<a href="" class="author">Eric Simons</a>
<span class="date">January 20th</span>
<a href="{{ route('front.user.show',['user'=>$article->author->username]) }}"
class="author">{{ $article->author->name }}</a>
<span class="date">{{ $article->created_at }}</span>
</div>
<button class="btn btn-outline-primary btn-sm pull-xs-right">
<i class="ion-heart"></i> 29
<i class="ion-heart"></i> {{ $article->favoritersCountReadable() }}
</button>
</div>
<a href="" class="preview-link">
<h1>How to build webapps that scale</h1>
<p>This is the description for the post.</p>
<a href="{{ route('front.article.show',['article'=>$article->slug]) }}" class="preview-link">
<h1>{{ $article->title }}</h1>
<p>{{ $article->description }}</p>
<span>Read more...</span>
</a>
</div>
@empty

<div class="article-preview">
@endforelse
{{-- <div class="article-preview">
<div class="article-meta">
<a href=""><img src="http://i.imgur.com/N4VcUeJ.jpg" /></a>
<div class="info">
Expand All @@ -75,7 +80,7 @@
<li class="tag-default tag-pill tag-outline">Song</li>
</ul>
</a>
</div>
</div> --}}


</div>
Expand Down

0 comments on commit 5034e4b

Please sign in to comment.