Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #83

Open
wants to merge 1 commit into
base: release/0.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AddForeignKeysToApplicationSettingsTable extends Migration
public function up()
{
Schema::table('application_settings', function (Blueprint $table) {

$table->foreign('application_id')->references('id')->on('applications')->onUpdate('cascade')->onDelete('cascade');
});
}
Expand Down
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Illuminate\Http\Request;

Route::group(['prefix' => config('soda.cms.path'), 'middleware' => ['web']], function () {
Route::post('switch-application', 'HomeController@switchApplication')->name('soda.switch-application');
Expand Down
2 changes: 1 addition & 1 deletion src/Database/ContentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function register()

$this->registerAliases($this->aliases);

if ( config('soda.cms.enable_publish_date') ) {
if (config('soda.cms.enable_publish_date')) {
Content::setPublishDateField('published_at');
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Database/Models/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Soda\Cms\Database\Models;

use Carbon\Carbon;
use Exception;
use Soda\ClosureTable\Models\Entity;
use Illuminate\Database\Eloquent\SoftDeletes;
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Models/Traits/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function audits()
*/
public function readyForAuditing()
{
return ($this->isEventAuditable($this->auditEvent) && $this->isDirty());
return $this->isEventAuditable($this->auditEvent) && $this->isDirty();
}

/**
Expand Down
16 changes: 9 additions & 7 deletions src/Database/Models/Traits/Draftable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Soda\Cms\Database\Models\Traits;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Soda\Cms\Foundation\Constants;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Soda\Cms\Foundation\Constants;
use Illuminate\Database\Eloquent\Builder;

trait Draftable
{
Expand All @@ -18,8 +18,10 @@ trait Draftable
*/
public static function bootDraftable()
{
if(isset(static::$publishDateField)) static::setPublishDateField(static::$publishDateField);

if (isset(static::$publishDateField)) {
static::setPublishDateField(static::$publishDateField);
}

static::addGlobalScope('published', function (Builder $builder) {
if (static::isDraftsEnabled()) {
$builder->where('status', '=', Constants::STATUS_LIVE);
Expand Down Expand Up @@ -56,12 +58,12 @@ public static function disableDrafts()
{
static::$drafts = false;
}

public static function publishDateFieldEnabled()
{
return static::$_publishDateField !== null && static::$_publishDateField !== "";
return static::$_publishDateField !== null && static::$_publishDateField !== '';
}

public static function setPublishDateField($field = null)
{
static::$_publishDateField = $field;
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Models/Traits/RoleHasPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public static function bootRoleHasPermissionsTrait()

public function getCacheKey()
{
return 'soda.permissions.' . $this->getTable() . '.' . $this->getKey();
return 'soda.permissions.'.$this->getTable().'.'.$this->getKey();
}
}
2 changes: 1 addition & 1 deletion src/Database/Models/Traits/UserHasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function bootUserHasRolesTrait()

public function getCacheKey()
{
return 'soda.permissions.' . $this->getTable() . '.' . $this->getKey();
return 'soda.permissions.'.$this->getTable().'.'.$this->getKey();
}

public function listRoles()
Expand Down
10 changes: 5 additions & 5 deletions src/Database/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use Carbon\Carbon;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model;
use Soda\Cms\Database\Models\Traits\Auditable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Soda\Cms\Database\Models\Contracts\HasLocale;
use Soda\Cms\Database\Models\Traits\UserHasRoles;
use Soda\Cms\Database\Models\Contracts\UserInterface;
use Soda\Cms\Database\Models\Traits\Auditable;
use Soda\Cms\Database\Models\Traits\OptionallyBoundToApplication;
use Soda\Cms\Database\Models\Traits\UserHasRoles;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements UserInterface, HasLocale, AuthenticatableContract, CanResetPasswordContract
{
Expand Down
12 changes: 6 additions & 6 deletions src/Database/Repositories/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

use Carbon\Carbon;
use Illuminate\Http\Request;
use Soda\Cms\Foundation\Constants;
use Soda\Cms\Support\Facades\Soda;
use Soda\Cms\Database\Models\ContentShortcut;
use Soda\Cms\Database\Models\Contracts\ContentInterface;
use Soda\Cms\Database\Repositories\Contracts\ContentRepositoryInterface;
use Soda\Cms\Foundation\Constants;
use Soda\Cms\Support\Facades\Soda;

class ContentRepository extends AbstractRepository implements ContentRepositoryInterface
{
Expand Down Expand Up @@ -53,7 +53,7 @@ public function getRoot()
public function listFolder(Request $request, ContentInterface $contentFolder)
{
if ($request->has('search')) {
$query = $contentFolder->collectDescendants()->where('name', 'LIKE', '%' . $request->input('search') . '%');
$query = $contentFolder->collectDescendants()->where('name', 'LIKE', '%'.$request->input('search').'%');
} else {
$query = $contentFolder->collectChildren();
}
Expand Down Expand Up @@ -90,12 +90,12 @@ protected function contentToBreadcrumb(ContentInterface $content)
$parentBreadcrumb = $this->contentToBreadcrumb($content->parent);
}

return (isset($parentBreadcrumb) && $parentBreadcrumb ? $parentBreadcrumb . ' / ' : '') . $content->name;
return (isset($parentBreadcrumb) && $parentBreadcrumb ? $parentBreadcrumb.' / ' : '').$content->name;
}

public function findBySlug($slug)
{
return $this->model->where('slug', '/' . ltrim($slug, '/'))->first();
return $this->model->where('slug', '/'.ltrim($slug, '/'))->first();
}

public function getCreatableContentTypes($contentFolderId = null)
Expand Down Expand Up @@ -219,7 +219,7 @@ public function save(Request $request, $id = null)
$inputs = $request->all();

// format published_at
if(config('soda.cms.enable_publish_date')) {
if (config('soda.cms.enable_publish_date')) {
$inputs['published_at'] = Carbon::parse($inputs['published_at'], config('soda.cms.publish_timezone')) ?: Carbon::now();
}

Expand Down
2 changes: 0 additions & 2 deletions src/Foundation/SodaInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ public function getVersion()
}
} catch (\Exception $e) {
}

return;
});
}
}
1 change: 0 additions & 1 deletion src/Http/Controllers/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Soda\Cms\Http\Controllers;

use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Soda\Cms\Database\Models\Contracts\ContentInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Soda\Cms\Database\Models\Contracts\HasLocale;
use Soda\Cms\Database\Models\Quicklink;
use Soda\Cms\Database\Models\Contracts\HasLocale;

class HomeController extends BaseController
{
Expand Down Expand Up @@ -100,6 +100,6 @@ public function switchApplication(Request $request)

$request->session()->flash('vtoken', $validationToken);

return redirect()->away($parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'] . '?' . $parsedUrl['query']);
return redirect()->away($parsedUrl['scheme'].'://'.$parsedUrl['host'].$parsedUrl['path'].'?'.$parsedUrl['query']);
}
}
2 changes: 1 addition & 1 deletion src/Http/Middleware/TransferSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ protected function removeSessionQueryParameters($request)

$currentQuery = http_build_query($currentQueryArray);

return $request->url() . (count($currentQueryArray) ? "?$currentQuery" : '');
return $request->url().(count($currentQueryArray) ? "?$currentQuery" : '');
}
}
4 changes: 0 additions & 4 deletions src/InterfaceBuilder/Dashboard/DashboardBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ protected function renderRow($rowId)
if (count($blocks)) {
return soda_cms_view('partials.dashboard.row', compact('blocks'))->render();
}

return;
}

protected function beforeRenderRow($rowId)
Expand All @@ -152,8 +150,6 @@ protected function renderBlock($blockName)
return $content->render();
}
}

return;
}

protected function beforeRenderBlock($blockName)
Expand Down
2 changes: 1 addition & 1 deletion src/InterfaceBuilder/Menu/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getParent()
return $this->parent;
}

public function setParent(MenuItem $item)
public function setParent(self $item)
{
$this->parent = $item;

Expand Down
2 changes: 1 addition & 1 deletion src/Routing/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use Soda\Cms\Http\Middleware\Authenticate;
use Soda\Cms\Http\Middleware\ToggleLocale;
use Soda\Cms\Http\Middleware\HasPermission;
use Soda\Cms\Http\Middleware\TransferSession;
use Soda\Cms\Http\Middleware\SluggableSession;
use Soda\Cms\Http\Middleware\RedirectIfAuthenticated;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Soda\Cms\Http\Middleware\TransferSession;

class RouteServiceProvider extends ServiceProvider
{
Expand Down