Skip to content

Commit

Permalink
fix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
SethSharp committed Jun 10, 2024
1 parent 9ac876a commit c5a9656
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .platform/hooks/postdeploy/postdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ echo "yes" | php artisan migrate --force || { echo "Failed to run migrations"; e

echo "yes" | php artisan bootstrap || { echo "Failed to run bootstrap commands"; exit 1; }

echo "yes" | php artisan fix:things || { echo "Failed to run fix:things commands"; exit 1; }
echo "yes" | php artisan fix:things --slug=grass-roots-contextually-based-ability --time=2024-03-05 || { echo "Failed to run fix:things commands for blog 1"; exit 1; }
echo "yes" | php artisan fix:things --slug=a-day-in-the-life-peer-mentoring-at-griffith-university --time=2024-02-26 || { echo "Failed to run fix:things commands for blog 1"; exit 1; }
18 changes: 17 additions & 1 deletion app/Console/Commands/FixThings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@

namespace App\Console\Commands;

use Carbon\Carbon;
use Illuminate\Console\Command;
use SethSharp\BlogCrud\Models\Blog\Blog;

class FixThings extends Command
{
protected $signature = 'fix:things';
protected $signature = 'fix:things {--slug=} {--time=}';
protected $description = 'does something...';

public function handle(): void
{
if (! $this->option('slug') || ! $this->option('time')) {
$this->error('make sure you have provided the slug and time options');
return;
}

$blog = Blog::whereSlug($this->option('slug'))->first();

if ($blog) {
$publishedAt = Carbon::parse($this->option('time'));

$blog->update([
'published_at' => $publishedAt
]);
}
}
}

0 comments on commit c5a9656

Please sign in to comment.