Skip to content

Commit

Permalink
Kommando för att lista senaste händelserna
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed Apr 24, 2024
1 parent f4286fa commit 52f537b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/Console/Commands/CreateAISummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\CrimeEvent;
use Illuminate\Console\Command;
use MO;

class CreateAISummary extends Command {
/**
Expand Down
36 changes: 36 additions & 0 deletions app/Console/Commands/ListEvents.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Console\Commands;

use App\CrimeEvent;
use Illuminate\Console\Command;

class ListEvents extends Command {
/**
* Signature for the command.
*
* @var string
*/
protected $signature = 'crimeevents:list';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Lista händelser';

/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$this->line('Senaste händelserna:');

$events = CrimeEvent::select(['parsed_date', 'id', 'title'])->limit(10)->orderByDesc('parsed_date')->get();

$this->table(['Parsed date', 'ID', 'Title'], $events);
return Command::SUCCESS;
}
}

0 comments on commit 52f537b

Please sign in to comment.