Last active
October 15, 2021 09:03
-
-
Save codeperl/94ebdcb6b86d003e64da43fec31179a9 to your computer and use it in GitHub Desktop.
So, php is bad, part 2. :) Part 1: https://gist.github.com/codeperl/40173ffb863c4c6eb5f271d45b570f14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\AboutUsService; | |
use App\Services\Contracts\AboutUsContract; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\IndexPageService; | |
use Illuminate\Http\Request; | |
class AboutUsController extends Controller | |
{ | |
/** @var AboutUsContract|AboutUsService */ | |
private $aboutUsService; | |
public function __construct(AboutUsContract $aboutUsService) | |
{ | |
$this->aboutUsService = $aboutUsService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.about-us', [ | |
'aboutUs' => $this->aboutUsService->get() | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\ClientCategoryService; | |
use App\Services\ClientService; | |
use App\Services\Contracts\ClientCategoryContract; | |
use App\Services\Contracts\ClientContract; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\IndexPageService; | |
use Illuminate\Http\Request; | |
class ClientController extends Controller | |
{ | |
/** @var ClientCategoryContract|ClientCategoryService */ | |
private $clientCategoryService; | |
/** @var ClientContract|ClientService */ | |
private $clientService; | |
public function __construct(ClientCategoryContract $clientCategoryService, ClientContract $clientService) | |
{ | |
$this->clientCategoryService = $clientCategoryService; | |
$this->clientService = $clientService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.clients', [ | |
'clientsCount' => $this->clientService->getCount(), | |
'clientCategoriesWithClients' => $this->clientCategoryService->getCategoriesWithOrderedClients() | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\EventContract; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\EventService; | |
use App\Services\IndexPageService; | |
use Illuminate\Http\Request; | |
class EventController extends Controller | |
{ | |
/** @var EventContract|EventService */ | |
private $eventService; | |
public function __construct(EventContract $eventService) | |
{ | |
$this->eventService = $eventService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.events', [ | |
'events' => $this->eventService->getLatestPublished(3), | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\IndexPageService; | |
class IndexController extends Controller | |
{ | |
/** @var IndexPageContract|IndexPageService */ | |
private $indexPageService; | |
public function __construct(IndexPageContract $indexPageService) | |
{ | |
$this->indexPageService = $indexPageService; | |
} | |
public function index() | |
{ | |
return view('web.front.index.index', $this->indexPageService->all()); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\ManagementContract; | |
use App\Services\IndexPageService; | |
use App\Services\ManagementService; | |
use Illuminate\Http\Request; | |
class ManagementController extends Controller | |
{ | |
/** @var ManagementContract|ManagementService */ | |
private $managementService; | |
public function __construct(ManagementContract $managementService) | |
{ | |
$this->managementService = $managementService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.managements', [ | |
'managements' => $this->managementService->getSortedManagements() | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\MarketConcentrationContract; | |
use App\Services\IndexPageService; | |
use App\Services\MarketConcentrationService; | |
use Illuminate\Http\Request; | |
class MarketConcentrationController extends Controller | |
{ | |
/** @var MarketConcentrationContract|MarketConcentrationService */ | |
private $marketConcentrationService; | |
public function __construct(MarketConcentrationContract $marketConcentrationService) | |
{ | |
$this->marketConcentrationService = $marketConcentrationService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.market-concentration', [ | |
'marketConcentrations' => $this->marketConcentrationService->getSortedMarketConcentrations() | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\PortfolioContract; | |
use App\Services\IndexPageService; | |
use App\Services\PortfolioCategoryService; | |
use App\Services\PortfolioService; | |
use Illuminate\Http\Request; | |
class PortfolioController extends Controller | |
{ | |
/** @var PortfolioCategoryService */ | |
private $portfolioCategoryService; | |
/** @var PortfolioContract|PortfolioService */ | |
private $portfolioService; | |
public function __construct(PortfolioCategoryService $portfolioCategoryService, PortfolioContract $portfolioService) | |
{ | |
$this->portfolioCategoryService = $portfolioCategoryService; | |
$this->portfolioService = $portfolioService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.portfolios', [ | |
'portfolios' => $this->portfolioService->getSortedPortfolios(), | |
'portfolioCategories' => $this->portfolioCategoryService->getSortedPortfolioCategories(), | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\ProductContract; | |
use App\Services\IndexPageService; | |
use App\Services\ProductService; | |
use Illuminate\Http\Request; | |
class ProductController extends Controller | |
{ | |
/** @var ProductContract|ProductService */ | |
private $productService; | |
public function __construct(ProductContract $productService) | |
{ | |
$this->productService = $productService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.products', [ | |
'products' => $this->productService->getSortedProducts(), | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\ResourceInfoContract; | |
use App\Services\IndexPageService; | |
use App\Services\ResourceInfoService; | |
use Illuminate\Http\Request; | |
class ResourceController extends Controller | |
{ | |
/** @var ResourceInfoContract|ResourceInfoService */ | |
private $resourceInfoService; | |
public function __construct(ResourceInfoContract $resourceInfoService) | |
{ | |
$this->resourceInfoService = $resourceInfoService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.resource', [ | |
'resourceInfo' => $this->resourceInfoService->get() | |
]); | |
} | |
} | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
<?php | |
namespace App\Http\Controllers\Web\Front\Components; | |
use App\Http\Controllers\Controller; | |
use App\Services\Contracts\IndexPageContract; | |
use App\Services\Contracts\TestimonialContract; | |
use App\Services\IndexPageService; | |
use App\Services\TestimonialService; | |
use Illuminate\Http\Request; | |
class TestimonialController extends Controller | |
{ | |
/** @var TestimonialContract|TestimonialService */ | |
private $testimonialService; | |
public function __construct(TestimonialContract $testimonialService) | |
{ | |
$this->testimonialService = $testimonialService; | |
} | |
public function __invoke() | |
{ | |
return view('web.front.components.testimonials', [ | |
'testimonials' => $this->testimonialService->getSortedTestimonials(), | |
]); | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment