diff --git a/.env.example b/.env.example index bebfb20..8579757 100644 --- a/.env.example +++ b/.env.example @@ -42,6 +42,10 @@ CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1 +PANEL_PREFIX=dashboard +PANEL_PAGE_COUNT=30 + + REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php new file mode 100644 index 0000000..7d97102 --- /dev/null +++ b/app/Http/Controllers/Admin/UserController.php @@ -0,0 +1,13 @@ +model::orderByDesc('id')->paginate(config('app.panel.page_count')); + return view($this->listView,compact('items')); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + // + + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + */ + public function show( $user) + { + // + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($user) + { + // + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $user) + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($user) + { + // + } +} diff --git a/app/Models/Access.php b/app/Models/Access.php new file mode 100644 index 0000000..2d2c268 --- /dev/null +++ b/app/Models/Access.php @@ -0,0 +1,11 @@ + env('APP_MAINTENANCE_STORE', 'database'), ], + /* + |-------------------------------------------------------------------------- + | Panel + |-------------------------------------------------------------------------- + | These configuration options of the control panel + */ + + 'panel' => [ + 'prefix' => env('PANEL_PREFIX','dashboard'), + 'page_count' => env('PANEL_PAGE_COUNT',30), + ], + ]; diff --git a/config/media-library.php b/config/media-library.php new file mode 100644 index 0000000..bace6c8 --- /dev/null +++ b/config/media-library.php @@ -0,0 +1,262 @@ + env('MEDIA_DISK', 'public'), + + /* + * The maximum file size of an item in bytes. + * Adding a larger file will result in an exception. + */ + 'max_file_size' => 1024 * 1024 * 10, // 10MB + + /* + * This queue connection will be used to generate derived and responsive images. + * Leave empty to use the default queue connection. + */ + 'queue_connection_name' => env('QUEUE_CONNECTION', 'sync'), + + /* + * This queue will be used to generate derived and responsive images. + * Leave empty to use the default queue. + */ + 'queue_name' => '', + + /* + * By default all conversions will be performed on a queue. + */ + 'queue_conversions_by_default' => env('QUEUE_CONVERSIONS_BY_DEFAULT', true), + + /* + * The fully qualified class name of the media model. + */ + 'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class, + + /* + * When enabled, media collections will be serialised using the default + * laravel model serialization behaviour. + * + * Keep this option disabled if using Media Library Pro components (https://medialibrary.pro) + */ + 'use_default_collection_serialization' => false, + + /* + * The fully qualified class name of the model used for temporary uploads. + * + * This model is only used in Media Library Pro (https://medialibrary.pro) + */ + 'temporary_upload_model' => Spatie\MediaLibraryPro\Models\TemporaryUpload::class, + + /* + * When enabled, Media Library Pro will only process temporary uploads that were uploaded + * in the same session. You can opt to disable this for stateless usage of + * the pro components. + */ + 'enable_temporary_uploads_session_affinity' => true, + + /* + * When enabled, Media Library pro will generate thumbnails for uploaded file. + */ + 'generate_thumbnails_for_temporary_uploads' => true, + + /* + * This is the class that is responsible for naming generated files. + */ + 'file_namer' => Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer::class, + + /* + * The class that contains the strategy for determining a media file's path. + */ + 'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class, + + /* + * The class that contains the strategy for determining how to remove files. + */ + 'file_remover_class' => Spatie\MediaLibrary\Support\FileRemover\DefaultFileRemover::class, + + /* + * Here you can specify which path generator should be used for the given class. + */ + 'custom_path_generators' => [ + // Model::class => PathGenerator::class + // or + // 'model_morph_alias' => PathGenerator::class + ], + + /* + * When urls to files get generated, this class will be called. Use the default + * if your files are stored locally above the site root or on s3. + */ + 'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class, + + /* + * Moves media on updating to keep path consistent. Enable it only with a custom + * PathGenerator that uses, for example, the media UUID. + */ + 'moves_media_on_update' => false, + + /* + * Whether to activate versioning when urls to files get generated. + * When activated, this attaches a ?v=xx query string to the URL. + */ + 'version_urls' => false, + + /* + * The media library will try to optimize all converted images by removing + * metadata and applying a little bit of compression. These are + * the optimizers that will be used by default. + */ + 'image_optimizers' => [ + Spatie\ImageOptimizer\Optimizers\Jpegoptim::class => [ + '-m85', // set maximum quality to 85% + '--force', // ensure that progressive generation is always done also if a little bigger + '--strip-all', // this strips out all text information such as comments and EXIF data + '--all-progressive', // this will make sure the resulting image is a progressive one + ], + Spatie\ImageOptimizer\Optimizers\Pngquant::class => [ + '--force', // required parameter for this package + ], + Spatie\ImageOptimizer\Optimizers\Optipng::class => [ + '-i0', // this will result in a non-interlaced, progressive scanned image + '-o2', // this set the optimization level to two (multiple IDAT compression trials) + '-quiet', // required parameter for this package + ], + Spatie\ImageOptimizer\Optimizers\Svgo::class => [ + '--disable=cleanupIDs', // disabling because it is known to cause troubles + ], + Spatie\ImageOptimizer\Optimizers\Gifsicle::class => [ + '-b', // required parameter for this package + '-O3', // this produces the slowest but best results + ], + Spatie\ImageOptimizer\Optimizers\Cwebp::class => [ + '-m 6', // for the slowest compression method in order to get the best compression. + '-pass 10', // for maximizing the amount of analysis pass. + '-mt', // multithreading for some speed improvements. + '-q 90', //quality factor that brings the least noticeable changes. + ], + Spatie\ImageOptimizer\Optimizers\Avifenc::class => [ + '-a cq-level=23', // constant quality level, lower values mean better quality and greater file size (0-63). + '-j all', // number of jobs (worker threads, "all" uses all available cores). + '--min 0', // min quantizer for color (0-63). + '--max 63', // max quantizer for color (0-63). + '--minalpha 0', // min quantizer for alpha (0-63). + '--maxalpha 63', // max quantizer for alpha (0-63). + '-a end-usage=q', // rate control mode set to Constant Quality mode. + '-a tune=ssim', // SSIM as tune the encoder for distortion metric. + ], + ], + + /* + * These generators will be used to create an image of media files. + */ + 'image_generators' => [ + Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class, + Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class, + Spatie\MediaLibrary\Conversions\ImageGenerators\Avif::class, + Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class, + Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class, + Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class, + ], + + /* + * The path where to store temporary files while performing image conversions. + * If set to null, storage_path('media-library/temp') will be used. + */ + 'temporary_directory_path' => null, + + /* + * The engine that should perform the image conversions. + * Should be either `gd` or `imagick`. + */ + 'image_driver' => env('IMAGE_DRIVER', 'gd'), + + /* + * FFMPEG & FFProbe binaries paths, only used if you try to generate video + * thumbnails and have installed the php-ffmpeg/php-ffmpeg composer + * dependency. + */ + 'ffmpeg_path' => env('FFMPEG_PATH', '/usr/bin/ffmpeg'), + 'ffprobe_path' => env('FFPROBE_PATH', '/usr/bin/ffprobe'), + + /* + * Here you can override the class names of the jobs used by this package. Make sure + * your custom jobs extend the ones provided by the package. + */ + 'jobs' => [ + 'perform_conversions' => Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class, + 'generate_responsive_images' => Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class, + ], + + /* + * When using the addMediaFromUrl method you may want to replace the default downloader. + * This is particularly useful when the url of the image is behind a firewall and + * need to add additional flags, possibly using curl. + */ + 'media_downloader' => Spatie\MediaLibrary\Downloaders\DefaultDownloader::class, + + 'remote' => [ + /* + * Any extra headers that should be included when uploading media to + * a remote disk. Even though supported headers may vary between + * different drivers, a sensible default has been provided. + * + * Supported by S3: CacheControl, Expires, StorageClass, + * ServerSideEncryption, Metadata, ACL, ContentEncoding + */ + 'extra_headers' => [ + 'CacheControl' => 'max-age=604800', + ], + ], + + 'responsive_images' => [ + /* + * This class is responsible for calculating the target widths of the responsive + * images. By default we optimize for filesize and create variations that each are 30% + * smaller than the previous one. More info in the documentation. + * + * https://docs.spatie.be/laravel-medialibrary/v9/advanced-usage/generating-responsive-images + */ + 'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class, + + /* + * By default rendering media to a responsive image will add some javascript and a tiny placeholder. + * This ensures that the browser can already determine the correct layout. + * When disabled, no tiny placeholder is generated. + */ + 'use_tiny_placeholders' => true, + + /* + * This class will generate the tiny placeholder used for progressive image loading. By default + * the media library will use a tiny blurred jpg image. + */ + 'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class, + ], + + /* + * When enabling this option, a route will be registered that will enable + * the Media Library Pro Vue and React components to move uploaded files + * in a S3 bucket to their right place. + */ + 'enable_vapor_uploads' => env('ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS', false), + + /* + * When converting Media instances to response the media library will add + * a `loading` attribute to the `img` tag. Here you can set the default + * value of that attribute. + * + * Possible values: 'lazy', 'eager', 'auto' or null if you don't want to set any loading instruction. + * + * More info: https://css-tricks.com/native-lazy-loading/ + */ + 'default_loading_attribute_value' => null, + + /* + * You can specify a prefix for that is used for storing all media. + * If you set this to `/my-subdir`, all your media will be stored in a `/my-subdir` directory. + */ + 'prefix' => env('MEDIA_PREFIX', ''), +]; diff --git a/database/factories/AccessFactory.php b/database/factories/AccessFactory.php new file mode 100644 index 0000000..70071f4 --- /dev/null +++ b/database/factories/AccessFactory.php @@ -0,0 +1,23 @@ + + */ +class AccessFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php new file mode 100644 index 0000000..1ba08d5 --- /dev/null +++ b/database/factories/AddressFactory.php @@ -0,0 +1,23 @@ + + */ +class AddressFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/AdvFactory.php b/database/factories/AdvFactory.php new file mode 100644 index 0000000..018e28f --- /dev/null +++ b/database/factories/AdvFactory.php @@ -0,0 +1,23 @@ + + */ +class AdvFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/AttachmentFactory.php b/database/factories/AttachmentFactory.php new file mode 100644 index 0000000..9b010d3 --- /dev/null +++ b/database/factories/AttachmentFactory.php @@ -0,0 +1,23 @@ + + */ +class AttachmentFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php new file mode 100644 index 0000000..43be7f4 --- /dev/null +++ b/database/factories/CategoryFactory.php @@ -0,0 +1,23 @@ + + */ +class CategoryFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ClipFactory.php b/database/factories/ClipFactory.php new file mode 100644 index 0000000..d237bf7 --- /dev/null +++ b/database/factories/ClipFactory.php @@ -0,0 +1,23 @@ + + */ +class ClipFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/CommentFactory.php b/database/factories/CommentFactory.php new file mode 100644 index 0000000..09414e4 --- /dev/null +++ b/database/factories/CommentFactory.php @@ -0,0 +1,23 @@ + + */ +class CommentFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php new file mode 100644 index 0000000..9d09856 --- /dev/null +++ b/database/factories/ContactFactory.php @@ -0,0 +1,23 @@ + + */ +class ContactFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/CreditFactory.php b/database/factories/CreditFactory.php new file mode 100644 index 0000000..92c98fc --- /dev/null +++ b/database/factories/CreditFactory.php @@ -0,0 +1,23 @@ + + */ +class CreditFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php new file mode 100644 index 0000000..b077ca2 --- /dev/null +++ b/database/factories/CustomerFactory.php @@ -0,0 +1,23 @@ + + */ +class CustomerFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/DiscountFactory.php b/database/factories/DiscountFactory.php new file mode 100644 index 0000000..8beceab --- /dev/null +++ b/database/factories/DiscountFactory.php @@ -0,0 +1,23 @@ + + */ +class DiscountFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/GalleryFactory.php b/database/factories/GalleryFactory.php new file mode 100644 index 0000000..43a6ab6 --- /dev/null +++ b/database/factories/GalleryFactory.php @@ -0,0 +1,23 @@ + + */ +class GalleryFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/GroupFactory.php b/database/factories/GroupFactory.php new file mode 100644 index 0000000..22f33d1 --- /dev/null +++ b/database/factories/GroupFactory.php @@ -0,0 +1,23 @@ + + */ +class GroupFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ImagesFactory.php b/database/factories/ImagesFactory.php new file mode 100644 index 0000000..701a046 --- /dev/null +++ b/database/factories/ImagesFactory.php @@ -0,0 +1,23 @@ + + */ +class ImagesFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php new file mode 100644 index 0000000..83320f1 --- /dev/null +++ b/database/factories/InvoiceFactory.php @@ -0,0 +1,23 @@ + + */ +class InvoiceFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ItemFactory.php b/database/factories/ItemFactory.php new file mode 100644 index 0000000..b543f60 --- /dev/null +++ b/database/factories/ItemFactory.php @@ -0,0 +1,23 @@ + + */ +class ItemFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/MenuFactory.php b/database/factories/MenuFactory.php new file mode 100644 index 0000000..9de97b0 --- /dev/null +++ b/database/factories/MenuFactory.php @@ -0,0 +1,23 @@ + + */ +class MenuFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/MenuItemFactory.php b/database/factories/MenuItemFactory.php new file mode 100644 index 0000000..2f24578 --- /dev/null +++ b/database/factories/MenuItemFactory.php @@ -0,0 +1,23 @@ + + */ +class MenuItemFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php new file mode 100644 index 0000000..a033f01 --- /dev/null +++ b/database/factories/PaymentFactory.php @@ -0,0 +1,23 @@ + + */ +class PaymentFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php new file mode 100644 index 0000000..55f1633 --- /dev/null +++ b/database/factories/PostFactory.php @@ -0,0 +1,23 @@ + + */ +class PostFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php new file mode 100644 index 0000000..0a526cd --- /dev/null +++ b/database/factories/ProductFactory.php @@ -0,0 +1,23 @@ + + */ +class ProductFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/PropFactory.php b/database/factories/PropFactory.php new file mode 100644 index 0000000..b1df14b --- /dev/null +++ b/database/factories/PropFactory.php @@ -0,0 +1,23 @@ + + */ +class PropFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/QuantityFactory.php b/database/factories/QuantityFactory.php new file mode 100644 index 0000000..f46dc4c --- /dev/null +++ b/database/factories/QuantityFactory.php @@ -0,0 +1,23 @@ + + */ +class QuantityFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/SMSFactory.php b/database/factories/SMSFactory.php new file mode 100644 index 0000000..578fe6f --- /dev/null +++ b/database/factories/SMSFactory.php @@ -0,0 +1,23 @@ + + */ +class SMSFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/SettingFactory.php b/database/factories/SettingFactory.php new file mode 100644 index 0000000..eb11ef9 --- /dev/null +++ b/database/factories/SettingFactory.php @@ -0,0 +1,23 @@ + + */ +class SettingFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/SliderFactory.php b/database/factories/SliderFactory.php new file mode 100644 index 0000000..8c5922c --- /dev/null +++ b/database/factories/SliderFactory.php @@ -0,0 +1,23 @@ + + */ +class SliderFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/TransportFactory.php b/database/factories/TransportFactory.php new file mode 100644 index 0000000..f79ad34 --- /dev/null +++ b/database/factories/TransportFactory.php @@ -0,0 +1,23 @@ + + */ +class TransportFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/XLangFactory.php b/database/factories/XLangFactory.php new file mode 100644 index 0000000..628a04e --- /dev/null +++ b/database/factories/XLangFactory.php @@ -0,0 +1,23 @@ + + */ +class XLangFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/0002_05_07_125311_create_x_langs_table.php b/database/migrations/0002_05_07_125311_create_x_langs_table.php new file mode 100644 index 0000000..3e214cb --- /dev/null +++ b/database/migrations/0002_05_07_125311_create_x_langs_table.php @@ -0,0 +1,27 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('x_langs'); + } +}; diff --git a/database/migrations/2024_05_06_125500_create_media_table.php b/database/migrations/2024_05_06_125500_create_media_table.php new file mode 100644 index 0000000..47a4be9 --- /dev/null +++ b/database/migrations/2024_05_06_125500_create_media_table.php @@ -0,0 +1,32 @@ +id(); + + $table->morphs('model'); + $table->uuid()->nullable()->unique(); + $table->string('collection_name'); + $table->string('name'); + $table->string('file_name'); + $table->string('mime_type')->nullable(); + $table->string('disk'); + $table->string('conversions_disk')->nullable(); + $table->unsignedBigInteger('size'); + $table->json('manipulations'); + $table->json('custom_properties'); + $table->json('generated_conversions'); + $table->json('responsive_images'); + $table->unsignedInteger('order_column')->nullable()->index(); + + $table->nullableTimestamps(); + }); + } +}; diff --git a/database/migrations/2024_05_07_123332_create_groups_table.php b/database/migrations/2024_05_07_123332_create_groups_table.php new file mode 100644 index 0000000..e8e6049 --- /dev/null +++ b/database/migrations/2024_05_07_123332_create_groups_table.php @@ -0,0 +1,33 @@ +id(); + $table->text('name'); + $table->string('slug', 128)->unique(); + $table->text('description')->nullable(); + $table->integer('sort')->default(0); + $table->unsignedInteger('parent_id')->nullable()->default(null)->index(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('groups'); + } +}; diff --git a/database/migrations/2024_05_07_123414_create_posts_table.php b/database/migrations/2024_05_07_123414_create_posts_table.php new file mode 100644 index 0000000..bca0219 --- /dev/null +++ b/database/migrations/2024_05_07_123414_create_posts_table.php @@ -0,0 +1,58 @@ +id(); + $table->text('title'); + $table->string('slug')->unique(); + $table->string('subtitle', 4096); + $table->text('body'); + $table->unsignedBigInteger('category_id'); + $table->unsignedBigInteger('user_id'); + $table->unsignedTinyInteger('status')->default(0); + $table->boolean('is_breaking')->default(0); + $table->boolean('is_pinned')->default(0); + $table->string('hash', 14)->unique(); + $table->unsignedInteger('like')->default(0); + $table->unsignedInteger('dislike')->default(0); + $table->string('icon', 128)->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + $table->foreign('category_id') + ->references('id')->on('groups'); + }); + + Schema::create('group_post', function (Blueprint $table) { + + $table->unsignedBigInteger('group_id'); + $table->unsignedBigInteger('post_id'); + + $table->foreign('group_id')->on('groups') + ->references('id')->onDelete('cascade'); + $table->foreign('post_id')->on('posts') + ->references('id')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('posts'); + Schema::dropIfExists('group_post'); + } +}; diff --git a/database/migrations/2024_05_07_123628_create_comments_table.php b/database/migrations/2024_05_07_123628_create_comments_table.php new file mode 100644 index 0000000..a059320 --- /dev/null +++ b/database/migrations/2024_05_07_123628_create_comments_table.php @@ -0,0 +1,37 @@ +id(); + $table->text('body'); + $table->string('name', 100)->nullable(); + $table->string('email', 100)->nullable(); + $table->unsignedBigInteger('member_id')->nullable(); + $table->ipAddress('ip'); + $table->tinyInteger('status')->default('0'); + $table->unsignedBigInteger('sub_comment_id')->nullable()->default(null); + $table->morphs('commentable'); + $table->morphs('commentator'); + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('comments'); + } +}; diff --git a/database/migrations/2024_05_07_124252_create_admin_logs_table.php b/database/migrations/2024_05_07_124252_create_admin_logs_table.php new file mode 100644 index 0000000..72b17d4 --- /dev/null +++ b/database/migrations/2024_05_07_124252_create_admin_logs_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedBigInteger('user_id'); + $table->string('action'); + $table->morphs('loggable'); + $table->timestamps(); + $table->foreign('user_id') + ->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('admin_logs'); + } +}; diff --git a/database/migrations/2024_05_07_124306_create_guest_logs_table.php b/database/migrations/2024_05_07_124306_create_guest_logs_table.php new file mode 100644 index 0000000..ab8f352 --- /dev/null +++ b/database/migrations/2024_05_07_124306_create_guest_logs_table.php @@ -0,0 +1,30 @@ +id(); + $table->ipAddress('ip'); + $table->string('action'); + $table->morphs('loggable'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('guest_logs'); + } +}; diff --git a/database/migrations/2024_05_07_124417_create_galleries_table.php b/database/migrations/2024_05_07_124417_create_galleries_table.php new file mode 100644 index 0000000..c1295af --- /dev/null +++ b/database/migrations/2024_05_07_124417_create_galleries_table.php @@ -0,0 +1,33 @@ +id(); + $table->text('title'); + $table->string('slug')->unique(); + $table->text('description')->nullable(); + $table->unsignedTinyInteger('status')->default(0); + $table->unsignedBigInteger('user_id'); + $table->timestamps(); + $table->foreign('user_id')->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('galleries'); + } +}; diff --git a/database/migrations/2024_05_07_124445_create_images_table.php b/database/migrations/2024_05_07_124445_create_images_table.php new file mode 100644 index 0000000..f565f2d --- /dev/null +++ b/database/migrations/2024_05_07_124445_create_images_table.php @@ -0,0 +1,36 @@ +id(); + $table->unsignedBigInteger('gallery_id'); + $table->unsignedBigInteger('user_id'); + $table->text('title')->nullable(); + $table->unsignedInteger('sort')->default(0); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + $table->foreign('gallery_id') + ->references('id')->on('galleries'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('images'); + } +}; diff --git a/database/migrations/2024_05_07_124521_create_clips_table.php b/database/migrations/2024_05_07_124521_create_clips_table.php new file mode 100644 index 0000000..49c1ea6 --- /dev/null +++ b/database/migrations/2024_05_07_124521_create_clips_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('title'); + $table->string('slug')->unique(); + $table->text('body')->nullable(); + $table->string('file', 2048)->nullable(); + $table->string('cover', 2048)->nullable(); + $table->unsignedBigInteger('user_id'); + $table->boolean('active')->default(true); + $table->softDeletes(); + $table->timestamps(); + $table->foreign('user_id') + ->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('clips'); + } +}; diff --git a/database/migrations/2024_05_07_124607_create_sliders_table.php b/database/migrations/2024_05_07_124607_create_sliders_table.php new file mode 100644 index 0000000..8e2a7ed --- /dev/null +++ b/database/migrations/2024_05_07_124607_create_sliders_table.php @@ -0,0 +1,34 @@ +id(); + $table->text('body'); + $table->string('image'); + $table->string('tag')->nullable(); + $table->unsignedBigInteger('user_id'); + $table->boolean('active')->default(true); + $table->timestamps(); + $table->foreign('user_id') + ->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sliders'); + } +}; diff --git a/database/migrations/2024_05_07_124745_create_menus_table.php b/database/migrations/2024_05_07_124745_create_menus_table.php new file mode 100644 index 0000000..6bdbe4f --- /dev/null +++ b/database/migrations/2024_05_07_124745_create_menus_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('name'); + $table->unsignedBigInteger('user_id'); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('menus'); + } +}; diff --git a/database/migrations/2024_05_07_124821_create_menu_items_table.php b/database/migrations/2024_05_07_124821_create_menu_items_table.php new file mode 100644 index 0000000..5f99448 --- /dev/null +++ b/database/migrations/2024_05_07_124821_create_menu_items_table.php @@ -0,0 +1,42 @@ +id(); + $table->text('title'); +// $table->morphs('menuable')->nullable();; + $table->unsignedBigInteger('menuable_id')->nullable(); + $table->string('menuable_type')->nullable(); + $table->string('kind')->nullable(); + $table->text('meta')->nullable(); + $table->unsignedInteger('parent')->nullable()->default(null)->index(); + $table->unsignedInteger('sort')->default(0); + $table->unsignedBigInteger('user_id'); + $table->unsignedBigInteger('menu_id'); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + $table->foreign('menu_id') + ->references('id')->on('menus'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('menu_items'); + } +}; diff --git a/database/migrations/2024_05_07_124917_create_advs_table.php b/database/migrations/2024_05_07_124917_create_advs_table.php new file mode 100644 index 0000000..91f3742 --- /dev/null +++ b/database/migrations/2024_05_07_124917_create_advs_table.php @@ -0,0 +1,39 @@ +id(); + $table->string('title'); + $table->timestamp('expire'); + $table->string('image'); + $table->unsignedInteger('max_click')->default(0); + $table->unsignedInteger('click')->default(0); + $table->boolean('active')->default(true); + $table->string('link'); + $table->unsignedBigInteger('user_id'); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('advs'); + } +}; diff --git a/database/migrations/2024_05_07_125838_create_categories_table.php b/database/migrations/2024_05_07_125838_create_categories_table.php new file mode 100644 index 0000000..b062d45 --- /dev/null +++ b/database/migrations/2024_05_07_125838_create_categories_table.php @@ -0,0 +1,34 @@ +id(); + $table->text('name'); + $table->string('slug',128)->unique(); + $table->text('description')->nullable(); + $table->integer('sort')->default(0); + $table->string('image')->nullable()->default(null); + $table->unsignedInteger('parent_id')->nullable()->default(null)->index(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('categories'); + } +}; diff --git a/database/migrations/2024_05_07_125920_create_customers_table.php b/database/migrations/2024_05_07_125920_create_customers_table.php new file mode 100644 index 0000000..25e9068 --- /dev/null +++ b/database/migrations/2024_05_07_125920_create_customers_table.php @@ -0,0 +1,43 @@ +id(); + $table->string('name',255)->nullable()->default(null); + $table->string('email')->unique()->nullable()->default(null); + $table->timestamp('email_verified_at')->nullable()->default(null); + $table->string('password')->nullable()->default(null); + + $table->unsignedInteger('state')->nullable()->default(null); + $table->unsignedInteger('city')->nullable()->default(null); + $table->string('mobile',15)->unique()->nullable()->default(null); + $table->string('address',2048)->nullable()->default(null); + $table->string('postal_code',15)->nullable()->default(null); + $table->string('sms',10)->nullable()->default(null); + $table->string('code',10)->nullable()->default(null); + $table->boolean('colleague')->default(false); + $table->text('description')->default(null)->nullable(); + $table->unsignedBigInteger('credit')->default(0); + $table->rememberToken(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('customers'); + } +}; diff --git a/database/migrations/2024_05_07_130016_create_products_table.php b/database/migrations/2024_05_07_130016_create_products_table.php new file mode 100644 index 0000000..36379ff --- /dev/null +++ b/database/migrations/2024_05_07_130016_create_products_table.php @@ -0,0 +1,62 @@ +id(); + $table->text('name'); + $table->string('slug')->unique()->index(); + $table->longText('description')->nullable(); + $table->text('excerpt')->nullable()->comment('Quick summary for product. This will appear on the product page under the product name and for SEO purpose.'); + $table->string('sku')->nullable()->unique()->comment('SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.'); + $table->boolean('virtual')->nullable()->default(false)->index()->comment('If this product is a non-physical item, for example a service, which does not need shipping.'); + $table->boolean('downloadable')->nullable()->default(false)->index()->comment('If purchasing this product gives a customer access to a downloadable file, e.g. software'); + $table->unsignedBigInteger('price')->nullable()->default(null)->index(); + $table->unsignedBigInteger('category_id')->comment('main category id'); + $table->unsignedBigInteger('user_id'); + $table->boolean('on_sale')->nullable()->default(true)->index(); + $table->unsignedBigInteger('stock_quantity')->nullable()->default(0); + $table->enum('stock_status',['IN_STOCK','OUT_STOCK','BACK_ORDER'])->nullable()->default('IN_STOCK')->index(); + $table->unsignedBigInteger('rating_count')->nullable()->default(0); + $table->decimal('average_rating',3,2)->unsigned()->nullable()->default(0.00); + $table->unsignedBigInteger('total_sales')->nullable()->default(0); + $table->boolean('active')->default(true); + $table->unsignedBigInteger('view_count')->default(0); + $table->unsignedBigInteger('sell_count')->default(0); + $table->unsignedTinyInteger('image_index')->default(0); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('user_id') + ->references('id')->on('users'); + $table->foreign('category_id') + ->references('id')->on('categories'); + }); + + Schema::create('category_product', function (Blueprint $table) { + $table->unsignedBigInteger('category_id'); + $table->unsignedBigInteger('product_id'); + + $table->foreign('category_id')->on('categories')->references('id')->onDelete('cascade'); + $table->foreign('product_id')->on('products')->references('id')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('products'); + Schema::dropIfExists('category_product'); + } +}; diff --git a/database/migrations/2024_05_07_130324_create_props_table.php b/database/migrations/2024_05_07_130324_create_props_table.php new file mode 100644 index 0000000..d6291c7 --- /dev/null +++ b/database/migrations/2024_05_07_130324_create_props_table.php @@ -0,0 +1,47 @@ +id(); + $table->string('name',90)->unique(); + $table->string('label'); + $table->string('width',300)->default('col-md-6'); + $table->boolean('required')->default(false); + $table->boolean('searchable')->default(true); + $table->string('type',60); + $table->string('unit',50)->nullable()->default(''); + $table->unsignedInteger('sort')->default(null)->nullable(); + $table->longText('options')->nullable(); + $table->boolean('priceable')->default(false); + $table->string('icon',128)->nullable()->default(null); + $table->timestamps(); + $table->softDeletes(); + }); + Schema::create('category_prop', function (Blueprint $table) { + $table->unsignedBigInteger('category_id'); + $table->unsignedBigInteger('prop_id'); + $table->foreign('category_id')->on('categories')->references('id')->onDelete('cascade'); + $table->foreign('prop_id')->on('props')->references('id')->onDelete('cascade'); + }); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('props'); + Schema::dropIfExists('category_prop'); + } +}; diff --git a/database/migrations/2024_05_07_130806_create_invoices_table.php b/database/migrations/2024_05_07_130806_create_invoices_table.php new file mode 100644 index 0000000..62ad962 --- /dev/null +++ b/database/migrations/2024_05_07_130806_create_invoices_table.php @@ -0,0 +1,52 @@ +id(); + $table->unsignedBigInteger('customer_id'); + $table->enum("status", ['PENDING', 'PROCESSING', 'COMPLETED', 'CANCELED', 'FAILED',])->nullable()->default("PENDING"); + $table->unsignedBigInteger('total_price')->nullable()->default(0); + $table->json('meta')->nullable(); + $table->unsignedBigInteger('discount_id')->nullable()->default(null); + $table->text('desc')->nullable()->default(null); + $table->string('hash',32)->nullable()->default(null)->unique(); + + $table->unsignedBigInteger('transport_id')->nullable()->default(null); + $table->unsignedBigInteger('transport_price')->default(0); + $table->unsignedBigInteger('credit_price')->default(0); + + $table->boolean('reserve')->default(0); + $table->unsignedBigInteger('invoice_id')->nullable()->default(null); + + $table->string('address_alt')->default(null)->nullable(); + $table->unsignedBigInteger('address_id')->default(null)->nullable(); + $table->string('tracking_code')->default(null)->nullable(); + $table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade'); + $table->foreign('discount_id')->references('id')->on('discounts')->onDelete('cascade'); + $table->foreign('transport_id')->references('id')->on('transports')->onDelete('cascade'); + $table->foreign('address_id')->references('id')->on('addresses')->onDelete('cascade'); + $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('invoices'); + } +}; diff --git a/database/migrations/2024_05_07_132601_create_items_table.php b/database/migrations/2024_05_07_132601_create_items_table.php new file mode 100644 index 0000000..219e48c --- /dev/null +++ b/database/migrations/2024_05_07_132601_create_items_table.php @@ -0,0 +1,39 @@ +id(); + $table->unsignedBigInteger('invoice_id'); + $table->unsignedBigInteger('product_id'); + $table->unsignedBigInteger('quantity_id'); + $table->integer('count')->nullable()->default(1); + $table->unsignedInteger('price_total'); + $table->json('data')->nullable()->default(null);; + $table->timestamps(); + + $table->foreign('invoice_id')->references('id') + ->on('invoices')->onDelete('cascade'); +// $table->foreign('quantity_id')->references('id')->on('quantities')->onDelete('cascade'); + $table->foreign('product_id')->references('id') + ->on('products')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('items'); + } +}; diff --git a/database/migrations/2024_05_07_132756_create_payments_table.php b/database/migrations/2024_05_07_132756_create_payments_table.php new file mode 100644 index 0000000..a0b433d --- /dev/null +++ b/database/migrations/2024_05_07_132756_create_payments_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('invoice_id'); + $table->unsignedBigInteger('amount')->nullable(); + $table->enum("type", \App\Models\Payment::$types)->nullable()->default(\App\Models\Payment::$types[0]); + $table->enum("status", \App\Models\Payment::$status)->nullable()->default(\App\Models\Payment::$status[0]); + $table->string('order_id')->unique(); + $table->string('reference_id')->nullable(); + $table->text('comment')->nullable(); + $table->json('meta')->nullable(); + $table->timestamps(); + + $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('payments'); + } +}; diff --git a/database/migrations/2024_05_07_133136_create_settings_table.php b/database/migrations/2024_05_07_133136_create_settings_table.php new file mode 100644 index 0000000..e61c7b0 --- /dev/null +++ b/database/migrations/2024_05_07_133136_create_settings_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('section'); + $table->string('type'); + $table->string('title'); + $table->boolean('active')->default(true); + $table->string('key')->unique(); + $table->text('value')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('settings'); + } +}; diff --git a/database/migrations/2024_05_07_133220_create_quantities_table.php b/database/migrations/2024_05_07_133220_create_quantities_table.php new file mode 100644 index 0000000..c262c76 --- /dev/null +++ b/database/migrations/2024_05_07_133220_create_quantities_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('product_id'); + $table->unsignedInteger('count')->default(0); + $table->unsignedBigInteger('price')->default(0); + $table->unsignedBigInteger('image')->default(null)->nullable(); + $table->longText('data')->nullable()->default(null); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('product_id') + ->references('id')->on('products') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('quantities'); + } +}; diff --git a/database/migrations/2024_05_07_133303_create_discounts_table.php b/database/migrations/2024_05_07_133303_create_discounts_table.php new file mode 100644 index 0000000..702c41b --- /dev/null +++ b/database/migrations/2024_05_07_133303_create_discounts_table.php @@ -0,0 +1,36 @@ +id(); + $table->unsignedBigInteger('product_id')->nullable()->default(null); + $table->enum('type',['price','percent']); + $table->string('code',100)->nullable()->default(null); + $table->unsignedBigInteger('amount'); + $table->dateTime('expire')->default(null)->nullable(); + $table->timestamps(); + + $table->softDeletes(); + $table->foreign('product_id')->on('products') + ->references('id')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('discounts'); + } +}; diff --git a/database/migrations/2024_05_07_133304_create_sms_table.php b/database/migrations/2024_05_07_133304_create_sms_table.php new file mode 100644 index 0000000..788076f --- /dev/null +++ b/database/migrations/2024_05_07_133304_create_sms_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('mobile',15); + $table->text('text'); + $table->string('code',50)->nullable()->default(null); + $table->ipAddress('ip'); + $table->enum('user',['user','system'])->default('user'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sms'); + } +}; diff --git a/database/migrations/2024_05_07_133601_create_transports_table.php b/database/migrations/2024_05_07_133601_create_transports_table.php new file mode 100644 index 0000000..8f308e3 --- /dev/null +++ b/database/migrations/2024_05_07_133601_create_transports_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('title',250); + $table->text('description')->nullable()->default(null); + $table->unsignedInteger('sort')->default(0); + $table->boolean('is_default')->default(0); + $table->unsignedInteger('price')->default(0); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('transports'); + } +}; diff --git a/database/migrations/2024_05_07_133653_create_attachments_table.php b/database/migrations/2024_05_07_133653_create_attachments_table.php new file mode 100644 index 0000000..f63ca4d --- /dev/null +++ b/database/migrations/2024_05_07_133653_create_attachments_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('title'); + $table->string('subtitle'); + $table->text('body'); + $table->string('file',2048); + $table->string('type'); + $table->unsignedBigInteger('size')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('attachments'); + } +}; diff --git a/database/migrations/2024_05_07_133841_customer_product_favorite.php b/database/migrations/2024_05_07_133841_customer_product_favorite.php new file mode 100644 index 0000000..5c455d6 --- /dev/null +++ b/database/migrations/2024_05_07_133841_customer_product_favorite.php @@ -0,0 +1,32 @@ +unsignedBigInteger('customer_id'); + $table->unsignedBigInteger('product_id'); + $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade'); + $table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + Schema::dropIfExists('customer_product'); + } +}; diff --git a/database/migrations/2024_05_07_133943_create_contacts_table.php b/database/migrations/2024_05_07_133943_create_contacts_table.php new file mode 100644 index 0000000..22f9fae --- /dev/null +++ b/database/migrations/2024_05_07_133943_create_contacts_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('full_name'); + $table->string('email'); + $table->string('subject')->nullable(); + $table->string('phone',15); + $table->text('body'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('contacts'); + } +}; diff --git a/database/migrations/2024_05_07_134028_create_credits_table.php b/database/migrations/2024_05_07_134028_create_credits_table.php new file mode 100644 index 0000000..edf5f96 --- /dev/null +++ b/database/migrations/2024_05_07_134028_create_credits_table.php @@ -0,0 +1,36 @@ +id(); + $table->unsignedBigInteger('amount'); + $table->unsignedBigInteger('customer_id'); + $table->unsignedBigInteger('invoice_id'); + $table->text('data')->nullable()->default(null); + $table->softDeletes(); + $table->timestamps(); + $table->foreign('invoice_id')->references('id') + ->on('invoices')->onDelete('cascade'); + $table->foreign('customer_id')->references('id') + ->on('customers')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('credits'); + } +}; diff --git a/database/migrations/2024_05_07_134141_create_addresses_table.php b/database/migrations/2024_05_07_134141_create_addresses_table.php new file mode 100644 index 0000000..3032303 --- /dev/null +++ b/database/migrations/2024_05_07_134141_create_addresses_table.php @@ -0,0 +1,37 @@ +id(); + $table->text('address'); + $table->unsignedBigInteger('customer_id'); + $table->double('lat')->nullable(); + $table->double('lng')->nullable(); + $table->unsignedInteger('state')->nullable()->default(null); + $table->unsignedInteger('city')->nullable()->default(null); + $table->json('data'); + $table->timestamps(); + $table->softDeletes(); + $table->foreign('customer_id')->references('id') + ->on('customers')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('addresses'); + } +}; diff --git a/database/migrations/2024_05_07_134341_create_accesses_table.php b/database/migrations/2024_05_07_134341_create_accesses_table.php new file mode 100644 index 0000000..ec7655a --- /dev/null +++ b/database/migrations/2024_05_07_134341_create_accesses_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('user_id'); + $table->string('route'); + $table->boolean('owner')->default(false); + $table->timestamps(); + + $table->foreign('user_id')->references('id') + ->on('users')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('accesses'); + } +}; diff --git a/database/seeders/AccessSeeder.php b/database/seeders/AccessSeeder.php new file mode 100644 index 0000000..b61baba --- /dev/null +++ b/database/seeders/AccessSeeder.php @@ -0,0 +1,17 @@ + false]); Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); + +Route::prefix(config('app.panel.prefix'))->name('admin.')->group( + function () { + Route::group( + ['middleware' => ['auth']], + function () { + Route::prefix('users')->name('user.')->group( + function () { + Route::get('', [\App\Http\Controllers\Admin\UserController::class, 'index'])->name('index'); + Route::get('create', [\App\Http\Controllers\Admin\UserController::class, 'create'])->name('create'); + Route::post('store', [\App\Http\Controllers\Admin\UserController::class, 'store'])->name('store'); + Route::get('edit/{user}', [\App\Http\Controllers\Admin\UserController::class, 'edit'])->name('edit'); + Route::post('update/{user}', [\App\Http\Controllers\Admin\UserController::class, 'update'])->name('update'); + Route::get('delete/{user}', [\App\Http\Controllers\Admin\UserController::class, 'destroy'])->name('delete'); + Route::post('bulk', [\App\Http\Controllers\Admin\UserController::class, "bulk"])->name('bulk'); + }); + }); + });