I'm currently developing an SaaS application in PHP, with Laravel, using its own DB class.
Let's pretend we've got 2 classes under 2 namespaces, plus Laravel's own DB - so
Illuminate\Support\Facades\DB;
Developer\App\Core\Queries;
Developer\App\Section;
They're our 3 classes.
With our custom classes, we've got
File 1: Developer\App\Core\Queries\Section.php
which contains
private function fetchInfoFromTable(string $id)
{
//Pretend there is a bit to check if we've already run the query
return DB::Query('blablabla');
}
File 2: Developer\App\Section\XXXXX.php
private function showInfo()
{
$data = Section::fetchInfoFromTable(1);
$data = dostufftomakeitnice($data);
$data = doMorestufftomakeitnice($data);
return $data;
}
Is this worth the amount of effort I've put into typing this question? Or is it worth just putting even the queries into XXXXX.php
?