Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristories committed Jan 15, 2022
1 parent a2d1397 commit bf4949a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Models/Scopes/MyAppsScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Kristories\Novassport\Models\Scopes;

use Auth;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Builder;

class MyAppsScope implements Scope
{
Expand Down
2 changes: 1 addition & 1 deletion src/Novassport.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Novassport extends Tool
*/
public function boot()
{
Nova::script('novassport', __DIR__ . '/../dist/js/tool.js');
Nova::script('novassport', __DIR__.'/../dist/js/tool.js');

Nova::resources([
\Kristories\Novassport\Resources\OauthMyApps::class,
Expand Down
11 changes: 6 additions & 5 deletions src/Observers/OauthClientObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Kristories\Novassport\Observers;

use Auth, Str;
use Auth;
use Kristories\Novassport\Models\OauthClient;
use Str;

class OauthClientObserver
{
Expand All @@ -15,10 +16,10 @@ class OauthClientObserver
*/
public function creating(OauthClient $client)
{
$client->user_id = Auth::id();
$client->secret = Str::random(40);
$client->revoked = false;
$client->user_id = Auth::id();
$client->secret = Str::random(40);
$client->revoked = false;
$client->personal_access_client = false;
$client->password_client = false;
$client->password_client = false;
}
}
6 changes: 6 additions & 0 deletions src/Policies/MyAppsPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ public function viewAny(): bool
{
return true;
}

public function view(): bool
{
return true;
}

public function create(): bool
{
return true;
}

public function update(): bool
{
return true;
}

public function delete(): bool
{
return true;
}

public function restore(): bool
{
return true;
}

public function forceDelete(): bool
{
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/OauthMyApps.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Kristories\Novassport\Resources;

use Laravel\Nova\Resource;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Resource;

class OauthMyApps extends Resource
{
Expand Down
16 changes: 8 additions & 8 deletions src/ToolServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Kristories\Novassport;

use Gate;
use Laravel\Nova\Nova;
use Laravel\Nova\Events\ServingNova;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Kristories\Novassport\Models\OauthClient;
use Kristories\Novassport\Policies\MyAppsPolicy;
use Kristories\Novassport\Http\Middleware\Authorize;
use Kristories\Novassport\Models\OauthClient;
use Kristories\Novassport\Observers\OauthClientObserver;
use Kristories\Novassport\Policies\MyAppsPolicy;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;

class ToolServiceProvider extends ServiceProvider
{
Expand All @@ -21,11 +21,11 @@ class ToolServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'novassport');
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'novassport');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'novassport');
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'novassport');

$this->publishes([
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/novassport'),
__DIR__.'/../resources/lang' => resource_path('lang/vendor/novassport'),
], 'novassport');

$this->app->booted(function () {
Expand Down Expand Up @@ -54,7 +54,7 @@ protected function routes()

Route::middleware(['nova', Authorize::class])
->prefix('nova-vendor/novassport')
->group(__DIR__ . '/../routes/api.php');
->group(__DIR__.'/../routes/api.php');
}

/**
Expand Down

0 comments on commit bf4949a

Please sign in to comment.