diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 282131b..d44a72f 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,7 +22,7 @@ checks: tools: external_code_coverage: timeout: 600 - runs: 3 + runs: 2 php_code_sniffer: enabled: true config: diff --git a/.travis.yml b/.travis.yml index a4500e0..f16602e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: php sudo: false php: - - 5.6 - 7.0 - 7.1 - nightly diff --git a/composer.json b/composer.json index 1f07055..7638eb0 100644 --- a/composer.json +++ b/composer.json @@ -16,16 +16,16 @@ "type": "library", "license": "MIT", "require": { - "php": ">=5.6.4", - "arcanedev/laravel-seo": "~0.5.0", - "arcanedev/spam-blocker": "~1.3.0", - "arcanesoft/auth": "~3.0.0", - "arcanesoft/core": "~2.6.0" + "php": ">=7.0", + "arcanedev/laravel-seo": "~0.6.0", + "arcanedev/spam-blocker": "~1.4.0", + "arcanesoft/auth": "~3.1.0", + "arcanesoft/core": "~2.7.0" }, "require-dev": { - "orchestra/testbench": "~3.4.0", - "phpunit/phpcov": "~3.0", - "phpunit/phpunit": "~5.0" + "orchestra/testbench": "~3.5.0", + "phpunit/phpcov": "~4.0", + "phpunit/phpunit": "~6.0" }, "autoload": { "psr-4": { diff --git a/src/Http/Controllers/Admin/FootersController.php b/src/Http/Controllers/Admin/FootersController.php index b4575d6..9c8ba8c 100644 --- a/src/Http/Controllers/Admin/FootersController.php +++ b/src/Http/Controllers/Admin/FootersController.php @@ -53,7 +53,7 @@ public function create() { $this->authorize(Policies\FootersPolicy::PERMISSION_CREATE); - $pages = Page::getSelectInputData(); + $pages = Page::getSelectData(); $locales = Locales::all(); $this->setTitle($title = trans('seo::footers.titles.new-footer')); @@ -93,7 +93,7 @@ public function edit(Footer $footer) $footer->load(['page', 'seo']); - $pages = Page::getSelectInputData(); + $pages = Page::getSelectData(); $locales = Locales::all(); $this->setTitle($title = trans('seo::footers.titles.edit-footer')); diff --git a/src/Http/Requests/Admin/Footers/FooterFormRequest.php b/src/Http/Requests/Admin/Footers/FooterFormRequest.php index 32440bd..81d28c5 100644 --- a/src/Http/Requests/Admin/Footers/FooterFormRequest.php +++ b/src/Http/Requests/Admin/Footers/FooterFormRequest.php @@ -38,7 +38,7 @@ public function getValidatedData() */ protected function getPageRule() { - $existsRule = Rule::exists($this->getTablePrefix().'pages', 'id')->where(function ($query) { + $existsRule = Rule::exists($this->getTablePrefix().'pages', 'id')->using(function ($query) { if ($this->has('locale')) $query->where('locale', $this->get('locale', config('app.locale'))); }); diff --git a/src/Models/Footer.php b/src/Models/Footer.php index 23ce5a0..08a828f 100644 --- a/src/Models/Footer.php +++ b/src/Models/Footer.php @@ -89,6 +89,7 @@ protected static function boot() | Relationships | ----------------------------------------------------------------- */ + /** * Page's relationship. * @@ -103,6 +104,7 @@ public function page() | Main Methods | ----------------------------------------------------------------- */ + public static function createOne(array $attributes) { $footer = new self([ @@ -147,13 +149,24 @@ public function updateOne(array $attributes) | Other Methods | ----------------------------------------------------------------- */ + + /** + * Get the show URL. + * + * @return string + */ public function getShowUrl() { - return route('admin::seo.footers.show', $this); + return route('admin::seo.footers.show', [$this]); } + /** + * Get the edit URL. + * + * @return string + */ public function getEditUrl() { - return route('admin::seo.footers.edit', $this); + return route('admin::seo.footers.edit', [$this]); } } diff --git a/src/Models/Page.php b/src/Models/Page.php index af5f72f..5e47fc3 100644 --- a/src/Models/Page.php +++ b/src/Models/Page.php @@ -49,6 +49,7 @@ class Page extends AbstractModel | Constructor | ----------------------------------------------------------------- */ + /** * Page constructor. * @@ -66,10 +67,11 @@ public function __construct(array $attributes = []) | Relationships | ----------------------------------------------------------------- */ + /** * Footer's relationship. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function footers() { @@ -80,6 +82,7 @@ public function footers() | Main Methods | ----------------------------------------------------------------- */ + /** * Create a new page. * @@ -111,6 +114,7 @@ public function updateOne(array $attributes) | Check Methods | ----------------------------------------------------------------- */ + /** * Check if the page is deletable. * @@ -125,12 +129,13 @@ public function isDeletable() | Other Methods | ----------------------------------------------------------------- */ + /** * Get the select input data. * - * @return \Illuminate\Database\Eloquent\Collection + * @return \Illuminate\Support\Collection */ - public static function getSelectInputData() + public static function getSelectData() { $pages = Page::all(); // TODO: Cache the data ?? @@ -144,7 +149,7 @@ public static function getSelectInputData() */ public function getShowUrl() { - return route('admin::seo.footers.show', $this); + return route('admin::seo.footers.show', [$this]); } /** @@ -154,6 +159,6 @@ public function getShowUrl() */ public function getEditUrl() { - return route('admin::seo.footers.edit', $this); + return route('admin::seo.footers.edit', [$this]); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 07bc6ce..f8703f7 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -72,8 +72,8 @@ protected function getEnvironmentSetUp($app) private function setUpRoutes($app) { /** @var \Orchestra\Testbench\Http\Kernel $httpKernel */ - $httpKernel = $app->make('Illuminate\Contracts\Http\Kernel'); - $httpKernel->pushMiddleware(\Arcanedev\SpamBlocker\Middleware\BlockReferralSpam::class); + $httpKernel = $app->make(\Illuminate\Contracts\Http\Kernel::class); + $httpKernel->pushMiddleware(\Arcanedev\SpamBlocker\Http\Middleware\BlockReferralSpam::class); $app['router']->get('/', function () { return 'Home page';