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

feat: krayin version and routes clean up done #1395

Merged
merged 5 commits into from
Aug 21, 2024
Merged
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
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
APP_NAME='Krayin CRM'
APP_ENV=local
APP_VERSION=1.3.0
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
Expand Down
18 changes: 3 additions & 15 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,21 @@

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

$this->load(__DIR__.'/../../packages/Webkul/Core/src/Console/Commands');

require base_path('routes/console.php');
Expand Down
15 changes: 2 additions & 13 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
Expand All @@ -29,10 +20,8 @@ class Handler extends ExceptionHandler

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
Expand Down
13 changes: 5 additions & 8 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@

namespace App\Providers;

// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
* The model to policy mappings for the application.
*
* @var array
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
//
];

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

//
}
}
4 changes: 1 addition & 3 deletions app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
public function boot(): void
{
Broadcast::routes();

Expand Down
16 changes: 11 additions & 5 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
* The event to listener mappings for the application.
*
* @var array
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
Expand All @@ -22,11 +22,17 @@ class EventServiceProvider extends ServiceProvider

/**
* Register any events for your application.
*
* @return void
*/
public function boot()
public function boot(): void
{
//
}

/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}
41 changes: 9 additions & 32 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,30 @@
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
* The path to your application's "home" route.
*
* This is used by Laravel authentication to redirect users after login.
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';

/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';

/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot()
public function boot(): void
{
$this->configureRateLimiting();
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});

$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));

Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}

/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.5",
"laravel/ui": "^4.5",
"maatwebsite/excel": "^3.1",
"prettus/l5-repository": "^2.7.9"
},
Expand Down
65 changes: 64 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@

'debug' => (bool) env('APP_DEBUG', false),

/*
Application Version
*/
'version' => env('APP_VERSION'),

/*
|--------------------------------------------------------------------------
| Application URL
Expand Down
4 changes: 2 additions & 2 deletions packages/Webkul/Admin/src/Config/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
'name' => 'admin::app.acl.view',
'route' => 'admin.contacts.persons.view',
'sort' => 5,
],[
], [
'key' => 'contacts.organizations',
'name' => 'admin::app.acl.organizations',
'route' => 'admin.contacts.organizations.index',
Expand Down Expand Up @@ -201,7 +201,7 @@
'name' => 'admin::app.acl.delete',
'route' => ['admin.products.delete', 'admin.products.mass_delete'],
'sort' => 3,
],[
], [
'key' => 'products.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.products.view',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public function update(int $id): RedirectResponse
session()->flash('success', trans('admin::app.settings.roles.index.update-success'));

return redirect()->back();
return redirect()->route('admin.settings.roles.index');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Notifications\User\UserResetPassword;

Expand All @@ -15,7 +14,7 @@ class ForgotPasswordController extends Controller
/**
* Show the form for creating a new resource.
*/
public function create(): View
public function create()
{
if (auth()->guard('user')->check()) {
return redirect()->route('admin.dashboard.index');
Expand Down
7 changes: 6 additions & 1 deletion packages/Webkul/Admin/src/Providers/AdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ public function boot(Router $router): void

include __DIR__.'/../Http/helpers.php';

Route::middleware(['web', 'admin_locale'])->group(__DIR__.'/../Routes/web.php');
Route::middleware(['web', 'admin_locale', 'user'])
->prefix(config('app.admin_path'))
->group(__DIR__.'/../Routes/Admin/web.php');

Route::middleware(['web', 'admin_locale'])
->group(__DIR__.'/../Routes/Front/web.php');

$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');

Expand Down
Loading
Loading