diff --git a/app/View/Components/ListPost.php b/app/View/Components/ListPost.php new file mode 100644 index 0000000..2ceaf8e --- /dev/null +++ b/app/View/Components/ListPost.php @@ -0,0 +1,28 @@ +posts = $posts; + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.list-post'); + } +} diff --git a/resources/views/components/list-post.blade.php b/resources/views/components/list-post.blade.php new file mode 100644 index 0000000..063e21c --- /dev/null +++ b/resources/views/components/list-post.blade.php @@ -0,0 +1,15 @@ +
+ @if ($posts->count()) +
+ @foreach ($posts as $post) +
+ + {{ $post->title }} + +
+ @endforeach +
+ @else +

No posts yet. Be the first one!

+ @endif +
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index e4a09dd..a3f0a40 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -75,22 +75,6 @@

Posts

- @if ($posts->count()) -
- @foreach ($posts as $post) -
- - {{ $post->title }} - -
- @endforeach -
- -
- {{ $posts->links() }} -
- @else -

No posts yet

- @endif +
@endsection diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index e204e89..8068d76 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -4,18 +4,6 @@ @section('content') - @if ($posts->count()) -
- @foreach ($posts as $post) -
- - {{ $post->title }} - -
- @endforeach -
- @else -

No posts yet. Be the first one!

- @endif + @endsection