95 lines
2.6 KiB
PHP
95 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\CMS\Forms\ContactUS;
|
|
use App\Models\CMS\Marketing\Newsletter;
|
|
use App\Models\CMS\Marketing\NewsletterUser;
|
|
use App\Models\CMS\Media\Banner;
|
|
use App\Models\CMS\Media\Carousel;
|
|
use App\Models\CMS\Media\Gallery;
|
|
use App\Models\Ecommerce\Channel\Channel;
|
|
use App\Models\Ecommerce\Product\Brand\Brand;
|
|
use App\Models\Ecommerce\Product\Category\Category;
|
|
use App\Models\Ecommerce\Product\Collection\Collection;
|
|
use App\Models\Ecommerce\Product\Coupon\Coupon;
|
|
use App\Models\Ecommerce\Product\Inventory\Inventory;
|
|
use App\Models\Ecommerce\Product\Order\Order;
|
|
use App\Models\Ecommerce\Product\Product\Product;
|
|
use App\Models\Ecommerce\Product\Property\Attribute;
|
|
use App\Models\Ecommerce\Product\Review\Review;
|
|
use App\Models\Legal\LegalPage;
|
|
use App\Models\Post\PostBranch;
|
|
use App\Models\System\Roles\Permission;
|
|
use App\Models\System\Roles\Role;
|
|
use App\Models\System\Settings\Location\Province;
|
|
use App\Models\System\Settings\Payments\PaymentType;
|
|
use App\Models\System\VersionManagement\AppVersion;
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
class TestController extends Controller
|
|
{
|
|
public function ok()
|
|
{
|
|
|
|
if (! app()->isProduction()) {
|
|
auth()->login(User::where('email', 'nurmuhammet@mail.com')->first());
|
|
|
|
return back();
|
|
}
|
|
|
|
abort(404);
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$models = [
|
|
Order::class,
|
|
Product::class,
|
|
Attribute::class,
|
|
Inventory::class,
|
|
Channel::class,
|
|
Collection::class,
|
|
Category::class,
|
|
Brand::class,
|
|
User::class,
|
|
// Payout::class,
|
|
Banner::class,
|
|
Carousel::class,
|
|
Gallery::class,
|
|
LegalPage::class,
|
|
NewsletterUser::class,
|
|
Newsletter::class,
|
|
Coupon::class,
|
|
Review::class,
|
|
ContactUS::class,
|
|
Role::class,
|
|
Permission::class,
|
|
Province::class,
|
|
PostBranch::class,
|
|
PaymentType::class,
|
|
AppVersion::class,
|
|
];
|
|
|
|
$data = [];
|
|
collect($models)->each(function (string $model) use (&$data) {
|
|
$modelNamespace = str_replace(
|
|
'\\',
|
|
'/',
|
|
str_replace('App\\Models\\', '', $model)
|
|
);
|
|
$modelName = $modelNamespace.'Policy';
|
|
|
|
$data[] = [
|
|
'key' => $modelName,
|
|
'value' => $modelNamespace,
|
|
];
|
|
|
|
Artisan::call("make:policy {$modelName} --model={$modelNamespace}");
|
|
});
|
|
|
|
return $data;
|
|
}
|
|
}
|