initial commit

main
n0emis 4 years ago
commit 9604e4d22a
Signed by: n0emis
GPG Key ID: 00FAF748B777CF10

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

@ -0,0 +1,21 @@
<?php
namespace Modules\LouketoAuth\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class LouketoAuthDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}

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

@ -0,0 +1,21 @@
<?php
namespace Modules\LouketoAuth\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class LouketoAuthMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
return $next($request);
}
}

@ -0,0 +1,6 @@
<?php
Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\LouketoAuth\Http\Controllers'], function()
{
Route::get('/', 'LouketoAuthController@index');
});

@ -0,0 +1,131 @@
<?php
namespace Modules\LouketoAuth\Providers;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use App\User;
class LouketoAuthServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->hooks();
}
/**
* Module hooks.
*/
public function hooks()
{
\Eventy::addAction('middleware.web.custom_handle', function($request) {
if (!$request->user() && isset($_SERVER['HTTP_X_AUTH_EMAIL'])) {
$user = User::where('email',$_SERVER['HTTP_X_AUTH_EMAIL'])->first();
if (!isset($user)) {
$user = User::create([
"email" => $_SERVER['HTTP_X_AUTH_EMAIL'],
"first_name" => $_SERVER['HTTP_X_AUTH_USERNAME'],
"last_name" => ".",
"password" => str_random(64)
]);
}
if (isset($user->email)) {
\Auth::login($user);
}
}
}, 20, 1);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerTranslations();
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('louketoauth.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'louketoauth'
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = resource_path('views/modules/louketoauth');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
],'views');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/louketoauth';
}, \Config::get('view.paths')), [$sourcePath]), 'louketoauth');
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$this->loadJsonTranslationsFrom(__DIR__ .'/../Resources/lang');
}
/**
* Register an additional directory of factories.
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
*/
public function registerFactories()
{
if (! app()->environment('production')) {
app(Factory::class)->load(__DIR__ . '/../Database/factories');
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}

@ -0,0 +1,9 @@
@extends('louketoauth::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>
This view is loaded from module: {!! config('louketoauth.name') !!}
</p>
@stop

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Module LouketoAuth</title>
</head>
<body>
@yield('content')
</body>
</html>

@ -0,0 +1,25 @@
{
"name": "freescout/louketoauth",
"description": "",
"authors": [
{
"name": "FreeScout",
"email": "support@freescout.net"
}
],
"extra": {
"laravel": {
"providers": [
"Modules\\LouketoAuth\\Providers\\LouketoAuthServiceProvider"
],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\LouketoAuth\\": ""
}
}
}

@ -0,0 +1,22 @@
{
"name": "LouketoAuth",
"alias": "louketoauth",
"description": "",
"version": "1.0.0",
"detailsUrl": "",
"author": "",
"authorUrl": "",
"requiredAppVersion": "1.0.2",
"license": "AGPL-3.0",
"keywords": [],
"active": 0,
"order": 0,
"providers": [
"Modules\\LouketoAuth\\Providers\\LouketoAuthServiceProvider"
],
"aliases": {},
"files": [
"start.php"
],
"requires": []
}

@ -0,0 +1,17 @@
<?php
/*
|--------------------------------------------------------------------------
| Register Namespaces And Routes
|--------------------------------------------------------------------------
|
| When a module starting, this file will executed automatically. This helps
| to register some namespaces like translator or view. Also this file
| will load the routes file for each module. You may also modify
| this file as you want.
|
*/
if (!app()->routesAreCached()) {
require __DIR__ . '/Http/routes.php';
}
Loading…
Cancel
Save