for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Controllers\Admin;
use App\Event;
use App\Http\Controllers\Controller;
use App\Project;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
class EventController extends Controller
{
//
public function index()
$projects = Project::where('is_archived', false)->get();
$archive = Project::where('is_archived', true)->get();
foreach( $archive as $project )
// Set the time range of the project by selecting the last and first dates of its events
// if no events are associated with the project, set the dates to '-'
$firstEvent = $project->events()->orderBy('start_date', 'ASC')->first();
$project->start_date = $firstEvent === null ? '-' : $firstEvent->start_date;
start_date
App\Project
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.
$lastEvent = $project->events()->orderBy('end_date', 'DESC')->first();
$project->end_date = $lastEvent === null ? '-' : $lastEvent->end_date;
end_date
}
$events = Event::whereHas('project', function(Builder $query) {
$query->where('is_archived', false);
})->get();
return view('admin.events.index', [
'projects' => $projects,
'events' => $events,
'archived' => $archive
]);
public function create()
return "TODO";
public function get(Event $event)
$event
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function get(/** @scrutinizer ignore-unused */ Event $event)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
public function update(Event $event)
public function update(/** @scrutinizer ignore-unused */ Event $event)
public function delete(Event $event)
public function delete(/** @scrutinizer ignore-unused */ Event $event)
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.