Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 0 additions & 4 deletions .env.travis
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ LARAVEL_BLOCKER_BLADE_PLACEMENT_JS='footer_scripts'
LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED=true
LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED=true

# Roles Default Models
ROLES_DEFAULT_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
ROLES_DEFAULT_PERMISSION_MODEL=jeremykenedy\LaravelRoles\Models\Permission
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, this is because I changed the models to extend the packages models... correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes !


# Roles database information
ROLES_DATABASE_CONNECTION=null

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,6 @@ LARAVEL_BLOCKER_BLADE_PLACEMENT_JS='footer_scripts'
LARAVEL_BLOCKER_USE_TYPES_SEED_PUBLISHED=true
LARAVEL_BLOCKER_USE_ITEMS_SEED_PUBLISHED=true

# Roles Default Models
ROLES_DEFAULT_ROLE_MODEL=jeremykenedy\LaravelRoles\Models\Role
ROLES_DEFAULT_PERMISSION_MODEL=jeremykenedy\LaravelRoles\Models\Permission

# Roles database information
ROLES_DATABASE_CONNECTION=null

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ActivateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use jeremykenedy\LaravelRoles\Models\Role;
use App\Models\Role;

class ActivateController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use jeremykenedy\LaravelRoles\Models\Role;
use App\Models\Role;

class RegisterController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use App\Traits\CaptureIpTrait;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
use jeremykenedy\LaravelRoles\Models\Role;
use App\Models\Role;
use Laravel\Socialite\Facades\Socialite;

class SocialController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/SoftDeletesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Models\User;
use Illuminate\Http\Request;
use jeremykenedy\LaravelRoles\Models\Role;
use App\Models\Role;

class SoftDeletesController extends Controller
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/UsersManagementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Hash;
use jeremykenedy\LaravelRoles\Models\Role;
use App\Models\Role;
use Validator;

class UsersManagementController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Kernel extends HttpKernel
*
* @var array
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, did the variable name change within Laravel or is this a personal preference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
Expand Down
12 changes: 2 additions & 10 deletions app/Models/Activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ class Activation extends Model
'ip_address',
];

/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
];

/**
* The attributes that are mass assignable.
*
Expand All @@ -71,6 +61,8 @@ class Activation extends Model
'user_id' => 'integer',
'token' => 'string',
'ip_address' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];

/**
Expand Down
20 changes: 6 additions & 14 deletions app/Models/Social.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ class Social extends Model
*/
protected $hidden = [];

/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
];

/**
* The attributes that are mass assignable.
*
Expand All @@ -63,10 +53,12 @@ class Social extends Model
* @var array
*/
protected $casts = [
'id' => 'integer',
'user_id' => 'integer',
'provider' => 'string',
'social_id' => 'string',
'id' => 'integer',
'user_id' => 'integer',
'provider' => 'string',
'social_id' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];

/**
Expand Down
14 changes: 3 additions & 11 deletions app/Models/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ class Theme extends Model
*/
protected $hidden = [];

/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];

/**
* Fillable fields for a Profile.
*
Expand Down Expand Up @@ -79,6 +68,9 @@ class Theme extends Model
'activated' => 'boolean',
'taggable_id' => 'integer',
'taggable_type' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];

/**
Expand Down
14 changes: 3 additions & 11 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ class User extends Authenticatable
'token',
];

/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];

/**
* The attributes that are mass assignable.
*
Expand Down Expand Up @@ -101,6 +90,9 @@ class User extends Authenticatable
'admin_ip_address' => 'string',
'updated_ip_address' => 'string',
'deleted_ip_address' => 'string',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];

public function sendPasswordResetNotification($token)
Expand Down
4 changes: 3 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function register(): void
*/
public function boot(): void
{
URL::forceScheme('https');
if ($this->app->environment('production')) {
URL::forceScheme('https');
}
//Paginator::useBootstrapThree();
Paginator::useBootstrap();
Schema::defaultStringLength(191);
Expand Down
4 changes: 1 addition & 3 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ class AuthServiceProvider extends ServiceProvider
* @var array<class-string, class-string>
*/
protected $policies = [
'App\Models\Model' => 'App\Policies\ModelPolicy',
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment it out?

Copy link
Contributor Author

@maxdestors maxdestors Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was triggering an error if not, to be honest I am not using it in my own project so I never checked how policies works
Uncaught ReflectionException: Class "App\Policies\ModelPolicy" does not exist in Command line code:1

];

/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
$this->registerPolicies();

//
}
}
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'search_path' => 'public',
'sslmode' => 'prefer',
],

Expand Down
2 changes: 1 addition & 1 deletion config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

'default' => env('FILESYSTEM_DRIVER', 'local'),
'default' => env('FILESYSTEM_DISK', 'local'),

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions database/seeders/ConnectRelationshipsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Database\Seeders;

use App\Models\Permission;
use App\Models\Role;
use Illuminate\Database\Seeder;

class ConnectRelationshipsSeeder extends Seeder
Expand All @@ -16,12 +18,12 @@ public function run(): void
/**
* Get Available Permissions.
*/
$permissions = config('roles.models.permission')::all();
$permissions = Permission::all();

/**
* Attach Permissions to Roles.
*/
$roleAdmin = config('roles.models.role')::where('name', '=', 'Admin')->first();
$roleAdmin = Role::where('name', '=', 'Admin')->first();
foreach ($permissions as $permission) {
$roleAdmin->attachPermission($permission);
}
Expand Down
5 changes: 3 additions & 2 deletions database/seeders/PermissionsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Database\Seeders;

use App\Models\Permission;
use Illuminate\Database\Seeder;

class PermissionsTableSeeder extends Seeder
Expand Down Expand Up @@ -49,9 +50,9 @@ public function run(): void
*
*/
foreach ($Permissionitems as $Permissionitem) {
$newPermissionitem = config('roles.models.permission')::where('slug', '=', $Permissionitem['slug'])->first();
$newPermissionitem = Permission::where('slug', '=', $Permissionitem['slug'])->first();
if ($newPermissionitem === null) {
$newPermissionitem = config('roles.models.permission')::create([
$newPermissionitem = Permission::create([
'name' => $Permissionitem['name'],
'slug' => $Permissionitem['slug'],
'description' => $Permissionitem['description'],
Expand Down
5 changes: 3 additions & 2 deletions database/seeders/RolesTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Database\Seeders;

use App\Models\Role;
use Illuminate\Database\Seeder;

class RolesTableSeeder extends Seeder
Expand Down Expand Up @@ -43,9 +44,9 @@ public function run(): void
*
*/
foreach ($RoleItems as $RoleItem) {
$newRoleItem = config('roles.models.role')::where('slug', '=', $RoleItem['slug'])->first();
$newRoleItem = Role::where('slug', '=', $RoleItem['slug'])->first();
if ($newRoleItem === null) {
$newRoleItem = config('roles.models.role')::create([
$newRoleItem = Role::create([
'name' => $RoleItem['name'],
'slug' => $RoleItem['slug'],
'description' => $RoleItem['description'],
Expand Down
Loading