<?php
namespace Koselig\Routing;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Koselig\Support\Wordpress;
class ArchiveRoute extends Route
{
private $postTypes;
public function __construct($methods, $postTypes, $action)
{
parent::__construct($methods, $postTypes, $action);
$this->postTypes = $this->uri;
$this->uri = 'archive/' . (implode('/', $this->postTypes) ?: 'all');
}
public function matches(Request $request, $includingMethod = true)
{
if (!empty($this->getAction()['domain']) && !Wordpress::multisite($this->getAction()['domain'])) {
return false;
}
return Wordpress::archive($this->postTypes);
}
}