firstcommit
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
66
.env.example
Normal file
66
.env.example
Normal file
@@ -0,0 +1,66 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
# AROGIN ENV VARIABLES
|
||||
# page limit
|
||||
PAGE_LIMIT = "10"
|
||||
|
||||
# AROGIN_APP_ENV=development #testing,development,production
|
||||
AROGIN_APP_ENV = development
|
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
13
.htaccess
Normal file
13
.htaccess
Normal file
@@ -0,0 +1,13 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
# That was ONLY to protect you from 500 errors
|
||||
# if your server did not have mod_rewrite enabled
|
||||
|
||||
RewriteEngine On
|
||||
# RewriteBase /
|
||||
# NOT needed unless you're using mod_alias to redirect
|
||||
|
||||
RewriteCond %{REQUEST_URI} !/public
|
||||
RewriteRule ^(.*)$ public/$1 [L]
|
||||
# Direct all requests to /public folder
|
||||
|
||||
</IfModule>
|
0
Modules/AboutUs/app/Http/Controllers/.gitkeep
Normal file
0
Modules/AboutUs/app/Http/Controllers/.gitkeep
Normal file
67
Modules/AboutUs/app/Http/Controllers/AboutUsController.php
Normal file
67
Modules/AboutUs/app/Http/Controllers/AboutUsController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AboutUs\app\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AboutUsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('aboutus::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('aboutus::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('aboutus::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('aboutus::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
0
Modules/AboutUs/app/Http/Middleware/.gitkeep
Normal file
0
Modules/AboutUs/app/Http/Middleware/.gitkeep
Normal file
0
Modules/AboutUs/app/Http/Requests/.gitkeep
Normal file
0
Modules/AboutUs/app/Http/Requests/.gitkeep
Normal file
0
Modules/AboutUs/app/Models/.gitkeep
Normal file
0
Modules/AboutUs/app/Models/.gitkeep
Normal file
26
Modules/AboutUs/app/Models/AboutUs.php
Normal file
26
Modules/AboutUs/app/Models/AboutUs.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AboutUs\app\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\AboutUs\Database\factories\AboutUsFactory;
|
||||
|
||||
class AboutUs extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'about_us';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'filename'
|
||||
];
|
||||
|
||||
protected static function newFactory(): AboutUsFactory
|
||||
{
|
||||
//return AboutUsFactory::new();
|
||||
}
|
||||
}
|
0
Modules/AboutUs/app/Providers/.gitkeep
Normal file
0
Modules/AboutUs/app/Providers/.gitkeep
Normal file
114
Modules/AboutUs/app/Providers/AboutUsServiceProvider.php
Normal file
114
Modules/AboutUs/app/Providers/AboutUsServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AboutUs\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AboutUsServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'AboutUs';
|
||||
|
||||
protected string $moduleNameLower = 'aboutus';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$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->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
59
Modules/AboutUs/app/Providers/RouteServiceProvider.php
Normal file
59
Modules/AboutUs/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AboutUs\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\AboutUs\app\Http\Controllers';
|
||||
|
||||
/**
|
||||
* 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')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('AboutUs', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('AboutUs', '/routes/api.php'));
|
||||
}
|
||||
}
|
31
Modules/AboutUs/composer.json
Normal file
31
Modules/AboutUs/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/aboutus",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\AboutUs\\": "",
|
||||
"Modules\\AboutUs\\App\\": "app/",
|
||||
"Modules\\AboutUs\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\AboutUs\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\AboutUs\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/AboutUs/config/.gitkeep
Normal file
0
Modules/AboutUs/config/.gitkeep
Normal file
5
Modules/AboutUs/config/config.php
Normal file
5
Modules/AboutUs/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'AboutUs',
|
||||
];
|
0
Modules/AboutUs/database/factories/.gitkeep
Normal file
0
Modules/AboutUs/database/factories/.gitkeep
Normal file
0
Modules/AboutUs/database/migrations/.gitkeep
Normal file
0
Modules/AboutUs/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('about_us', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('filename')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('about_us');
|
||||
}
|
||||
};
|
0
Modules/AboutUs/database/seeders/.gitkeep
Normal file
0
Modules/AboutUs/database/seeders/.gitkeep
Normal file
49
Modules/AboutUs/database/seeders/AboutUsDatabaseSeeder.php
Normal file
49
Modules/AboutUs/database/seeders/AboutUsDatabaseSeeder.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AboutUs\database\seeders;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\AboutUs\app\Models\AboutUs;
|
||||
|
||||
class AboutUsDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
$aboutUs = new AboutUs();
|
||||
$aboutUs->title = 'about us';
|
||||
$aboutUs->save();
|
||||
|
||||
|
||||
// Add image to the created banner
|
||||
$this->uploadImageForBanner('test_video.mp4.', $aboutUs);
|
||||
|
||||
}
|
||||
|
||||
private function uploadImageForBanner(string $imageFileName, $cmsbanner)
|
||||
{
|
||||
$seederDirPath = 'aboutUs/';
|
||||
|
||||
// Generate a unique filename for the new image
|
||||
$newFileName = Str::uuid() . '.mp4';
|
||||
|
||||
// Storage path for the new image
|
||||
$storagePath = '/aboutUs/' . $newFileName;
|
||||
|
||||
// Check if the image exists in the seeder_disk
|
||||
if (Storage::disk('seeder_disk')->exists($seederDirPath . $imageFileName)) {
|
||||
// Copy the image from seeder to public
|
||||
$fileContents = Storage::disk('seeder_disk')->get($seederDirPath . $imageFileName);
|
||||
|
||||
Storage::disk('public_uploads')->put($storagePath, $fileContents);
|
||||
|
||||
$cmsbanner->filename = $newFileName;
|
||||
$cmsbanner->save();
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/AboutUs/lang/.gitkeep
Normal file
0
Modules/AboutUs/lang/.gitkeep
Normal file
11
Modules/AboutUs/module.json
Normal file
11
Modules/AboutUs/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "AboutUs",
|
||||
"alias": "aboutus",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\AboutUs\\app\\Providers\\AboutUsServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/AboutUs/package.json
Normal file
15
Modules/AboutUs/package.json
Normal 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"
|
||||
}
|
||||
}
|
0
Modules/AboutUs/resources/assets/.gitkeep
Normal file
0
Modules/AboutUs/resources/assets/.gitkeep
Normal file
0
Modules/AboutUs/resources/assets/js/app.js
Normal file
0
Modules/AboutUs/resources/assets/js/app.js
Normal file
0
Modules/AboutUs/resources/assets/sass/app.scss
Normal file
0
Modules/AboutUs/resources/assets/sass/app.scss
Normal file
0
Modules/AboutUs/resources/views/.gitkeep
Normal file
0
Modules/AboutUs/resources/views/.gitkeep
Normal file
7
Modules/AboutUs/resources/views/index.blade.php
Normal file
7
Modules/AboutUs/resources/views/index.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
@extends('aboutus::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('aboutus.name') !!}</p>
|
||||
@endsection
|
29
Modules/AboutUs/resources/views/layouts/master.blade.php
Normal file
29
Modules/AboutUs/resources/views/layouts/master.blade.php
Normal 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>AboutUs 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-aboutus', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-aboutus', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
0
Modules/AboutUs/routes/.gitkeep
Normal file
0
Modules/AboutUs/routes/.gitkeep
Normal file
19
Modules/AboutUs/routes/api.php
Normal file
19
Modules/AboutUs/routes/api.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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')->name('api.')->group(function () {
|
||||
Route::get('aboutus', fn (Request $request) => $request->user())->name('aboutus');
|
||||
});
|
19
Modules/AboutUs/routes/web.php
Normal file
19
Modules/AboutUs/routes/web.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\AboutUs\app\Http\Controllers\AboutUsController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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([], function () {
|
||||
Route::resource('aboutus', AboutUsController::class)->names('aboutus');
|
||||
});
|
0
Modules/AboutUs/tests/Feature/.gitkeep
Normal file
0
Modules/AboutUs/tests/Feature/.gitkeep
Normal file
0
Modules/AboutUs/tests/Unit/.gitkeep
Normal file
0
Modules/AboutUs/tests/Unit/.gitkeep
Normal file
26
Modules/AboutUs/vite.config.js
Normal file
26
Modules/AboutUs/vite.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-aboutus',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-aboutus',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
||||
//];
|
0
Modules/Activity/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Activity/app/Http/Controllers/.gitkeep
Normal file
127
Modules/Activity/app/Http/Controllers/ActivityController.php
Normal file
127
Modules/Activity/app/Http/Controllers/ActivityController.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Activity\app\Http\Requests\CreateActivityRequest;
|
||||
use Modules\Activity\app\Repositories\ActivityRepository;
|
||||
|
||||
class ActivityController extends Controller
|
||||
{
|
||||
protected $activityRepository;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->activityRepository = new ActivityRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$perPage = $request->has('per-page') ? $request->input('per-page') : null;
|
||||
$filter = $request->has('filter') ? $request->input('filter') : [];
|
||||
$activities = $this->activityRepository->allActivities($perPage, $filter);
|
||||
|
||||
return view('activity::index', compact('activities'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('activity::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(CreateActivityRequest $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$this->activityRepository->storeActivity($validated);
|
||||
toastr()->success('Activity created successfully.');
|
||||
|
||||
return redirect()->route('cms.activities.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('activity::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($uuid)
|
||||
{
|
||||
$activity = $this->activityRepository->findActivityByUuid($uuid);
|
||||
if (!$activity) {
|
||||
toastr()->error('Activity not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
return view('activity::edit', compact('activity'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(CreateActivityRequest $request, $uuid): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$activity = $this->activityRepository->updateActivity(validated: $validated, uuid: $uuid);
|
||||
|
||||
if (!$activity) {
|
||||
toastr()->error('Banner not found !');
|
||||
return back();
|
||||
}
|
||||
toastr()->success('Activity updated successfully.');
|
||||
|
||||
return redirect()->route('cms.activities.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($uuid)
|
||||
{
|
||||
try {
|
||||
$activity = $this->activityRepository->deleteActivity(uuid: $uuid);
|
||||
|
||||
if (!$activity) {
|
||||
toastr()->error('Activity not found.');
|
||||
return back();
|
||||
}
|
||||
toastr()->success('Activity deleted successfully.');
|
||||
|
||||
return redirect()->route('cms.activities.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Activity/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Activity/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Activity/app/Http/Requests/.gitkeep
Normal file
0
Modules/Activity/app/Http/Requests/.gitkeep
Normal file
28
Modules/Activity/app/Http/Requests/CreateActivityRequest.php
Normal file
28
Modules/Activity/app/Http/Requests/CreateActivityRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CreateActivityRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'status' => 'required',
|
||||
'image' => 'sometimes|nullable|image|mimes:jpeg,png,jpg,gif',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
0
Modules/Activity/app/Models/.gitkeep
Normal file
0
Modules/Activity/app/Models/.gitkeep
Normal file
35
Modules/Activity/app/Models/Activity.php
Normal file
35
Modules/Activity/app/Models/Activity.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Activity\Database\factories\ActivityFactory;
|
||||
use Modules\Destination\app\Models\Destination;
|
||||
|
||||
class Activity extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'name',
|
||||
'image',
|
||||
'image_path',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function destinations()
|
||||
{
|
||||
return $this->belongsToMany(Destination::class, 'activity_destination');
|
||||
}
|
||||
|
||||
protected static function newFactory(): ActivityFactory
|
||||
{
|
||||
//return ActivityFactory::new();
|
||||
}
|
||||
}
|
0
Modules/Activity/app/Providers/.gitkeep
Normal file
0
Modules/Activity/app/Providers/.gitkeep
Normal file
114
Modules/Activity/app/Providers/ActivityServiceProvider.php
Normal file
114
Modules/Activity/app/Providers/ActivityServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ActivityServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Activity';
|
||||
|
||||
protected string $moduleNameLower = 'activity';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$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->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
59
Modules/Activity/app/Providers/RouteServiceProvider.php
Normal file
59
Modules/Activity/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\Activity\app\Http\Controllers';
|
||||
|
||||
/**
|
||||
* 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')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Activity', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Activity', '/routes/api.php'));
|
||||
}
|
||||
}
|
118
Modules/Activity/app/Repositories/ActivityRepository.php
Normal file
118
Modules/Activity/app/Repositories/ActivityRepository.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Repositories;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Activity\app\Models\Activity;
|
||||
use Modules\Banner\app\Services\FileManagementService;
|
||||
|
||||
class ActivityRepository
|
||||
{
|
||||
//-- Retrieve all Activities
|
||||
public function allActivities($perPage = null, $filter = [], $sort = ['by' => 'id', 'sort' => 'DESC'])
|
||||
{
|
||||
return Activity::when(array_keys($filter, true), function ($query) use ($filter) {
|
||||
if (! empty($filter['title'])) {
|
||||
$query->where('title', $filter['title']);
|
||||
}
|
||||
if (! empty($filter['price'])) {
|
||||
$query->where('price', 'like', '%'.$filter['price'].'%');
|
||||
}
|
||||
})
|
||||
->orderBy($sort['by'], $sort['sort'])
|
||||
->paginate($perPage ?: env('PAGE_LIMIT', 999));
|
||||
}
|
||||
|
||||
//-- Find Activiy by uuid
|
||||
public function findActivityByUuid($uuid)
|
||||
{
|
||||
return Activity::where('uuid', $uuid)->first();
|
||||
}
|
||||
|
||||
// Store Activity
|
||||
public function storeActivity(array $validated)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$activity = new Activity();
|
||||
$activity->uuid = Str::uuid();
|
||||
$activity->name = $validated['name'];
|
||||
$activity->status = $validated['status'];
|
||||
$activity->save();
|
||||
|
||||
// Check if image is uploaded and valid and store image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::storeFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'activities',
|
||||
model: $activity
|
||||
);
|
||||
}
|
||||
DB::commit();
|
||||
|
||||
return $activity;
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
DB::rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Update Activity
|
||||
public function updateActivity(array $validated, string $uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$activity = $this->findActivityByUuid($uuid);
|
||||
if (! $activity) {
|
||||
return null;
|
||||
}
|
||||
$activity->name = $validated['name'];
|
||||
$activity->status = $validated['status'];
|
||||
$activity->save();
|
||||
|
||||
// Check if image is uploaded and valid and store image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::uploadFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'activities',
|
||||
filePath: $activity->image_path,
|
||||
model: $activity
|
||||
);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $activity;
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
DB::rollBack();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//-- Delete Activity
|
||||
public function deleteActivity(string $uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$activity = $this->findActivityByUuid($uuid);
|
||||
if (! $activity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete the image file associated with the activity
|
||||
if ($activity->image_path !== null) {
|
||||
FileManagementService::deleteFile($activity->image_path);
|
||||
}
|
||||
$activity->delete();
|
||||
|
||||
return $activity;
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
DB::rollBack();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
68
Modules/Activity/app/Services/FileManagementService.php
Normal file
68
Modules/Activity/app/Services/FileManagementService.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\app\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class FileManagementService
|
||||
{
|
||||
//-- store file
|
||||
public static function storeFile($file, $uploadedFolderName, $model)
|
||||
{
|
||||
try {
|
||||
$originalFileName = $file->getClientOriginalName();
|
||||
$modifiedFileName = date('YmdHis').'_'.uniqid().'.'.$originalFileName;
|
||||
|
||||
$file->storeAs($uploadedFolderName, $modifiedFileName, 'public_uploads'); // This line uses 'public_uploads' disk
|
||||
|
||||
$model->image = $modifiedFileName;
|
||||
$model->image_path = $uploadedFolderName.'/'.$modifiedFileName;
|
||||
$model->save();
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
//-- update file
|
||||
public static function uploadFile($file, $uploadedFolderName, $filePath, $model)
|
||||
{
|
||||
try {
|
||||
if ($filePath && Storage::disk('public_uploads')->exists($filePath)) {
|
||||
Storage::disk('public_uploads')->delete($filePath);
|
||||
}
|
||||
|
||||
$originalFileName = $file->getClientOriginalName();
|
||||
$modifiedFileName = date('YmdHis').'_'.uniqid().'.'.$originalFileName;
|
||||
|
||||
$file->storeAs($uploadedFolderName, $modifiedFileName, 'public_uploads'); // This line uses 'public_uploads' disk
|
||||
|
||||
$model->image = $modifiedFileName;
|
||||
$model->image_path = $uploadedFolderName.'/'.$modifiedFileName;
|
||||
|
||||
$model->save();
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
//-- delete file
|
||||
public static function deleteFile($filePath)
|
||||
{
|
||||
try {
|
||||
if ($filePath && Storage::disk('public_uploads')->exists($filePath)) {
|
||||
Storage::disk('public_uploads')->delete($filePath);
|
||||
} else {
|
||||
toastr()->error('File Not wrong.');
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
31
Modules/Activity/composer.json
Normal file
31
Modules/Activity/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/activity",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Activity\\": "",
|
||||
"Modules\\Activity\\App\\": "app/",
|
||||
"Modules\\Activity\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Activity\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Activity\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Activity/config/.gitkeep
Normal file
0
Modules/Activity/config/.gitkeep
Normal file
5
Modules/Activity/config/config.php
Normal file
5
Modules/Activity/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Activity',
|
||||
];
|
0
Modules/Activity/database/factories/.gitkeep
Normal file
0
Modules/Activity/database/factories/.gitkeep
Normal file
0
Modules/Activity/database/migrations/.gitkeep
Normal file
0
Modules/Activity/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('activities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid();
|
||||
$table->string('name');
|
||||
$table->string('image')->nullable();
|
||||
$table->string('image_path')->nullable();
|
||||
$table->string('status')->default('active');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('activities');
|
||||
}
|
||||
};
|
0
Modules/Activity/database/seeders/.gitkeep
Normal file
0
Modules/Activity/database/seeders/.gitkeep
Normal file
20
Modules/Activity/database/seeders/ActivityDatabaseSeeder.php
Normal file
20
Modules/Activity/database/seeders/ActivityDatabaseSeeder.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Activity\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Activity\app\Models\Activity;
|
||||
|
||||
class ActivityDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
}
|
0
Modules/Activity/lang/.gitkeep
Normal file
0
Modules/Activity/lang/.gitkeep
Normal file
11
Modules/Activity/module.json
Normal file
11
Modules/Activity/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Activity",
|
||||
"alias": "activity",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Activity\\app\\Providers\\ActivityServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Activity/package.json
Normal file
15
Modules/Activity/package.json
Normal 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"
|
||||
}
|
||||
}
|
0
Modules/Activity/resources/assets/.gitkeep
Normal file
0
Modules/Activity/resources/assets/.gitkeep
Normal file
0
Modules/Activity/resources/assets/js/app.js
Normal file
0
Modules/Activity/resources/assets/js/app.js
Normal file
0
Modules/Activity/resources/assets/sass/app.scss
Normal file
0
Modules/Activity/resources/assets/sass/app.scss
Normal file
0
Modules/Activity/resources/views/.gitkeep
Normal file
0
Modules/Activity/resources/views/.gitkeep
Normal file
55
Modules/Activity/resources/views/create.blade.php
Normal file
55
Modules/Activity/resources/views/create.blade.php
Normal file
@@ -0,0 +1,55 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Create Activity
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Activity',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Activities',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Add Activity',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
@section('content')
|
||||
{{-- {!! Form::open([
|
||||
'route' => 'activities.store',
|
||||
'method' => 'POST',
|
||||
'role' => 'form',
|
||||
'files' => true,
|
||||
]) !!} --}}
|
||||
{{-- {!! Form::close() !!} --}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xxl">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="mb-0">Add Activity</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form
|
||||
action="{{ route('cms.activities.store')}}"
|
||||
method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('activity::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
58
Modules/Activity/resources/views/edit.blade.php
Normal file
58
Modules/Activity/resources/views/edit.blade.php
Normal file
@@ -0,0 +1,58 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Create Activity
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Activity',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Activities',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Update Activity',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
@section('content')
|
||||
{{-- {!! Form::open([
|
||||
'route' => 'activities.edit',
|
||||
'method' => 'POST',
|
||||
'role' => 'form',
|
||||
'files' => true,
|
||||
|
||||
{{-- {!! Form::close() !!} --}}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xxl">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="mb-0">Update Activity</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('cms.activities.update', ['uuid' => $activity->uuid]) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
@include('activity::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
131
Modules/Activity/resources/views/index.blade.php
Normal file
131
Modules/Activity/resources/views/index.blade.php
Normal file
@@ -0,0 +1,131 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Activity
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Activity',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Activities',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- activities List Table -->
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4 class="card-header">List of Activity</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="flex-column flex-md-row">
|
||||
<div class="dt-action-buttons text-end pt-3 px-3">
|
||||
<div class="dt-buttons btn-group flex-wrap">
|
||||
<a href="{{ route('cms.activities.create') }}"
|
||||
class="btn btn-secondary create-new btn-primary d-none d-sm-inline-block text-white">
|
||||
<i class="bx bx-plus me-sm-1"></i>
|
||||
Add New
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="datatables-users table border-top">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Image</th>
|
||||
<th>Name</th>
|
||||
<th>Created At</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="table-border-bottom-0">
|
||||
@foreach ($activities ?? [] as $activity)
|
||||
<tr>
|
||||
<td>
|
||||
#{{ $loop->iteration }}
|
||||
</td>
|
||||
<td>
|
||||
<img class="object-fit-contain"
|
||||
src="{{ asset($activity->image_path ? 'storage/uploads/' . $activity->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="" srcset="" height="70" width="60">
|
||||
</td>
|
||||
<td>
|
||||
{{ $activity->name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $activity->created_at->toFormattedDateString() }}
|
||||
</td>
|
||||
<td>
|
||||
<span <span
|
||||
class="badge bg-label-{{ $activity->status == 'active' ? 'success' : 'danger' }}">
|
||||
{{ $activity->status }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow"
|
||||
data-bs-toggle="dropdown">
|
||||
<i class="bx bx-dots-vertical-rounded"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item"
|
||||
href="{{ route('cms.activities.edit', ['uuid' => $activity->uuid]) }}"><i
|
||||
class="bx bx-edit-alt me-1"></i>
|
||||
Edit</a>
|
||||
|
||||
{{-- <div class="dropdown-item btn-delete" data-name="[ {{ $activity->title }} ]"
|
||||
data-action="{{ route('cms.activities.delete', ['uuid' => $activity->uuid]) }}">
|
||||
<i class="bx bx-trash me-1"></i> Delete
|
||||
</div> --}}
|
||||
<form method="POST"
|
||||
action="{{ route('cms.activities.delete', ['uuid' => $activity->uuid]) }}"
|
||||
id="deleteForm_{{ $activity->uuid }}" class="dropdown-item">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="border-0 bg-transparent deleteBtn"
|
||||
style="color:inherit"><i class="bx bx-trash me-1"></i>
|
||||
Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="px-3">
|
||||
{{ $activities->links('admin::layouts.partials.pagination') }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
{{-- style --}}
|
||||
@push('required-styles')
|
||||
@include('admin::vendor.dataTables.style')
|
||||
@endpush
|
||||
|
||||
{{-- script --}}
|
||||
@push('required-scripts')
|
||||
@include('admin::vendor.dataTables.script')
|
||||
@endpush
|
29
Modules/Activity/resources/views/layouts/master.blade.php
Normal file
29
Modules/Activity/resources/views/layouts/master.blade.php
Normal 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>Activity 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-activity', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-activity', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
60
Modules/Activity/resources/views/partial/form.blade.php
Normal file
60
Modules/Activity/resources/views/partial/form.blade.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<div>
|
||||
<div class="row mb-4">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-start align-items-sm-center gap-4">
|
||||
<img src="{{ asset(!empty($activity->image_path) ? 'storage/uploads/' . $activity->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="activity-image input-file" class="d-block rounded show-image" height="100" width="100" />
|
||||
|
||||
<div class="button-wrapper">
|
||||
<label for="upload" class="btn btn-primary me-2 mb-4" tabindex="0">
|
||||
<span class="d-none d-sm-block">Upload</span>
|
||||
<i class="bx bx-upload d-block d-sm-none"></i>
|
||||
<input type="file" id="upload" class="input-file" name="image" hidden
|
||||
accept="image/png, image/jpeg" />
|
||||
</label>
|
||||
<button type="button" class="btn btn-label-secondary image-reset mb-4">
|
||||
<i class="bx bx-reset d-block d-sm-none"></i>
|
||||
<span class="d-none d-sm-block">Reset</span>
|
||||
</button>
|
||||
|
||||
<p class="mb-0">Allowed JPG, GIF or PNG. Max size of 3Mb</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-0" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mb-3 col-md-6 ">
|
||||
<label class="form-label" for="basic-default-name">Name</label>
|
||||
<input type="text" class="form-control" name="name" value="{{ old('name', $activity->name ?? '') }}"
|
||||
placeholder="e.g. Hiking" required />
|
||||
</div>
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Status</label>
|
||||
<select class="select2 form-select" id="basic-default-company select2Basic" aria-label="Default select example" name="status"
|
||||
required>
|
||||
<option value="active"{{ ($activity->status ?? '') == 'active' ? 'selected' : '' }}>Active</option>
|
||||
<option value="inactive"{{ ($activity->status ?? '') == 'inactive' ? 'selected' : '' }}>Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
@if (empty($activity))
|
||||
Save Activity
|
||||
@else
|
||||
Update Activity
|
||||
@endif
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('required-styles')
|
||||
@include('admin::vendor.select2.style')
|
||||
@endpush
|
||||
|
||||
@push('required-scripts')
|
||||
@include('admin::vendor.select2.script')
|
||||
@endpush
|
0
Modules/Activity/routes/.gitkeep
Normal file
0
Modules/Activity/routes/.gitkeep
Normal file
19
Modules/Activity/routes/api.php
Normal file
19
Modules/Activity/routes/api.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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')->name('api.')->group(function () {
|
||||
Route::get('activity', fn (Request $request) => $request->user())->name('activity');
|
||||
});
|
39
Modules/Activity/routes/web.php
Normal file
39
Modules/Activity/routes/web.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => 'apanel',
|
||||
'middleware' => ['auth'],
|
||||
'as' => 'cms.',
|
||||
],
|
||||
function () {
|
||||
Route::group(
|
||||
[
|
||||
'prefix' => 'cms',
|
||||
'as' => 'activities.',
|
||||
'controller' => 'ActivityController',
|
||||
],
|
||||
function () {
|
||||
Route::get('activities', 'index')->name('index');
|
||||
Route::get('activities/create', 'create')->name('create');
|
||||
Route::post('activities/store', 'store')->name('store');
|
||||
Route::get('activities/{uuid}/edit', 'edit')->name('edit');
|
||||
Route::put('activities/{uuid}/update', 'update')->name('update');
|
||||
Route::delete('activities/{uuid}/delete', 'destroy')->name('delete');
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
0
Modules/Activity/tests/Feature/.gitkeep
Normal file
0
Modules/Activity/tests/Feature/.gitkeep
Normal file
0
Modules/Activity/tests/Unit/.gitkeep
Normal file
0
Modules/Activity/tests/Unit/.gitkeep
Normal file
26
Modules/Activity/vite.config.js
Normal file
26
Modules/Activity/vite.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-activity',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-activity',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
||||
//];
|
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Admin/app/Http/Controllers/.gitkeep
Normal file
29
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
29
Modules/Admin/app/Http/Controllers/AdminController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\app\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Modules\Blog\app\Models\Blog;
|
||||
use Modules\ContactUs\app\Models\ContactUs;
|
||||
use Modules\Post\app\Models\Post;
|
||||
use Modules\Service\app\Models\Service;
|
||||
use Modules\Subscription\app\Models\Subscription;
|
||||
use Modules\TeamMember\app\Models\TeamMember;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
//-- Dashboard
|
||||
public function dashboard()
|
||||
{
|
||||
$data = [
|
||||
'totalTeam' => TeamMember::count(),
|
||||
'totalBlog' => Blog::count(),
|
||||
'totalPost' => Post::count(),
|
||||
'totalService' => Service::count(),
|
||||
'totalSubscriber' => Subscription::count(),
|
||||
'totalContact' => ContactUs::count(),
|
||||
];
|
||||
|
||||
return view('admin::dashboard', $data);
|
||||
}
|
||||
}
|
74
Modules/Admin/app/Http/Controllers/Auth/AuthController.php
Normal file
74
Modules/Admin/app/Http/Controllers/Auth/AuthController.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\app\Http\Controllers\Auth;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Modules\AdminUser\app\Models\AdminUser;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
if(Auth::check()){
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
return view('admin::auth.pages.login');
|
||||
}
|
||||
|
||||
|
||||
public function postLogin(Request $request){
|
||||
try {
|
||||
$rememberMe = $request->has('remember') ? true : false;
|
||||
//-- Check if user email is valid
|
||||
$adminUser = AdminUser::where('email', $request['email'])->first();
|
||||
if (!$adminUser) {
|
||||
toastr()->error('Incorrect Credential.');
|
||||
return back();
|
||||
}
|
||||
//-- Validate Credentials
|
||||
if (!Hash::check($request['password'], $adminUser->password)) {
|
||||
toastr()->error('Incorrect Password.');
|
||||
return back();
|
||||
}
|
||||
|
||||
//-- Login User
|
||||
Auth::login($adminUser, $rememberMe);
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
toastr()->success('You have successfully logged in');
|
||||
|
||||
return redirect()->route('dashboard');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
|
||||
toastr()->error('Something went wrong.');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
//--log out process
|
||||
Auth::logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
toastr()->success('You have been logged out');
|
||||
|
||||
return redirect()->route("login");
|
||||
}
|
||||
|
||||
|
||||
}
|
0
Modules/Admin/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Admin/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Http/Requests/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
0
Modules/Admin/app/Models/.gitkeep
Normal file
0
Modules/Admin/app/Providers/.gitkeep
Normal file
0
Modules/Admin/app/Providers/.gitkeep
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
114
Modules/Admin/app/Providers/AdminServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AdminServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Admin';
|
||||
|
||||
protected string $moduleNameLower = 'admin';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$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->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
59
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
59
Modules/Admin/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\Admin\app\Http\Controllers';
|
||||
|
||||
/**
|
||||
* 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')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Admin', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Admin', '/routes/api.php'));
|
||||
}
|
||||
}
|
31
Modules/Admin/composer.json
Normal file
31
Modules/Admin/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/admin",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\": "",
|
||||
"Modules\\Admin\\App\\": "app/",
|
||||
"Modules\\Admin\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Admin\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Admin\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Admin/config/.gitkeep
Normal file
0
Modules/Admin/config/.gitkeep
Normal file
5
Modules/Admin/config/config.php
Normal file
5
Modules/Admin/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Admin',
|
||||
];
|
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/factories/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
0
Modules/Admin/database/migrations/.gitkeep
Normal file
0
Modules/Admin/database/seeders/.gitkeep
Normal file
0
Modules/Admin/database/seeders/.gitkeep
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
16
Modules/Admin/database/seeders/AdminDatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AdminDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
0
Modules/Admin/lang/.gitkeep
Normal file
0
Modules/Admin/lang/.gitkeep
Normal file
11
Modules/Admin/module.json
Normal file
11
Modules/Admin/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Admin",
|
||||
"alias": "admin",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Admin\\app\\Providers\\AdminServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Admin/package.json
Normal file
15
Modules/Admin/package.json
Normal 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"
|
||||
}
|
||||
}
|
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/.gitkeep
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/js/app.js
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/assets/sass/app.scss
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
0
Modules/Admin/resources/views/.gitkeep
Normal file
62
Modules/Admin/resources/views/auth/layouts/master.blade.php
Normal file
62
Modules/Admin/resources/views/auth/layouts/master.blade.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en" class="light-style customizer-hide" dir="ltr" data-theme="theme-default"
|
||||
data-assets-path="../../assets/" data-template="vertical-menu-template">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
|
||||
|
||||
<title>Login Cover - Pages | {{ config('app.name') }}</title>
|
||||
|
||||
<meta name="description" content="" />
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/x-icon" href="../../assets/img/favicon/favicon.ico" />
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap"
|
||||
rel="stylesheet" />
|
||||
|
||||
<!-- Icons -->
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/fonts/boxicons.css') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/fonts/fontawesome.css') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/fonts/flag-icons.css') }}" />
|
||||
|
||||
<!-- Core CSS -->
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/css/rtl/core.css') }}"
|
||||
class="template-customizer-core-css" />
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/css/rtl/theme-default.css') }}"
|
||||
class="template-customizer-theme-css" />
|
||||
{{-- <link rel="stylesheet" href="{{asset('backend/theme/assets/css/demo.css')}}" /> --}}
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="{{ asset('backend/theme/assets/vendor/libs/formvalidation/dist/css/formValidation.min.css') }}" />
|
||||
|
||||
<!-- Page CSS -->
|
||||
<!-- Page -->
|
||||
<link rel="stylesheet" href="{{ asset('backend/theme/assets/vendor/css/pages/page-auth.css') }}" />
|
||||
<!-- Helpers -->
|
||||
|
||||
<!-- vite -->
|
||||
@vite(['resources/js/backend/app.js'])
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Content -->
|
||||
@yield('content')
|
||||
<!-- / Content -->
|
||||
|
||||
<!-- Vendors JS -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
|
||||
<script src="../../assets/vendor/libs/formvalidation/dist/js/FormValidation.min.js"></script>
|
||||
<script src="../../assets/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js"></script>
|
||||
<script src="../../assets/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
54
Modules/Admin/resources/views/auth/pages/login.blade.php
Normal file
54
Modules/Admin/resources/views/auth/pages/login.blade.php
Normal file
@@ -0,0 +1,54 @@
|
||||
@extends('admin::auth.layouts.master')
|
||||
|
||||
@section('content')
|
||||
<div class="authentication-wrapper authentication-cover">
|
||||
<div class="authentication-inner row m-0">
|
||||
<!-- /Left Text -->
|
||||
<div class="d-none d-lg-flex col-lg-7 col-xl-8 align-items-center">
|
||||
<div class="flex-row text-center mx-auto">
|
||||
<img src="{{ asset('backend/uploads/auth/login.png') }}" alt="Auth Cover Bg color" width="520"
|
||||
class="img-fluid authentication-cover-img" data-app-light-img="pages/login-light.png"
|
||||
data-app-dark-img="pages/login-dark.png" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Left Text -->
|
||||
|
||||
<!-- Login -->
|
||||
<div class="d-flex col-12 col-lg-5 col-xl-4 align-items-center authentication-bg p-sm-5 p-4">
|
||||
<div class="w-px-400 mx-auto">
|
||||
<h4 class="mb-2">Welcome to {{ env('APP_NAME') }}! 👋</h4>
|
||||
<p class="mb-4">Please sign-in to your account and start the adventure</p>
|
||||
|
||||
<form id="formAuthentication" class="mb-3" action="{{ route('login.post') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email or Username</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
placeholder="Enter your email or username" autofocus />
|
||||
</div>
|
||||
<div class="mb-3 form-password-toggle">
|
||||
<div class="d-flex justify-content-between">
|
||||
<label class="form-label" for="password">Password</label>
|
||||
</div>
|
||||
<div x-data="{ showPassword: false }" class="input-group input-group-merge">
|
||||
<input type="password" id="password" class="form-control passwordField" name="password"
|
||||
placeholder="············"
|
||||
aria-describedby="password" x-bind:type="showPassword ? 'text' : 'password'" />
|
||||
<span class="input-group-text cursor-pointer" x-on:click="showPassword = !showPassword">
|
||||
<i x-bind:class="showPassword ? 'bx bx-show' : 'bx bx-hide'"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="remember-me" />
|
||||
<label class="form-check-label" for="remember-me"> Remember Me </label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary d-grid w-100">Sign In</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /Login -->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user