Moved to _dev
This commit is contained in:
69
crater/app/Providers/AppServiceProvider.php
Normal file
69
crater/app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Illuminate\Pagination\Paginator;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Paginator::useBootstrapThree();
|
||||
$this->loadJsonTranslationsFrom(resource_path('scripts/locales'));
|
||||
|
||||
if (\Storage::disk('local')->has('database_created') && Schema::hasTable('abilities')) {
|
||||
$this->addMenus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function addMenus()
|
||||
{
|
||||
//main menu
|
||||
\Menu::make('main_menu', function ($menu) {
|
||||
foreach (config('crater.main_menu') as $data) {
|
||||
$this->generateMenu($menu, $data);
|
||||
}
|
||||
});
|
||||
|
||||
//setting menu
|
||||
\Menu::make('setting_menu', function ($menu) {
|
||||
foreach (config('crater.setting_menu') as $data) {
|
||||
$this->generateMenu($menu, $data);
|
||||
}
|
||||
});
|
||||
|
||||
\Menu::make('customer_portal_menu', function ($menu) {
|
||||
foreach (config('crater.customer_menu') as $data) {
|
||||
$this->generateMenu($menu, $data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function generateMenu($menu, $data)
|
||||
{
|
||||
$menu->add($data['title'], $data['link'])
|
||||
->data('icon', $data['icon'])
|
||||
->data('name', $data['name'])
|
||||
->data('owner_only', $data['owner_only'])
|
||||
->data('ability', $data['ability'])
|
||||
->data('model', $data['model'])
|
||||
->data('group', $data['group']);
|
||||
}
|
||||
}
|
||||
90
crater/app/Providers/AuthServiceProvider.php
Normal file
90
crater/app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Crater\Policies\CompanyPolicy;
|
||||
use Crater\Policies\CustomerPolicy;
|
||||
use Crater\Policies\DashboardPolicy;
|
||||
use Crater\Policies\EstimatePolicy;
|
||||
use Crater\Policies\ExpensePolicy;
|
||||
use Crater\Policies\InvoicePolicy;
|
||||
use Crater\Policies\ItemPolicy;
|
||||
use Crater\Policies\ModulesPolicy;
|
||||
use Crater\Policies\NotePolicy;
|
||||
use Crater\Policies\OwnerPolicy;
|
||||
use Crater\Policies\PaymentPolicy;
|
||||
use Crater\Policies\RecurringInvoicePolicy;
|
||||
use Crater\Policies\ReportPolicy;
|
||||
use Crater\Policies\SettingsPolicy;
|
||||
use Crater\Policies\UserPolicy;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
\Crater\Models\Customer::class => \Crater\Policies\CustomerPolicy::class,
|
||||
\Crater\Models\Invoice::class => \Crater\Policies\InvoicePolicy::class,
|
||||
\Crater\Models\Estimate::class => \Crater\Policies\EstimatePolicy::class,
|
||||
\Crater\Models\Payment::class => \Crater\Policies\PaymentPolicy::class,
|
||||
\Crater\Models\Expense::class => \Crater\Policies\ExpensePolicy::class,
|
||||
\Crater\Models\ExpenseCategory::class => \Crater\Policies\ExpenseCategoryPolicy::class,
|
||||
\Crater\Models\PaymentMethod::class => \Crater\Policies\PaymentMethodPolicy::class,
|
||||
\Crater\Models\TaxType::class => \Crater\Policies\TaxTypePolicy::class,
|
||||
\Crater\Models\CustomField::class => \Crater\Policies\CustomFieldPolicy::class,
|
||||
\Crater\Models\User::class => \Crater\Policies\UserPolicy::class,
|
||||
\Crater\Models\Item::class => \Crater\Policies\ItemPolicy::class,
|
||||
\Silber\Bouncer\Database\Role::class => \Crater\Policies\RolePolicy::class,
|
||||
\Crater\Models\Unit::class => \Crater\Policies\UnitPolicy::class,
|
||||
\Crater\Models\RecurringInvoice::class => \Crater\Policies\RecurringInvoicePolicy::class,
|
||||
\Crater\Models\ExchangeRateProvider::class => \Crater\Policies\ExchangeRateProviderPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
Gate::define('create company', [CompanyPolicy::class, 'create']);
|
||||
Gate::define('transfer company ownership', [CompanyPolicy::class, 'transferOwnership']);
|
||||
Gate::define('delete company', [CompanyPolicy::class, 'delete']);
|
||||
|
||||
Gate::define('manage modules', [ModulesPolicy::class, 'manageModules']);
|
||||
|
||||
Gate::define('manage settings', [SettingsPolicy::class, 'manageSettings']);
|
||||
Gate::define('manage company', [SettingsPolicy::class, 'manageCompany']);
|
||||
Gate::define('manage backups', [SettingsPolicy::class, 'manageBackups']);
|
||||
Gate::define('manage file disk', [SettingsPolicy::class, 'manageFileDisk']);
|
||||
Gate::define('manage email config', [SettingsPolicy::class, 'manageEmailConfig']);
|
||||
Gate::define('manage notes', [NotePolicy::class, 'manageNotes']);
|
||||
Gate::define('view notes', [NotePolicy::class, 'viewNotes']);
|
||||
|
||||
Gate::define('send invoice', [InvoicePolicy::class, 'send']);
|
||||
Gate::define('send estimate', [EstimatePolicy::class, 'send']);
|
||||
Gate::define('send payment', [PaymentPolicy::class, 'send']);
|
||||
|
||||
Gate::define('delete multiple items', [ItemPolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple customers', [CustomerPolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple users', [UserPolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple invoices', [InvoicePolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple estimates', [EstimatePolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple expenses', [ExpensePolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple payments', [PaymentPolicy::class, 'deleteMultiple']);
|
||||
Gate::define('delete multiple recurring invoices', [RecurringInvoicePolicy::class, 'deleteMultiple']);
|
||||
|
||||
Gate::define('view dashboard', [DashboardPolicy::class, 'view']);
|
||||
|
||||
Gate::define('view report', [ReportPolicy::class, 'viewReport']);
|
||||
|
||||
Gate::define('owner only', [OwnerPolicy::class, 'managedByOwner']);
|
||||
}
|
||||
}
|
||||
21
crater/app/Providers/BroadcastServiceProvider.php
Normal file
21
crater/app/Providers/BroadcastServiceProvider.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
Broadcast::routes(["middleware" => 'api.auth']);
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
38
crater/app/Providers/DropboxServiceProvider.php
Normal file
38
crater/app/Providers/DropboxServiceProvider.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use League\Flysystem\Filesystem;
|
||||
use Spatie\Dropbox\Client as DropboxClient;
|
||||
use Spatie\FlysystemDropbox\DropboxAdapter;
|
||||
|
||||
class DropboxServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Storage::extend('dropbox', function ($app, $config) {
|
||||
$client = new DropboxClient(
|
||||
$config['token']
|
||||
);
|
||||
|
||||
return new Filesystem(new DropboxAdapter($client));
|
||||
});
|
||||
}
|
||||
}
|
||||
52
crater/app/Providers/EventServiceProvider.php
Normal file
52
crater/app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Crater\Events\UpdateFinished;
|
||||
use Crater\Listeners\Updates\v1\Version110;
|
||||
use Crater\Listeners\Updates\v2\Version200;
|
||||
use Crater\Listeners\Updates\v2\Version201;
|
||||
use Crater\Listeners\Updates\v2\Version202;
|
||||
use Crater\Listeners\Updates\v2\Version210;
|
||||
use Crater\Listeners\Updates\v3\Version300;
|
||||
use Crater\Listeners\Updates\v3\Version310;
|
||||
use Crater\Listeners\Updates\v3\Version311;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
UpdateFinished::class => [
|
||||
Version110::class,
|
||||
Version200::class,
|
||||
Version201::class,
|
||||
Version202::class,
|
||||
Version210::class,
|
||||
Version300::class,
|
||||
Version310::class,
|
||||
Version311::class,
|
||||
],
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
72
crater/app/Providers/RouteServiceProvider.php
Normal file
72
crater/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/admin/dashboard';
|
||||
|
||||
/**
|
||||
* The path to the "customer home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect customers after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const CUSTOMER_HOME = '/customer/dashboard';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
// protected $namespace = 'Crater\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->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);
|
||||
});
|
||||
}
|
||||
}
|
||||
36
crater/app/Providers/ViewServiceProvider.php
Normal file
36
crater/app/Providers/ViewServiceProvider.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Schema;
|
||||
|
||||
class ViewServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if (\Storage::disk('local')->has('database_created') && Schema::hasTable('settings')) {
|
||||
View::share('login_page_logo', get_app_setting('login_page_logo'));
|
||||
View::share('login_page_heading', get_app_setting('login_page_heading'));
|
||||
View::share('login_page_description', get_app_setting('login_page_description'));
|
||||
View::share('admin_page_title', get_app_setting('admin_page_title'));
|
||||
View::share('copyright_text', get_app_setting('copyright_text'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user