first change

This commit is contained in:
2025-07-27 17:40:56 +05:45
commit f8b9a6725b
3152 changed files with 229528 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace Modules\Drive\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class DriveController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('drive::drive.index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('drive::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('drive::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('drive::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

View File

View File

@@ -0,0 +1,135 @@
<?php
namespace Modules\Drive\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Traits\PathNamespace;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
class DriveServiceProvider extends ServiceProvider
{
use PathNamespace;
protected string $name = 'Drive';
protected string $nameLower = 'drive';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->name, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->nameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->nameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower);
$this->loadJsonTranslationsFrom(module_path($this->name, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$relativeConfigPath = config('modules.paths.generator.config.path');
$configPath = module_path($this->name, $relativeConfigPath);
if (is_dir($configPath)) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath));
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'php') {
$relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname());
$configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath);
$key = ($relativePath === 'config.php') ? $this->nameLower : $configKey;
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
}
}
}
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->nameLower);
$sourcePath = module_path($this->name, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower);
$componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path')));
Blade::componentNamespace($componentNamespace, $this->nameLower);
}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->nameLower)) {
$paths[] = $path.'/modules/'.$this->nameLower;
}
}
return $paths;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Drive\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*/
protected function configureEmailVerification(): void
{
//
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Modules\Drive\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
protected string $name = 'Drive';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path($this->name, '/routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php'));
}
}

View File

View File

@@ -0,0 +1,30 @@
{
"name": "nwidart/drive",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Drive\\": "app/",
"Modules\\Drive\\Database\\Factories\\": "database/factories/",
"Modules\\Drive\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Drive\\Tests\\": "tests/"
}
}
}

View File

View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Drive',
];

View File

View File

@@ -0,0 +1,16 @@
<?php
namespace Modules\Drive\Database\Seeders;
use Illuminate\Database\Seeder;
class DriveDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

11
Modules/Drive/module.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "Drive",
"alias": "drive",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Drive\\Providers\\DriveServiceProvider"
],
"files": []
}

View File

@@ -0,0 +1,15 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

View File

View File

View File

@@ -0,0 +1,306 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="chat-wrapper d-lg-flex gap-1 mx-n4 mt-n4 p-1">
<div class="file-manager-content w-100 p-3 py-0">
<div class="mx-n3 pt-4 px-4 file-manager-content-scroll" data-simplebar>
<div id="folder-list" class="mb-2">
<div class="row justify-content-beetwen g-2 mb-3">
<div class="col">
<div class="d-flex align-items-center">
<div class="flex-shrink-0 me-2 d-block d-lg-none">
<button type="button"
class="btn btn-soft-success btn-icon btn-sm fs-16 file-menu-btn">
<i class="ri-menu-2-fill align-bottom"></i>
</button>
</div>
<div class="flex-grow-1">
<h5 class="fs-16 mb-0">Folders</h5>
</div>
</div>
</div>
<!--end col-->
<div class="col-auto">
<div class="d-flex gap-2 align-items-start">
<select class="form-control" data-choices data-choices-search-false
name="choices-single-default" id="file-type">
<option value="">File Type</option>
<option value="All" selected>All</option>
<option value="Video">Video</option>
<option value="Images">Images</option>
<option value="Music">Music</option>
<option value="Documents">Documents</option>
</select>
<button class="btn btn-success w-sm create-folder-modal flex-shrink-0"
data-bs-toggle="modal" data-bs-target="#createFolderModal"><i
class="ri-add-line align-bottom me-1"></i> Create Folders</button>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
<div class="row" id="folderlist-data">
<div class="col-xxl-3 col-6 folder-card">
<div class="card bg-light shadow-none" id="folder-1">
<div class="card-body">
<div class="d-flex mb-1">
<div class="form-check form-check-danger mb-3 fs-15 flex-grow-1">
<input class="form-check-input" type="checkbox" value=""
id="folderlistCheckbox_1">
<label class="form-check-label" for="folderlistCheckbox_1"></label>
</div>
<div class="dropdown">
<button class="btn btn-ghost-primary btn-icon btn-sm dropdown"
type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-2-fill fs-16 align-bottom"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item view-item-btn"
href="javascript:void(0);">Open</a></li>
<li><a class="dropdown-item edit-folder-list" href="#createFolderModal"
data-bs-toggle="modal" role="button">Rename</a></li>
<li><a class="dropdown-item" href="#removeFolderModal"
data-bs-toggle="modal" role="button">Delete</a>
</li>
</ul>
</div>
</div>
<div class="text-center">
<div class="mb-2">
<i class="ri-folder-2-fill align-bottom text-warning display-5"></i>
</div>
<h6 class="fs-15 folder-name">Projects</h6>
</div>
<div class="hstack mt-4 text-muted">
<span class="me-auto"><b>349</b> Files</span>
<span><b>4.10</b>GB</span>
</div>
</div>
</div>
</div>
<!--end col-->
<div class="col-xxl-3 col-6 folder-card">
<div class="card bg-light shadow-none" id="folder-2">
<div class="card-body">
<div class="d-flex mb-1">
<div class="form-check form-check-danger mb-3 fs-15 flex-grow-1">
<input class="form-check-input" type="checkbox" value=""
id="folderlistCheckbox_2">
<label class="form-check-label" for="folderlistCheckbox_2"></label>
</div>
<div class="dropdown">
<button class="btn btn-ghost-primary btn-icon btn-sm dropdown"
type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-2-fill fs-16 align-bottom"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item view-item-btn"
href="javascript:void(0);">Open</a></li>
<li><a class="dropdown-item edit-folder-list" href="#createFolderModal"
data-bs-toggle="modal" role="button">Rename</a></li>
<li><a class="dropdown-item" href="#removeFolderModal"
data-bs-toggle="modal" role="button">Delete</a>
</li>
</ul>
</div>
</div>
<div class="text-center">
<div class="mb-2">
<i class="ri-folder-2-fill align-bottom text-warning display-5"></i>
</div>
<h6 class="fs-15 folder-name">Documents</h6>
</div>
<div class="hstack mt-4 text-muted">
<span class="me-auto"><b>2348</b> Files</span>
<span><b>27.01</b>GB</span>
</div>
</div>
</div>
</div>
<!--end col-->
<div class="col-xxl-3 col-6 folder-card">
<div class="card bg-light shadow-none" id="folder-3">
<div class="card-body">
<div class="d-flex mb-1">
<div class="form-check form-check-danger mb-3 fs-15 flex-grow-1">
<input class="form-check-input" type="checkbox" value=""
id="folderlistCheckbox_3">
<label class="form-check-label" for="folderlistCheckbox_3"></label>
</div>
<div class="dropdown">
<button class="btn btn-ghost-primary btn-icon btn-sm dropdown"
type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-2-fill fs-16 align-bottom"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item view-item-btn"
href="javascript:void(0);">Open</a></li>
<li><a class="dropdown-item edit-folder-list"
href="#createFolderModal" data-bs-toggle="modal"
role="button">Rename</a></li>
<li><a class="dropdown-item" href="#removeFolderModal"
data-bs-toggle="modal" role="button">Delete</a>
</li>
</ul>
</div>
</div>
<div class="text-center">
<div class="mb-2">
<i class="ri-folder-2-fill align-bottom text-warning display-5"></i>
</div>
<h6 class="fs-15 folder-name">Media</h6>
</div>
<div class="hstack mt-4 text-muted">
<span class="me-auto"><b>12480</b> Files</span>
<span><b>20.87</b>GB</span>
</div>
</div>
</div>
</div>
<!--end col-->
<div class="col-xxl-3 col-6 folder-card">
<div class="card bg-light shadow-none" id="folder-4">
<div class="card-body">
<div class="d-flex mb-1">
<div class="form-check form-check-danger mb-3 fs-15 flex-grow-1">
<input class="form-check-input" type="checkbox" value=""
id="folderlistCheckbox_4">
<label class="form-check-label" for="folderlistCheckbox_4"></label>
</div>
<div class="dropdown">
<button class="btn btn-ghost-primary btn-icon btn-sm dropdown"
type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="ri-more-2-fill fs-16 align-bottom"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item view-item-btn"
href="javascript:void(0);">Open</a></li>
<li><a class="dropdown-item edit-folder-list"
href="#createFolderModal" data-bs-toggle="modal"
role="button">Rename</a></li>
<li><a class="dropdown-item" href="#removeFolderModal"
data-bs-toggle="modal" role="button">Delete</a>
</li>
</ul>
</div>
</div>
<div class="text-center">
<div class="mb-2">
<i class="ri-folder-2-fill align-bottom text-warning display-5"></i>
</div>
<h6 class="fs-15 folder-name">Velzon v1.7.0</h6>
</div>
<div class="hstack mt-4 text-muted">
<span class="me-auto"><b>180</b> Files</span>
<span><b>478.65</b>MB</span>
</div>
</div>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</div>
</div>
</div>
</div>
</div>
<!-- START CREATE FOLDER MODAL -->
<div class="modal fade zoomIn" id="createFolderModal" tabindex="-1" aria-labelledby="createFolderModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content border-0">
<div class="modal-header p-3 bg-success-subtle">
<h5 class="modal-title" id="createFolderModalLabel">Create Folder</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" id="addFolderBtn-close"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form autocomplete="off" class="needs-validation createfolder-form" id="createfolder-form"
novalidate>
<div class="mb-4">
<label for="foldername-input" class="form-label">Folder Name</label>
<input type="text" class="form-control" id="foldername-input" required
placeholder="Enter folder name">
<div class="invalid-feedback">Please enter a folder name.</div>
<input type="hidden" class="form-control" id="folderid-input" value=""
placeholder="Enter folder name">
</div>
<div class="hstack gap-2 justify-content-end">
<button type="button" class="btn btn-ghost-success" data-bs-dismiss="modal"><i
class="ri-close-line align-bottom"></i> Close</button>
<button type="submit" class="btn btn-primary" id="addNewFolder">Add Folder</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- END CREATE FOLDER MODAL -->
<!-- removeFileItemModal -->
<div id="removeFileItemModal" class="modal fade zoomIn" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"
id="close-removefilemodal"></button>
</div>
<div class="modal-body">
<div class="mt-2 text-center">
<lord-icon src="https://cdn.lordicon.com/gsqxdxog.json" trigger="loop"
colors="primary:#f7b84b,secondary:#f06548" style="width:100px;height:100px"></lord-icon>
<div class="mt-4 pt-2 fs-15 mx-4 mx-sm-5">
<h4>Are you sure ?</h4>
<p class="text-muted mx-4 mb-0">Are you sure you want to remove this item ?</p>
</div>
</div>
<div class="d-flex gap-2 justify-content-center mt-4 mb-2">
<button type="button" class="btn w-sm btn-light" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn w-sm btn-danger" id="remove-fileitem">Yes, Delete
It!</button>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- removeFileItemModal -->
<div id="removeFolderModal" class="modal fade zoomIn" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"
id="close-removeFoldermodal"></button>
</div>
<div class="modal-body">
<div class="mt-2 text-center">
<lord-icon src="https://cdn.lordicon.com/gsqxdxog.json" trigger="loop"
colors="primary:#f7b84b,secondary:#f06548" style="width:100px;height:100px"></lord-icon>
<div class="mt-4 pt-2 fs-15 mx-4 mx-sm-5">
<h4>Are you sure ?</h4>
<p class="text-muted mx-4 mb-0">Are you sure you want to remove this folder ?</p>
</div>
</div>
<div class="d-flex gap-2 justify-content-center mt-4 mb-2">
<button type="button" class="btn w-sm btn-light" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn w-sm btn-danger" id="remove-folderList">Yes, Delete
It!</button>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/file-manager.init.js') }}"></script>
@endpush

View File

@@ -0,0 +1,7 @@
@extends('drive::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('drive.name') !!}</p>
@endsection

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Drive Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-drive', 'resources/assets/sass/app.scss', storage_path('vite.hot')) }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-drive', 'resources/assets/js/app.js', storage_path('vite.hot')) }} --}}
</body>

View File

View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Drive\Http\Controllers\DriveController;
/*
*--------------------------------------------------------------------------
* API Routes
*--------------------------------------------------------------------------
*
* Here is where you can register API routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* is assigned the "api" middleware group. Enjoy building your API!
*
*/
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('drive', DriveController::class)->names('drive');
});

View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Drive\Http\Controllers\DriveController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group(["prefix" => "admin/"], function () {
Route::resource('drive', DriveController::class)->names('drive');
});

View File

@@ -0,0 +1,57 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { readdirSync, statSync } from 'fs';
import { join,relative,dirname } from 'path';
import { fileURLToPath } from 'url';
export default defineConfig({
build: {
outDir: '../../public/build-drive',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-drive',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
// Scen all resources for assets file. Return array
//function getFilePaths(dir) {
// const filePaths = [];
//
// function walkDirectory(currentPath) {
// const files = readdirSync(currentPath);
// for (const file of files) {
// const filePath = join(currentPath, file);
// const stats = statSync(filePath);
// if (stats.isFile() && !file.startsWith('.')) {
// const relativePath = 'Modules/Drive/'+relative(__dirname, filePath);
// filePaths.push(relativePath);
// } else if (stats.isDirectory()) {
// walkDirectory(filePath);
// }
// }
// }
//
// walkDirectory(dir);
// return filePaths;
//}
//const __filename = fileURLToPath(import.meta.url);
//const __dirname = dirname(__filename);
//const assetsDir = join(__dirname, 'resources/assets');
//export const paths = getFilePaths(assetsDir);
//export const paths = [
// 'Modules/Drive/resources/assets/sass/app.scss',
// 'Modules/Drive/resources/assets/js/app.js',
//];