Skip to content

Commit

Permalink
Merge pull request #70 from Crudzaso/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DiegoAndresRamirez authored Nov 12, 2024
2 parents 5e7e88e + e46005d commit cb13066
Show file tree
Hide file tree
Showing 172 changed files with 126,379 additions and 23 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace Modules\OrganizerPanel\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Modules\Raffle\Models\Raffle;

class OrganizerPanelController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('organizerpanel::index');
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('organizerpanel::create');
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$request->validate([
'organizer_id' => 'required|exists:users,id',
'lottery_id' => 'required|exists:lotteries,id',
'ticket_price' => 'required|numeric|min:0',
'total_tickets' => 'required|integer|min:1',
'tickets_sold' => 'nullable|integer|min:0',
'description' => 'nullable|string',
'start_date' => 'required|date',
'end_date' => 'required|date|after:start_date',
]);

Raffle::create($request->all());

return redirect()->route('raffles.index')->with('success', 'Rifa creada exitosamente.');
}

/**
* Show the specified resource.
*/
public function show($id)
{
return view('organizerpanel::show');
}

/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('organizerpanel::edit');
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}
Empty file.
30 changes: 30 additions & 0 deletions Modules/OrganizerPanel/app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Modules\OrganizerPanel\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
{
//
}
}
118 changes: 118 additions & 0 deletions Modules/OrganizerPanel/app/Providers/OrganizerPanelServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php

namespace Modules\OrganizerPanel\Providers;

use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Traits\PathNamespace;

class OrganizerPanelServiceProvider extends ServiceProvider
{
use PathNamespace;

protected string $name = 'OrganizerPanel';

protected string $nameLower = 'organizerpanel';

/**
* 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
{
$this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config');
$this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower);
}

/**
* 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;
}
}
50 changes: 50 additions & 0 deletions Modules/OrganizerPanel/app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Modules\OrganizerPanel\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
protected string $name = 'OrganizerPanel';

/**
* 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'));
}
}
30 changes: 30 additions & 0 deletions Modules/OrganizerPanel/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "nwidart/organizerpanel",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {

}
}
},
"autoload": {
"psr-4": {
"Modules\\OrganizerPanel\\": "app/",
"Modules\\OrganizerPanel\\Database\\Factories\\": "database/factories/",
"Modules\\OrganizerPanel\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\OrganizerPanel\\Tests\\": "tests/"
}
}
}
Empty file.
5 changes: 5 additions & 0 deletions Modules/OrganizerPanel/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'name' => 'OrganizerPanel',
];
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Modules\OrganizerPanel\Database\Seeders;

use Illuminate\Database\Seeder;

class OrganizerPanelDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}
11 changes: 11 additions & 0 deletions Modules/OrganizerPanel/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "OrganizerPanel",
"alias": "organizerpanel",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\OrganizerPanel\\Providers\\OrganizerPanelServiceProvider"
],
"files": []
}
15 changes: 15 additions & 0 deletions Modules/OrganizerPanel/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Empty file.
Empty file.
Empty file.
Empty file.
20 changes: 20 additions & 0 deletions Modules/OrganizerPanel/resources/views/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@extends('adminlte::page')

@section('title', 'Dashboard')

@section('content_header')
<h1>Bienvenido</h1>
@stop

@section('content')
<p>Welcome to this beautiful admin panel.</p>
@stop

@section('css')
{{-- Add here extra stylesheets --}}
{{-- <link rel="stylesheet" href="/css/admin_custom.css"> --}}
@stop

@section('js')
<script> console.log("Hi, I'm using the Laravel-AdminLTE package!"); </script>
@stop
Loading

0 comments on commit cb13066

Please sign in to comment.