Skip to content

Commit

Permalink
Merge pull request #10 from Crudzaso/develop
Browse files Browse the repository at this point in the history
pr develop to main
  • Loading branch information
alejandro-velasquez authored Nov 1, 2024
2 parents 2727860 + 8f49e28 commit 620dfaf
Show file tree
Hide file tree
Showing 282 changed files with 5,552 additions and 13 deletions.
Empty file.
65 changes: 65 additions & 0 deletions Modules/Draws/app/Http/Controllers/DrawsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace Modules\Draws\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

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

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

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

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

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

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

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

namespace Modules\Draws\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// use Modules\Draws\Database\Factories\DrawsFactory;

class Draws extends Model
{
use HasFactory;

/**
* The attributes that are mass assignable.
*/
protected $fillable = [];

// protected static function newFactory(): DrawsFactory
// {
// // return DrawsFactory::new();
// }
}
Empty file.
118 changes: 118 additions & 0 deletions Modules/Draws/app/Providers/DrawsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php

namespace Modules\Draws\Providers;

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

class DrawsServiceProvider extends ServiceProvider
{
use PathNamespace;

protected string $name = 'Draws';

protected string $nameLower = 'draws';

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

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

namespace Modules\Draws\Providers;

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

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

/**
* 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/Draws/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "nwidart/draws",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {

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

return [
'name' => 'Draws',
];
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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('draws', function (Blueprint $table) {
$table->id();
$table->foreignId('lottery_id')->constrained('lotteries');
$table->dateTime('draw_date');
$table->string('winning_numbers')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('draws');
}
};
Empty file.
16 changes: 16 additions & 0 deletions Modules/Draws/database/seeders/DrawsDatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Modules\Draws\Database\Seeders;

use Illuminate\Database\Seeder;

class DrawsDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}
11 changes: 11 additions & 0 deletions Modules/Draws/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Draws",
"alias": "draws",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Draws\\Providers\\DrawsServiceProvider"
],
"files": []
}
Loading

0 comments on commit 620dfaf

Please sign in to comment.