Skip to content

Commit

Permalink
Merge pull request #26 from DanielRTRD/uses
Browse files Browse the repository at this point in the history
Uses
  • Loading branch information
dsbilling authored Mar 5, 2022
2 parents eb88720 + 11d0c5f commit ccc1719
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

PRIVATE_EMAIL=""

BLOG_USES_SLUG=null
7 changes: 7 additions & 0 deletions config/blog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

return [

'uses' => env('BLOG_USES_SLUG', null),

];
2 changes: 2 additions & 0 deletions resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</div>
<div class="hidden sm:block">
<div class="flex items-baseline ml-auto space-x-3">
@if(config('blog.uses'))<x-nav-link-front href="{{ route('uses') }}">My Setup</x-nav-link-front>@endif
@if(\App\Models\Post::isPublished()->count() > 0)<x-nav-link-front href="{{ route('blog.index') }}">Blog</x-nav-link-front>@endif
</div>
</div>
Expand All @@ -56,6 +57,7 @@ class="inline-flex items-center justify-center p-2 text-gray-800 rounded-md dark
</div>
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
@if(config('blog.uses'))<x-nav-link-responsive-front href="{{ route('uses') }}">My Setup</x-nav-link-responsive-front>@endif
@if(\App\Models\Post::isPublished()->count() > 0)<x-nav-link-responsive-front href="{{ route('blog.index') }}">Blog</x-nav-link-responsive-front>@endif
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions resources/views/posts/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<th scope="col" class="px-5 py-3 text-sm font-normal text-left uppercase border-b border-gray-200 dark:border-gray-700">
Title
</th>
<th scope="col" class="px-5 py-3 text-sm font-normal text-left uppercase border-b border-gray-200 dark:border-gray-700">
Slug
</th>
<th scope="col" class="px-5 py-3 text-sm font-normal text-left uppercase border-b border-gray-200 dark:border-gray-700">
Published
</th>
Expand Down Expand Up @@ -49,6 +52,9 @@
<td class="max-w-xs px-5 py-5 text-sm truncate border-b border-gray-200 dark:border-gray-700">
{{ Str::limit($post->title, 100) }}
</td>
<td class="px-5 py-5 text-sm border-b border-gray-200 dark:border-gray-700">
{{ $post->slug }}
</td>
<td class="px-5 py-5 text-sm border-b border-gray-200 dark:border-gray-700">
{{ $post->published_at ? $post->published_at->diffForHumans() : 'Not published' }}
</td>
Expand Down
5 changes: 4 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

Route::get('/', [HomeController::class, 'index'])->name('home');
Route::resource('blog', BlogController::class);
Route::get('/uses', function () {
return redirect()->route('blog.show', ['blog' => config('blog.uses')]);
})->name('uses');

Route::prefix('tools')->group(function () {
Route::get('/liter', [HomeController::class, 'liter'])->name('liter-calculator');
Expand All @@ -50,4 +53,4 @@
Route::get('/cv', [ExportController::class, 'cv'])->name('export.cv');
Route::get('/courses', [ExportController::class, 'courses'])->name('export.cv');
});
});
});

0 comments on commit ccc1719

Please sign in to comment.