Commit iniziale
This commit is contained in:
commit
097b7e922d
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
|
65
.env.example
Normal file
65
.env.example
Normal file
@ -0,0 +1,65 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=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
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
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
|
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
61
README.md
Normal file
61
README.md
Normal file
@ -0,0 +1,61 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
133
app/Http/Controllers/AnagraficaController.php
Normal file
133
app/Http/Controllers/AnagraficaController.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\anagrafica;
|
||||
use App\Models\contatto;
|
||||
use Illuminate\Http\Request;
|
||||
use Google\Client;
|
||||
Use Google\Service\PeopleService;
|
||||
|
||||
class AnagraficaController extends Controller
|
||||
{
|
||||
// GOOGLE CONTACTS PART
|
||||
|
||||
// private $google_client;
|
||||
|
||||
/* public function getToken()
|
||||
{
|
||||
$client = new Client();
|
||||
$client->setApplicationName('gestionale.lavorain.cloud');
|
||||
if(!is_null($client->getAccessToken())){}
|
||||
elseif(!is_null(session('access_token'))) // is_null(Session::get('access_token', null))
|
||||
{
|
||||
$client->setAccessToken(session('access_token'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope = array();
|
||||
$scope[] = 'https://www.googleapis.com/auth/contacts';
|
||||
// $client->
|
||||
putenv('GOOGLE_APPLICATION_CREDENTIALS='.storage_path('app/google-calendar/service_key.json')); //this can be created with other ENV mode server side
|
||||
$client->useApplicationDefaultCredentials();
|
||||
$token = $client->getAccessToken();
|
||||
session(['access_token' => $token]);
|
||||
}
|
||||
return $client;
|
||||
}*/
|
||||
|
||||
public function getGoogleContacts()
|
||||
{
|
||||
$client = $this->getToken();
|
||||
$service = new PeopleService($client);
|
||||
$profile = $service->people_connections->listPeopleConnections('people/me', array('personFields' => 'names,emailAddresses,phoneNumbers'));
|
||||
}
|
||||
public function getToken()
|
||||
{
|
||||
$configJson =storage_path('app/google-calendar/service_key.json');
|
||||
// $configJson =storage_path('app/google-calendar/people.json');
|
||||
// define an application name
|
||||
$applicationName = 'gestionale-di-famiglia';
|
||||
|
||||
// create the client
|
||||
$client = new \Google_Client();
|
||||
$client->setApplicationName($applicationName);
|
||||
$client->setAuthConfig($configJson);
|
||||
$client->setAccessType('offline'); // necessary for getting the refresh token
|
||||
$client->setApprovalPrompt ('force'); // necessary for getting the refresh token
|
||||
// scopes determine what google endpoints we can access. keep it simple for now.
|
||||
|
||||
$client->setScopes(
|
||||
[
|
||||
/*
|
||||
\Google\Service\Oauth2::USERINFO_PROFILE,
|
||||
\Google\Service\Oauth2::USERINFO_EMAIL,
|
||||
\Google\Service\Oauth2::OPENID,
|
||||
*/
|
||||
\Google\Service\PeopleService::CONTACTS // allows reading of google drive metadata
|
||||
]
|
||||
);
|
||||
$client->setIncludeGrantedScopes(true);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function newContact()
|
||||
{
|
||||
return view('anagrafica.form');
|
||||
}
|
||||
|
||||
public function insContact(Request $request)
|
||||
{
|
||||
anagrafica::inserisci($request);
|
||||
return view('anagrafica.list',['anagrafiche'=>anagrafica::getList()]);
|
||||
}
|
||||
|
||||
public function schedaContact(Request $request)
|
||||
{
|
||||
$dati = anagrafica::getById($request['id']);
|
||||
return view('anagrafica.scheda',['anagrafiche'=>$dati]);
|
||||
}
|
||||
|
||||
public function listContact()
|
||||
{
|
||||
return view('anagrafica.list',['anagrafiche'=>anagrafica::getList()]);
|
||||
}
|
||||
|
||||
public function modifica(Request $request)
|
||||
{
|
||||
return view('anagrafica.form',['anagrafiche'=>anagrafica::getById($request['id'])]);
|
||||
}
|
||||
|
||||
public function getScheda(Request $request)
|
||||
{
|
||||
$id=$request['id'];
|
||||
$anagrafica = anagrafica::getById($id);
|
||||
$contatto=contatto::listContactsById($id);
|
||||
return view('anagrafica.dettagli',['anagrafiche'=>$anagrafica,'contatti'=>$contatto['contatti'],'tipo'=>$contatto['tipo']]);
|
||||
|
||||
}
|
||||
|
||||
public function insOtherContact(Request $param){
|
||||
$contatto=contatto::listContactsById($param['id']);
|
||||
return view('anagrafica.altrocontatto',['id'=>$param['id'],'tipo'=>$contatto['tipo']]);
|
||||
}
|
||||
|
||||
public function saveOtherContact(Request $param){
|
||||
// return view('anagrafica.altrocontatto',[id=>$param['id']]);
|
||||
contatto::saveNewContact($param);
|
||||
$contatto=contatto::listContactsById($param['cnt_fk_anagraficaId']);
|
||||
if($param['another'])
|
||||
{
|
||||
return view('anagrafica.altrocontatto',['tipo'=>$contatto['tipo'],'id'=>$param['cnt_fk_anagraficaId']]);
|
||||
}else {
|
||||
return redirect(Route('contatti'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
42
app/Http/Controllers/Api/CategorieController.php
Normal file
42
app/Http/Controllers/Api/CategorieController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Categorie;
|
||||
|
||||
class CategorieController extends Controller
|
||||
{
|
||||
public function listCategorie()
|
||||
{
|
||||
$categories = Categorie::all();
|
||||
return response()->json($categories);
|
||||
}
|
||||
|
||||
public function insCategorie(Request $request)
|
||||
{
|
||||
$category = new Categorie();
|
||||
$category->cat_name = $request->cat_name;
|
||||
$category->save();
|
||||
|
||||
return response()->json(['message' => 'Categoria inserita con successo'], 201);
|
||||
}
|
||||
|
||||
public function updateCategorie(Request $request, $id)
|
||||
{
|
||||
$category = Categorie::findOrFail($id);
|
||||
$category->cat_name = $request->cat_name;
|
||||
$category->save();
|
||||
|
||||
return response()->json(['message' => 'Categoria aggiornata con successo']);
|
||||
}
|
||||
|
||||
public function deleteCategorie($id)
|
||||
{
|
||||
$category = Categorie::findOrFail($id);
|
||||
$category->delete();
|
||||
|
||||
return response()->json(['message' => 'Categoria eliminata con successo']);
|
||||
}
|
||||
}
|
42
app/Http/Controllers/Api/ContoController.php
Normal file
42
app/Http/Controllers/Api/ContoController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Conto;
|
||||
|
||||
class ContoController extends Controller
|
||||
{
|
||||
public function listConti()
|
||||
{
|
||||
$conti = Conto::all();
|
||||
return response()->json($conti);
|
||||
}
|
||||
|
||||
public function insConto(Request $request)
|
||||
{
|
||||
$conto = new Conto();
|
||||
$conto->nomeConto = $request->nomeConto;
|
||||
$conto->save();
|
||||
|
||||
return response()->json(['message' => 'Conto inserito con successo'], 201);
|
||||
}
|
||||
|
||||
public function updateConto(Request $request, $id)
|
||||
{
|
||||
$conto = Conto::findOrFail($id);
|
||||
$conto->nomeConto = $request->nomeConto;
|
||||
$conto->save();
|
||||
|
||||
return response()->json(['message' => 'Conto aggiornato con successo']);
|
||||
}
|
||||
|
||||
public function deleteConto($id)
|
||||
{
|
||||
$conto = Conto::findOrFail($id);
|
||||
$conto->delete();
|
||||
|
||||
return response()->json(['message' => 'Conto eliminato con successo']);
|
||||
}
|
||||
}
|
28
app/Http/Controllers/Api/MovimentiController.php
Normal file
28
app/Http/Controllers/Api/MovimentiController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Movimenti;
|
||||
|
||||
class MovimentiController extends Controller
|
||||
{
|
||||
public function insMovimentiSpesa(Request $request)
|
||||
{
|
||||
Movimenti::insSpesa($request);
|
||||
return response()->json(['message' => 'Spesa inserita con successo'], 201);
|
||||
}
|
||||
|
||||
public function insMovimentiEntrata(Request $request)
|
||||
{
|
||||
Movimenti::insEntrata($request);
|
||||
return response()->json(['message' => 'Entrata inserita con successo'], 201);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
$movimenti = Movimenti::getList();
|
||||
return response()->json($movimenti);
|
||||
}
|
||||
}
|
10
app/Http/Controllers/AssociazioneController.php
Normal file
10
app/Http/Controllers/AssociazioneController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AssociazioneController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
39
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
39
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
40
app/Http/Controllers/Auth/LoginController.php
Normal file
40
app/Http/Controllers/Auth/LoginController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
$this->middleware('auth')->only('logout');
|
||||
}
|
||||
}
|
72
app/Http/Controllers/Auth/RegisterController.php
Normal file
72
app/Http/Controllers/Auth/RegisterController.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
29
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
29
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
}
|
41
app/Http/Controllers/Auth/VerificationController.php
Normal file
41
app/Http/Controllers/Auth/VerificationController.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
137
app/Http/Controllers/AutoController.php
Normal file
137
app/Http/Controllers/AutoController.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\Accessori;
|
||||
use App\Models\Auto;
|
||||
use App\Models\Manutenzione;
|
||||
use App\Models\Operazione;
|
||||
use App\Models\Revisione;
|
||||
use App\Models\Rifornimento;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class AutoController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
// lista le auto inserite nel gestionale
|
||||
return view('auto.list',['title'=>'Automobile', 'automobili'=>Auto::getAutoList()]);
|
||||
}
|
||||
|
||||
public function newAuto()
|
||||
{
|
||||
// mostra il form di inserimento di una nuova Auto
|
||||
return view('auto.form',['title'=>'Form Automobile']);
|
||||
}
|
||||
|
||||
public function saveAuto(Request $request)
|
||||
{
|
||||
// Salva una nuova auto
|
||||
Auto::saveAuto($request);
|
||||
if ($request['another']=='on')
|
||||
{
|
||||
return redirect(route('auto_new'));
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
}
|
||||
|
||||
public function delAuto(Request $id)
|
||||
{
|
||||
Auto::delAuto($id);
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
|
||||
public function getAutoDetails(request $id)
|
||||
{
|
||||
// Ritorna i dettagli dell'auto
|
||||
/*return view('auto.detail',[
|
||||
'dettagli' => Auto::getAutoById($id['id']),]);*/
|
||||
return Operazione::getOperazioni($id['id']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getTCOAuto(request $id)
|
||||
{
|
||||
// Ritorna la somma di tutti i costi sostenuti per l'auto
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function rifornimentoAuto(Request $id)
|
||||
{
|
||||
return view('auto.rifornimento',['id'=>$id['id'],'dettagli'=>Auto::getAutoById($id['id'])]);
|
||||
}
|
||||
|
||||
public function manutenzioneAuto(Request $id)
|
||||
{
|
||||
return view('auto.manutenzione',['id'=>$id['id'],'dettagli'=>Auto::getAutoById($id['id'])]);
|
||||
}
|
||||
|
||||
public function revisioneAuto(Request $id)
|
||||
{
|
||||
return view('auto.revisione',['id'=>$id['id'],'dettagli'=>Auto::getAutoById($id['id'])]);
|
||||
}
|
||||
|
||||
public function accessoriAuto(Request $id)
|
||||
{
|
||||
return view('auto.accessori',['id'=>$id['id'],'dettagli'=>Auto::getAutoById($id['id'])]);
|
||||
}
|
||||
|
||||
public function saveRifornimento(Request $request)
|
||||
{
|
||||
$id=Operazione::saveOperazione($request);
|
||||
Rifornimento::saveRifornimento($id,$request);
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
|
||||
public function saveManutenzione(Request $request)
|
||||
{
|
||||
$id=Operazione::saveOperazione($request);
|
||||
Manutenzione::saveManutenzione($id,$request);
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
|
||||
public function saveAccessori(Request $request)
|
||||
{
|
||||
$id=Operazione::saveOperazione($request);
|
||||
Accessori::saveAccessori($id,$request);
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
|
||||
public function saveRevisione(Request $request)
|
||||
{
|
||||
$id=Operazione::saveOperazione($request);
|
||||
Revisione::saveRevisione($id,$request);
|
||||
return redirect(route('auto_list'));
|
||||
}
|
||||
|
||||
public function getOperazioni(Request $request)
|
||||
{
|
||||
$operazioni=Operazione::getOperazioni($request['id']);
|
||||
// dd($operazioni);
|
||||
}
|
||||
|
||||
public function exportPdfOperazioni(Request $id)
|
||||
{
|
||||
$pdf=Operazione::exportPdfOperazioni($id['id']);
|
||||
}
|
||||
|
||||
public function getAutoById($id)
|
||||
{
|
||||
return json_encode(Auto::getAutoById($id));
|
||||
}
|
||||
|
||||
public function udateAuto(Request $request)
|
||||
{
|
||||
Auto::updateAuto($request);
|
||||
return redirect('/admin/auto');
|
||||
}
|
||||
}
|
16
app/Http/Controllers/AvvisoController.php
Normal file
16
app/Http/Controllers/AvvisoController.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Avviso;
|
||||
|
||||
class AvvisoController extends Controller
|
||||
{
|
||||
//
|
||||
public function saveAvviso(Request $request)
|
||||
{
|
||||
Avviso::newAvviso($request);
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
66
app/Http/Controllers/CategorieController.php
Normal file
66
app/Http/Controllers/CategorieController.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Categorie;
|
||||
|
||||
class CategorieController extends Controller
|
||||
{
|
||||
// Gestione delle categorie di movimento
|
||||
// TODO: sistemare la gestione dei dati nel Model Categorie
|
||||
|
||||
public static function listCategorie(){
|
||||
|
||||
return view('conti.categorie.list',['categorie'=>Categorie::list()]);
|
||||
}
|
||||
|
||||
public static function insCategorie(Request $request)
|
||||
{
|
||||
$validated=$request->validate([
|
||||
'cat_name' => 'required',
|
||||
]);
|
||||
Categorie::inserisci($request);
|
||||
return view('conti.categorie.list',['categorie'=>Categorie::list()]);
|
||||
}
|
||||
|
||||
public function deleteCategorie(Request $request)
|
||||
{
|
||||
|
||||
Categorie::deleteById($request['id']);
|
||||
return redirect(route('categorie'));
|
||||
}
|
||||
|
||||
|
||||
public function updatePostCategorie(Request $request)
|
||||
{
|
||||
Categorie::updateNameById($request);
|
||||
return redirect(route('categorie'));
|
||||
}
|
||||
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
$categorie=Categorie::listCategorieAPI();
|
||||
return json_encode($categorie);
|
||||
}
|
||||
|
||||
public function updateCategorie($id)
|
||||
{
|
||||
$categorie = Categorie::getById($id);
|
||||
return json_encode($categorie);
|
||||
}
|
||||
|
||||
public function apiListSpesa()
|
||||
{
|
||||
$categorie=Categorie::listSpesa();
|
||||
return json_encode($categorie);
|
||||
}
|
||||
|
||||
public function apiListEntrata()
|
||||
{
|
||||
$categorie=Categorie::listEntrata();
|
||||
return json_encode($categorie);
|
||||
}
|
||||
}
|
95
app/Http/Controllers/CentralTenantController.php
Normal file
95
app/Http/Controllers/CentralTenantController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CentralTenant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Support\Facades\Artisan; // Include the Artisan facade
|
||||
|
||||
class CentralTenantController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Ritorna la lista dei tenants attivi
|
||||
return view('centraltenant.index', ['tenants' => CentralTenant::listTenants()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//Ritorna la view del form per la creazione di un nuovo tenant
|
||||
return view('centraltenant.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$validated = $request->validate([
|
||||
'tenant_name' => 'required | unique:tenants,id',
|
||||
'fqdn_domain' => 'required | unique:domains,domain'
|
||||
]);
|
||||
|
||||
$tenant1 = Tenant::create(['id' => $request->tenant_name]);
|
||||
$tenant1->domains()->create(['domain' => $request->fqdn_domain]);
|
||||
Artisan::call('tenants:migrate', ['--tenants' => $request->tenant_name]);
|
||||
Artisan::call('tenants:seed', ['--tenants' => $request->tenant_name]);
|
||||
/*Artisan::call('tenants:run storage:link', ['--tenants' => $request->tenant_name]);*/
|
||||
|
||||
return redirect()->route('home.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(CentralTenant $centralTenant)
|
||||
{
|
||||
//
|
||||
return view('centraltenant.show', ['tenant' => $centralTenant]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($home)
|
||||
{
|
||||
//
|
||||
return view('centraltenant.edit', ['tenant' => \App\Models\CentralTenant::getTenant($home)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, CentralTenant $centralTenant)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($home)
|
||||
{
|
||||
// dd($home);
|
||||
//$tenant1 = Tenant::create(['id' => $request->tenant_name]);
|
||||
$tenant1 = Tenant::destroy(['id' => $home]);
|
||||
return redirect()->route('home.index');
|
||||
}
|
||||
|
||||
public function backupTenant($home)
|
||||
{
|
||||
|
||||
$tenant = CentralTenant::backupTenant($home);
|
||||
/*$tenant->backup();
|
||||
return redirect()->route('home.index');
|
||||
*/
|
||||
}
|
||||
}
|
28
app/Http/Controllers/CondominioController.php
Normal file
28
app/Http/Controllers/CondominioController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
|
||||
class CondominioController extends Controller
|
||||
{
|
||||
public function testPdf(){
|
||||
$data=DB::table('categories')->get();
|
||||
$pdf = PDF::setOptions(['dpi' => 150, 'defaultFont' => 'Helvetica'])->loadView('conti.categorie.list', ['categorie' => $data->toArray()]);
|
||||
//return $pdf->download('invoice.pdf');
|
||||
/*$pdf = App::make('dompdf.wrapper');
|
||||
$pdf->loadHTML('<h1>Test</h1>');*/
|
||||
return $pdf->stream();
|
||||
}
|
||||
|
||||
public function err403()
|
||||
{
|
||||
abort(403);
|
||||
}
|
||||
|
||||
|
||||
}
|
22
app/Http/Controllers/ContatoreEnElController.php
Normal file
22
app/Http/Controllers/ContatoreEnElController.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\contatoreEnEl;
|
||||
|
||||
class ContatoreEnElController extends Controller
|
||||
{
|
||||
public static function listLettureEnel(){
|
||||
$letture=ContatoreEnel::getList();
|
||||
return view('letture.enel.list',['lettureEnel'=>$letture]);
|
||||
}
|
||||
|
||||
public static function insLettureEnel(Request $request)
|
||||
{
|
||||
ContatoreEnel::inserisci($request);
|
||||
$letture=ContatoreEnel::getList();
|
||||
return view('letture.enel.list',['lettureEnel'=>$letture]);
|
||||
}
|
||||
}
|
23
app/Http/Controllers/ContatoreGasController.php
Normal file
23
app/Http/Controllers/ContatoreGasController.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\contatoreGas;
|
||||
|
||||
|
||||
class ContatoreGasController extends Controller
|
||||
{
|
||||
public static function listLettureGas(){
|
||||
$letture=ContatoreGas::getList();
|
||||
return view('components.chartGas',['lettureGas'=>$letture]);
|
||||
}
|
||||
|
||||
public static function insLettureGas(Request $request)
|
||||
{
|
||||
ContatoreGas::inserisci($request);
|
||||
$letture=ContatoreGas::getList();
|
||||
return view('components.chartGas',['lettureGas'=>$letture]);
|
||||
}
|
||||
}
|
10
app/Http/Controllers/ContattoController.php
Normal file
10
app/Http/Controllers/ContattoController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContattoController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
106
app/Http/Controllers/ContoController.php
Normal file
106
app/Http/Controllers/ContoController.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Conto;
|
||||
use Illuminate\Http\Request;
|
||||
//use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
|
||||
class ContoController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$conti=Conto::all();
|
||||
return view('conti.conto.index',compact('conti'));
|
||||
}
|
||||
|
||||
public function apiListConto()
|
||||
{
|
||||
//
|
||||
$conti=Conto::all();
|
||||
return json_encode($conti);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return view('conti.conto.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$conto=Conto::create($request->all());
|
||||
return redirect()->to('/admin/conti');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Conto $conti)
|
||||
{
|
||||
//
|
||||
$conto=Conto::find($conti);
|
||||
return view('conti.conto.show',compact('conto'));
|
||||
/*
|
||||
Rivedere il passaggio parametri e indicare anche le variabili $conto->saldo_anno_corrente $conto->saldo_anno_precedente $conto->saldo_anno_precedente_2
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Conto $conti)
|
||||
{
|
||||
//
|
||||
$conto=Conto::find($conti);
|
||||
return json_encode($conto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Conto $conti)
|
||||
{
|
||||
$validated= $request->validate([
|
||||
'nomeConto'=>'required',
|
||||
'Banca'=>'required',
|
||||
//'IBAN'=>'required',
|
||||
//'saldo_iniziale'=>'required',
|
||||
//'note'=>'required',
|
||||
]);
|
||||
//
|
||||
/*$conto = Conto::find($conti);
|
||||
$conto->nomeConto=$request->nomeConto;
|
||||
$conto->Banca=$request->Banca;
|
||||
$conto->IBAN=$request->IBAN;
|
||||
$conto->saldo_iniziale=$request->saldo_iniziale;
|
||||
$conto->note=$request->note;
|
||||
$conto->save();*/
|
||||
Conto::whereId($conti->id)->update($request->except('_token','_method'));
|
||||
return redirect()->to('/admin/conti');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Conto $conto)
|
||||
{
|
||||
//
|
||||
$conti=Conto::find($conto);
|
||||
$conti->delete();
|
||||
return redirect()->route('conti.conto.index');
|
||||
}
|
||||
}
|
65
app/Http/Controllers/ContrattiController.php
Normal file
65
app/Http/Controllers/ContrattiController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Contratti;
|
||||
use App\Models\GenDoc;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ContrattiController extends Controller
|
||||
{
|
||||
//
|
||||
public function contratti()
|
||||
{
|
||||
return view('contratti.lista',['data'=>Contratti::getAllContratto()]);
|
||||
}
|
||||
|
||||
public function newContratto(Request $request)
|
||||
{
|
||||
// Contratti::storeContratto($request);
|
||||
//dd($request);
|
||||
if (isset($request['filename'])) {
|
||||
$filename = $request->file('filename')->store('Contratti');
|
||||
}else{
|
||||
$filename=null;
|
||||
}
|
||||
Contratti::create([
|
||||
'numero'=>$request['numero'],
|
||||
'nome'=>$request['nome'],
|
||||
'datainizio'=>date_format(date_create($request['datainizio']),'Y-m-d'),
|
||||
'datatermine'=>date_format(date_create($request['datatermine']),'Y-m-d'),
|
||||
'fornitore'=>$request['fornitore'],
|
||||
'tipo'=>$request['tipo'],
|
||||
'importo'=>$request['importo'],
|
||||
'scadenzapagamento'=>date_format(date_create($request['scadenzapagamento']),'Y-m-d'),
|
||||
'stato'=>$request['stato'],
|
||||
'note'=>$request['note'],
|
||||
'filename'=>$filename,
|
||||
]);
|
||||
return redirect()->back();
|
||||
}
|
||||
/* */
|
||||
|
||||
public function schedaContratto($id)
|
||||
{
|
||||
$contratto = Contratti::getContrattoById($id);
|
||||
return view('contratti.detail',[
|
||||
'contratto'=>$contratto,
|
||||
'docs' => \App\Models\GenDoc::listDocument(1,$id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function documentDelete(Request $id)
|
||||
{
|
||||
// return dd($id);
|
||||
// $entity=1;
|
||||
$contratto=GenDoc::find($id['id']);
|
||||
if(file_exists('/storage/'.$contratto->filename))
|
||||
{
|
||||
unlink('storage/'.$contratto->filename);
|
||||
}
|
||||
GenDoc::find($id['id'])->delete();
|
||||
return redirect('/admin/contratti/'.$id['entity_id']);
|
||||
}
|
||||
}
|
13
app/Http/Controllers/Controller.php
Normal file
13
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
46
app/Http/Controllers/DocumentiController.php
Normal file
46
app/Http/Controllers/DocumentiController.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Documenti;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DocumentiController extends Controller
|
||||
{
|
||||
//
|
||||
public function storeFile(Request $req){
|
||||
if ($req->hasFile('filename'))
|
||||
{
|
||||
Documenti::store($req);
|
||||
return redirect(route('documenti',['id'=>$req->input('id'),]));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'Nessun File trovato';
|
||||
}
|
||||
}
|
||||
|
||||
public function fileForm(Request $request){
|
||||
$documenti = Documenti::getList($request->input('entity_id'));
|
||||
|
||||
return view('conti.documenti.insert', [
|
||||
'id'=>$request->input('entity_id'),
|
||||
'documenti'=>$documenti
|
||||
]);
|
||||
}
|
||||
|
||||
public function newFolder(Request $req)
|
||||
{
|
||||
// crea una nuova caregoria per i documenti
|
||||
Documenti::store($req);
|
||||
return redirect(route('folders'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function listaDocumenti()
|
||||
{
|
||||
return view('documenti.lista',['data'=>Documenti::all()]);
|
||||
}
|
||||
}
|
97
app/Http/Controllers/FullCalenderController.php
Normal file
97
app/Http/Controllers/FullCalenderController.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Event;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\GoogleCalendar\Event as Events;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class FullCalenderController extends Controller
|
||||
{
|
||||
/**
|
||||
|
||||
* Write code on Method
|
||||
|
||||
*
|
||||
|
||||
* @return response()
|
||||
|
||||
*/
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
if($request->ajax()) {
|
||||
$data = Event::whereDate('start', '>=', $request->start)
|
||||
->whereDate('end', '<=', $request->end)
|
||||
->get(['id', 'title', 'start', 'end']);
|
||||
return response()->json($data);
|
||||
}
|
||||
return view('calendario.fullcalendar');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* Write code on Method
|
||||
|
||||
*
|
||||
|
||||
* @return response()
|
||||
|
||||
*/
|
||||
|
||||
public function ajax(Request $request)
|
||||
{
|
||||
switch ($request->type) {
|
||||
case 'add':
|
||||
$event = Event::create([
|
||||
'title' => $request->title,
|
||||
'description' => $request->description,
|
||||
'start' => $request->start,
|
||||
'end' => $request->end,
|
||||
]);
|
||||
return response()->json($event);
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$event = Event::find($request->id)->update([
|
||||
'title' => $request->title,
|
||||
'description' => $request->description,
|
||||
'start' => $request->start,
|
||||
'end' => $request->end,
|
||||
]);
|
||||
return response()->json($event);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$event = Event::find($request->id)->delete();
|
||||
return response()->json($event);
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function showDemo()
|
||||
{
|
||||
return view('calendario.fullcalendar');
|
||||
}
|
||||
|
||||
public function saveEventToGoogle(Request $request){
|
||||
$event = new Events;
|
||||
$event->name = $request['title'];
|
||||
$event->description=$request['descrizione'];
|
||||
$tzStart = $request['DateStart'].'T'.$request['HourStart'].' +02:00';
|
||||
$tzEnd = $request['DateEnd'].'T'.$request['HourEnd'].' +02:00';
|
||||
$event->startDateTime = Carbon::parse($tzStart);
|
||||
$event->endDateTime = Carbon::parse($tzEnd);
|
||||
$event->save();
|
||||
return view('calendario.fullcalendar');
|
||||
}
|
||||
}
|
39
app/Http/Controllers/GenDocController.php
Normal file
39
app/Http/Controllers/GenDocController.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\GenDoc;
|
||||
|
||||
class GenDocController extends Controller
|
||||
{
|
||||
//
|
||||
public function fileForm(Request $request){
|
||||
$entity_id=$request->input('entity_id');
|
||||
$entity=$request->input('entity');
|
||||
|
||||
if(!$request->input('entity_id'))
|
||||
{
|
||||
$entity_id=0;
|
||||
}
|
||||
$documenti = GenDoc::listDocument($entity,$entity_id);
|
||||
return view('conti.documenti.gendoc', [
|
||||
'id'=>$entity_id,
|
||||
'entity'=>$entity,
|
||||
'documenti'=>$documenti,
|
||||
]);
|
||||
}
|
||||
|
||||
public function storeFile(Request $request){
|
||||
GenDoc::saveDocument($request);
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function deleteFile(Request $request)
|
||||
{
|
||||
GenDoc::delDocument($request->id);
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
}
|
10
app/Http/Controllers/GruppiController.php
Normal file
10
app/Http/Controllers/GruppiController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GruppiController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
24
app/Http/Controllers/HomeAssistantAPIController.php
Normal file
24
app/Http/Controllers/HomeAssistantAPIController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\HomeAssistantAPI;
|
||||
|
||||
class HomeAssistantAPIController extends Controller
|
||||
{
|
||||
// Connessione RestAPI di HomeAssistant
|
||||
|
||||
public function getContatore()
|
||||
{
|
||||
$kwh = HomeAssistantAPI::getSensorState('sensor.contatore_casa');
|
||||
return $kwh->state;
|
||||
}
|
||||
|
||||
public function getStatoPompa()
|
||||
{
|
||||
$statoPompa = HomeAssistantAPI::getSensorState('switch.pompa_pozzo');
|
||||
return $statoPompa->state;
|
||||
//dd($statoPompa);
|
||||
}
|
||||
}
|
79
app/Http/Controllers/HomeController.php
Normal file
79
app/Http/Controllers/HomeController.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// return view('home');
|
||||
return redirect('/admin');
|
||||
}
|
||||
|
||||
public function backupTenant($tenantId=null) {
|
||||
// 1. Identificazione del tenant
|
||||
if (!isset($tenantId)){
|
||||
$tenantId = tenant()->id;
|
||||
}
|
||||
$tenant = Tenant::find($tenantId);
|
||||
if (!$tenant) {
|
||||
return 'Tenant non trovato.';
|
||||
}
|
||||
|
||||
// 2. Switch al tenant
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
// 3. Generazione del nome del file zip
|
||||
$fileName = $tenantId . '_' . date('YmdHms') . '.zip';
|
||||
$zipPath = storage_path('app/' . $fileName);
|
||||
|
||||
// 4. Creazione dell'archivio zip
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
|
||||
return 'Impossibile creare l\'archivio zip.';
|
||||
}
|
||||
|
||||
// 5. Dump del database
|
||||
$databaseName = config('database.connections.tenant.database'); // Assumi 'tenant' come connessione per i tenant
|
||||
$dumpFile = storage_path('app/temp_dump.sql');
|
||||
$command = "mysqldump -u " . config('database.connections.tenant.username') . " -p" . config('database.connections.tenant.password') . " " . $databaseName . " > " . $dumpFile;
|
||||
exec($command);
|
||||
$zip->addFile($dumpFile, 'database.sql');
|
||||
|
||||
// 6. Aggiunta della cartella storage
|
||||
//$storagePath = storage_path('app/tenant/' .$tenantId); // Assumi una struttura di storage separata per tenant
|
||||
$storagePath = storage_path();
|
||||
$files = \File::allFiles($storagePath);
|
||||
foreach ($files as $file) {
|
||||
$relativePath = str_replace($storagePath . '/', '', $file->getPathname());
|
||||
$zip->addFile($file->getPathname(), 'storage/' . $relativePath);
|
||||
}
|
||||
|
||||
// 7. Chiusura dell'archivio zip
|
||||
$zip->close();
|
||||
|
||||
// 8. Download del file
|
||||
// dd($zipPath);
|
||||
return response()->download($zipPath, $fileName, [
|
||||
'Content-Type' => 'application/zip',
|
||||
'Content-Disposition' => 'attachment; filename="' . $fileName . '"',
|
||||
])->deleteFileAfterSend(true); // Cancella il file dopo il download
|
||||
}
|
||||
}
|
65
app/Http/Controllers/ImportRuleController.php
Normal file
65
app/Http/Controllers/ImportRuleController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ImportRule;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ImportRuleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(ImportRule $importRule)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(ImportRule $importRule)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, ImportRule $importRule)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(ImportRule $importRule)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
363
app/Http/Controllers/MovimentiController.php
Normal file
363
app/Http/Controllers/MovimentiController.php
Normal file
@ -0,0 +1,363 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Categorie;
|
||||
use App\Models\Movimenti;
|
||||
use App\Models\tag;
|
||||
use App\Models\Task;
|
||||
use App\Models\Avviso;
|
||||
use App\Models\Conto;
|
||||
// use App\Http\Controllers\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Rap2hpoutre\FastExcel\FastExcel;
|
||||
|
||||
class MovimentiController extends Controller
|
||||
{
|
||||
// Gestione dei movimenti
|
||||
public static function newMovimenti() {
|
||||
$categorie=Categorie::list(); // TODO: da risolvere con jquery nella pagina blade conti.movimenti.list
|
||||
$tags=tag::getList(); // TODO: da risolvere con jquery nella pagina blade conti.movimenti.list (spiegazione su https://library.webschool.com/lezione/guida-jquery-recuperare-dati-da-php-con-json-2564.html )
|
||||
return view('conti.movimenti.new',[
|
||||
'categorie'=>$categorie,
|
||||
'tags'=>$tags,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function listMovimenti(){
|
||||
$categorie=Categorie::list();
|
||||
$tags=tag::getList();
|
||||
/* Query per visualizzare anche il totale dei documenti presenti per il record */
|
||||
$movimenti=Movimenti::getList();
|
||||
|
||||
|
||||
return view('conti.movimenti.list',[
|
||||
'categorie'=>$categorie,
|
||||
'movimenti'=>$movimenti,
|
||||
'tags'=>$tags
|
||||
]);
|
||||
}
|
||||
|
||||
public static function dashboard()
|
||||
{
|
||||
/*$bilancio=Movimenti::getSaldo(date('Y'));*/
|
||||
$entrate=Movimenti::getEntrate(date('Y'));
|
||||
$uscite=Movimenti::getUscite(date('Y'));
|
||||
$saldo=Movimenti::getSaldoTot();
|
||||
$mieiTasks=Task::getTaskAssignedToUser(Auth::id());
|
||||
// $TasksAssegnati=Task::getTaskAssignedByUser(Auth::id());
|
||||
// $avvisi=Avviso::getAvvisi();
|
||||
$avvisi=Avviso::getActualAvvisi();
|
||||
|
||||
return view('layouts.dashboard',[
|
||||
'entrate'=>$entrate,
|
||||
'uscite'=>$uscite,
|
||||
'saldo'=>$saldo,
|
||||
'mieitask' => $mieiTasks,
|
||||
// 'assegnati' => $TasksAssegnati,
|
||||
'avvisi'=>$avvisi,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function insMovimentiSpesa(Request $request)
|
||||
{
|
||||
// dd($request);
|
||||
$validated=$request->validate([
|
||||
'mov_data'=>'required',
|
||||
'mov_importo'=>'required | numeric' ,
|
||||
|
||||
]);
|
||||
Movimenti::insSpesa($request);
|
||||
$mov=Movimenti::getList();
|
||||
$categorie=Categorie::listSpesa();
|
||||
$tags=tag::getList();
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'categorie'=> $categorie,
|
||||
'movimenti'=> $mov,
|
||||
'tags'=>$tags,
|
||||
]);
|
||||
|
||||
/* return dd($mov);*/
|
||||
}
|
||||
public static function insMovimentiEntrata(Request $request)
|
||||
{
|
||||
$validated=$request->validate([
|
||||
'mov_data'=>'required',
|
||||
'mov_importo'=>'required | numeric' ,
|
||||
|
||||
]);
|
||||
Movimenti::insEntrata($request);
|
||||
$mov=Movimenti::getList();
|
||||
$categorie=Categorie::listEntrata();
|
||||
$tags=tag::getList();
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'categorie'=> $categorie,
|
||||
'movimenti'=> $mov,
|
||||
'tags'=>$tags,
|
||||
]);
|
||||
|
||||
/* return dd($mov);*/
|
||||
}
|
||||
public function exportMovimenti()
|
||||
{
|
||||
$movimenti = Movimenti::export();
|
||||
foreach ($movimenti as $movimento)
|
||||
{
|
||||
$lista[]=[
|
||||
'Data'=> date_format(date_create($movimento->Data),'d/m/Y'),
|
||||
'Categoria'=>$movimento->Categoria,
|
||||
'Tag'=>$movimento->Tag,
|
||||
'Descrizione'=>$movimento->Descrizione,
|
||||
'Importo'=>$movimento->Importo,
|
||||
'Conto'=>$movimento->Conto,
|
||||
];
|
||||
}
|
||||
return (new FastExcel($lista))->download('movimenti_al_'.date('d-m-Y').'.xls');
|
||||
// return dd($movimenti);
|
||||
}
|
||||
|
||||
public function resocontoMovimenti(Request $request)
|
||||
{
|
||||
if(!$request['Year'])
|
||||
{
|
||||
$year=date('Y');
|
||||
}
|
||||
else {
|
||||
$year=$request['Year'];
|
||||
}
|
||||
|
||||
if (!$request['Month'])
|
||||
{
|
||||
$month=date('m');
|
||||
}
|
||||
else {
|
||||
$month=$request['Month'];
|
||||
}
|
||||
|
||||
$reportSpesa = Movimenti::reportSpesa($year, $month);
|
||||
$reportEntrate = Movimenti::reportEntrate($year,$month);
|
||||
|
||||
return view('components.charts',[
|
||||
'dataSpesa'=>$reportSpesa,
|
||||
'dataEntrate'=>$reportEntrate,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updatePostMovimenti(Request $request)
|
||||
{
|
||||
Movimenti::updateMovimenti($request);
|
||||
// return redirect()->back();
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'movimenti'=> Movimenti::getList(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteMovimenti(Request $request)
|
||||
{
|
||||
Movimenti::deleteMovimento($request['id']);
|
||||
return redirect('/admin/movimenti');
|
||||
|
||||
}
|
||||
|
||||
public function girocontoPost(Request $request)
|
||||
{
|
||||
Movimenti::giroconto($request);
|
||||
return redirect('/admin/movimenti');
|
||||
}
|
||||
|
||||
public function giroconto()
|
||||
{
|
||||
$categorie=Categorie::list();
|
||||
return view('conti.giroconto.form',[
|
||||
'categories'=>$categorie,
|
||||
'contos'=>Conto::all(),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public function listMovPerCateg(Request $request)
|
||||
{
|
||||
if($request['year'])
|
||||
{
|
||||
$anno=$request['year'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$anno=date('Y');
|
||||
}
|
||||
$mov=Movimenti::listByCatMonth($request['month'], $request['cat'],$anno);
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'movimenti'=> $mov,
|
||||
]);
|
||||
}
|
||||
|
||||
public function listMovByCat(Request $request)
|
||||
{
|
||||
$mov=Movimenti::listByCategory($request['cat']);
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'movimenti'=> $mov,
|
||||
]);
|
||||
}
|
||||
|
||||
public function reportCategorieAnno($anno = 0)
|
||||
{
|
||||
if ($anno <= 1970)
|
||||
{
|
||||
$anno = date('Y');
|
||||
}
|
||||
|
||||
$mesi=['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
|
||||
$categorie=Categorie::list();
|
||||
|
||||
foreach ($categorie as $categoria)
|
||||
{
|
||||
$id=$categoria->id;
|
||||
$ncategoria=$categoria->cat_name;
|
||||
for ($i=1;$i<=12;$i++)
|
||||
{
|
||||
$movrow=DB::table('movimentis')
|
||||
->whereMonth('mov_data','=',$i)
|
||||
->whereYear('mov_data','=',$anno)
|
||||
->where('mov_fk_categoria','=',$id)
|
||||
->sum('mov_importo');
|
||||
$coll[]=$movrow;
|
||||
$collx[]=$movrow;
|
||||
}
|
||||
$totale[]=array_sum($collx);
|
||||
unset($collx);
|
||||
}
|
||||
/*dd($totale);*/
|
||||
$anni=Movimenti::getYearsFromMovimenti();
|
||||
// dd($anni);
|
||||
return view('conti.report.catanno',[
|
||||
'categorie'=>$categorie,
|
||||
'mesi'=>$mesi,
|
||||
'matrice'=>array_chunk($coll, 12),
|
||||
'totale'=>$totale,
|
||||
'anno'=>$anno,
|
||||
'sel_anni'=>$anni,
|
||||
]);
|
||||
}
|
||||
|
||||
public function reportCategorieAnnoXLS($anno = 0)
|
||||
{
|
||||
if ($anno <= 1970)
|
||||
{
|
||||
$anno = date('Y');
|
||||
}
|
||||
|
||||
$intestazione=['Categoria','Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
|
||||
$categorie=DB::table('categories')->orderBy('cat_name')->get();
|
||||
|
||||
foreach ($categorie as $categoria)
|
||||
{
|
||||
$id=$categoria->id;
|
||||
$ncategoria=$categoria->cat_name;
|
||||
for ($i=1;$i<=12;$i++)
|
||||
{
|
||||
$movrow=DB::table('movimentis')
|
||||
->whereMonth('mov_data','=',$i)
|
||||
->whereYear('mov_data','=',$anno)
|
||||
->where('mov_fk_categoria','=',$id)
|
||||
->sum('mov_importo');
|
||||
$coll[] = $movrow;
|
||||
|
||||
}
|
||||
|
||||
$row[]=array_combine($intestazione,array_merge(array($ncategoria),$coll));
|
||||
unset($coll);
|
||||
}
|
||||
return (new FastExcel($row))->download('report_al_'.date('d-m-Y').'.xls');
|
||||
}
|
||||
|
||||
public function filterByTag(Request $tag)
|
||||
{
|
||||
$mov=Movimenti::getByTag($tag['tag']);
|
||||
return view('conti.movimenti.list',
|
||||
[
|
||||
'movimenti'=> $mov,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
$movments = Movimenti::getList();
|
||||
return json_encode($movments);
|
||||
}
|
||||
|
||||
private function dateFormat($type,$string)
|
||||
{
|
||||
if($type)
|
||||
{
|
||||
list($year,$month,$day) = explode('-',$string);
|
||||
return $day.'/'.$month.'/'.$year;
|
||||
} else {
|
||||
list($day,$month,$year) =explode('/',$string);
|
||||
return $year.'-'.$month.'-'.$day;
|
||||
}
|
||||
}
|
||||
|
||||
public function importEC_ING(Request $request)
|
||||
{
|
||||
if ($request->hasFile('filename'))
|
||||
{
|
||||
$filename=$request->file('filename')->store();
|
||||
Movimenti::importEstrattoIng($filename);
|
||||
|
||||
return redirect(Route('movimenti'));
|
||||
}
|
||||
else {
|
||||
return 'Nessun File trovato';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function importEC_CR(Request $request)
|
||||
{
|
||||
if ($request->hasFile('filename'))
|
||||
{
|
||||
$filename=$request->file('filename')->store();
|
||||
Movimenti::importEstrattoCR($filename);
|
||||
|
||||
return redirect(Route('movimenti'));
|
||||
}
|
||||
else {
|
||||
return 'Nessun File trovato';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function importFile()
|
||||
{
|
||||
return view('conti.import');
|
||||
}
|
||||
|
||||
public function importFileCR()
|
||||
{
|
||||
return view('conti.importCR');
|
||||
}
|
||||
|
||||
/* public function test()
|
||||
{
|
||||
Movimenti::getYearsFromMovimenti();
|
||||
}*/
|
||||
|
||||
public function manageRedirect(Request $request)
|
||||
{
|
||||
return redirect('/admin/movimenti/reportbudget/'.$request['anno']);
|
||||
}
|
||||
|
||||
public function updateMovimenti($id)
|
||||
{
|
||||
$mov=Movimenti::getMovimentoById($id);
|
||||
return json_encode($mov);
|
||||
}
|
||||
}
|
115
app/Http/Controllers/ProgettiController.php
Normal file
115
app/Http/Controllers/ProgettiController.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Progetti;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\RigaProgetto;
|
||||
use App\Models\GenDoc;
|
||||
use function GuzzleHttp\json_encode;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
class ProgettiController extends Controller
|
||||
{
|
||||
//
|
||||
public function listaProgetto()
|
||||
{
|
||||
/* $progetti=Progetti::getProgetti();
|
||||
dd($progetti);*/
|
||||
return view('progetti.list',[
|
||||
'progetti'=>Progetti::getProgetti()
|
||||
]);
|
||||
}
|
||||
|
||||
public function nuovoProgetto()
|
||||
{
|
||||
return view('progetti.new',['coordinatori'=>User::getUsers()]);
|
||||
}
|
||||
|
||||
public function getCoordinatori()
|
||||
{
|
||||
return json_encode(User::getUsers());
|
||||
}
|
||||
|
||||
public function salvaProgetto(Request $request)
|
||||
{
|
||||
Progetti::saveProgetto($request);
|
||||
return redirect(Route('progetti'));
|
||||
}
|
||||
|
||||
public function deleteProgetto(Request $param) {
|
||||
Progetti::delProgetto($param['id']);
|
||||
return redirect(Route('progetti'));
|
||||
}
|
||||
|
||||
|
||||
public function dettaglioProgetto($id)
|
||||
{
|
||||
$progetto_id=$id;
|
||||
$progetto = Progetti::getProgettoById($progetto_id);
|
||||
$righe = RigaProgetto::getRigheProgetto($progetto_id);
|
||||
$costo_tot=RigaProgetto::getCostoRighe($progetto_id);
|
||||
return view('progetti.dettaglio',['dettaglio'=>$progetto, 'righe'=>$righe, 'tot'=>$costo_tot]);
|
||||
//dd($righe);
|
||||
}
|
||||
|
||||
public function chiudiProgetto(Request $id)
|
||||
{
|
||||
Progetti::chiudiProgetto($id['id']);
|
||||
return redirect(Route('progetti'));
|
||||
}
|
||||
|
||||
public function riapriProgetto(Request $id)
|
||||
{
|
||||
Progetti::riapriProgetto($id['id']);
|
||||
return redirect(Route('progetti'));
|
||||
}
|
||||
|
||||
public function stampaPDFProgetto(Request $id)
|
||||
{
|
||||
$progetto_id=$id['id'];
|
||||
$progetto = Progetti::getProgettoById($progetto_id);
|
||||
$righe = RigaProgetto::getRigheProgetto($progetto_id);
|
||||
$costo_tot=RigaProgetto::getCostoRighe($progetto_id);
|
||||
$pdf=Pdf::loadview('progetti.PDF.scheda',['dettaglio'=>$progetto,'righe'=>$righe, 'tot'=>$costo_tot]);
|
||||
return $pdf->stream();
|
||||
}
|
||||
|
||||
public function documentoProgetto(Request $request)
|
||||
{
|
||||
$documenti = GenDoc::listDocument(3,$request->input('entity_id'));
|
||||
|
||||
return view('conti.documenti.insert', [
|
||||
'id'=>$request->input('entity_id'),
|
||||
'entity'=>$request->input('entity'),
|
||||
'documenti'=>$documenti
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function modificaProgetto(Request $data)
|
||||
{
|
||||
// funzione di modifica del progetto (form inserimento modificato in js)
|
||||
Progetti::where('id', $data['id'])
|
||||
->update([
|
||||
'nome' => $data['nome'],
|
||||
'descrizione' => $data['descrizione'],
|
||||
//'data_creazione'=>$data['data_creazione'],
|
||||
'data_inizio'=>$data['data_inizio'],
|
||||
'data_fine'=>$data['data_fine'],
|
||||
'fk_user'=>$data['coordinatore'],
|
||||
'budget'=>$data['budget'],
|
||||
'stato'=>$data['stato'],
|
||||
'note' =>$data['note'],
|
||||
]);
|
||||
return redirect()->back();
|
||||
/* dd($data);*/
|
||||
}
|
||||
|
||||
public function getProgettobyId(Request $id)
|
||||
{
|
||||
return json_encode(Progetti::getProgettoById($id['id']));
|
||||
}
|
||||
|
||||
}
|
44
app/Http/Controllers/RigaProgettoController.php
Normal file
44
app/Http/Controllers/RigaProgettoController.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\RigaProgetto;
|
||||
|
||||
class RigaProgettoController extends Controller
|
||||
{
|
||||
//
|
||||
public function deleterow($id_row,$id)
|
||||
{
|
||||
$id_riga = $id_row;
|
||||
//$id_progetto = $id_prog;
|
||||
|
||||
RigaProgetto::deleteRow($id_riga);
|
||||
// Ritorna alla pagina dei dettagli del progetto
|
||||
return redirect('/admin/progetti/detail/'.$id);
|
||||
}
|
||||
|
||||
public function editRiga($id)
|
||||
{
|
||||
// modifica della riga inserita
|
||||
//return redirect('/admin/progetti/editDetail');
|
||||
$data=RigaProgetto::getRigaById($id);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function updateRiga(Request $data)
|
||||
{
|
||||
$id=$data['fk_id_progetto'];
|
||||
RigaProgetto::updateRiga($data);
|
||||
// $id_progetto=$data['fk_id_progetto'];
|
||||
return redirect('/admin/progetti/detail/'.$id);
|
||||
}
|
||||
|
||||
public function inserisciRiga(Request $args,$id)
|
||||
{
|
||||
|
||||
RigaProgetto::saveRiga($args,$id);
|
||||
return redirect('/admin/progetti/detail/'.$id);
|
||||
}
|
||||
|
||||
}
|
10
app/Http/Controllers/RivistaController.php
Normal file
10
app/Http/Controllers/RivistaController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RivistaController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
56
app/Http/Controllers/TagController.php
Normal file
56
app/Http/Controllers/TagController.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\tag;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
public static function listTags(){
|
||||
$tags = tag::getList();
|
||||
return view('conti.tags.list',['tags'=>$tags]);
|
||||
}
|
||||
|
||||
public static function insTags(Request $request)
|
||||
{
|
||||
$validated=$request->validate([
|
||||
'tag_name' => 'required',
|
||||
]);
|
||||
tag::inserisci($request);
|
||||
$tags = tag::getList();
|
||||
return view('conti.tags.list',['tags'=>$tags]);
|
||||
}
|
||||
|
||||
public function calendartest()
|
||||
{
|
||||
return view('components.calendar');
|
||||
}
|
||||
|
||||
public function updateTag($id)
|
||||
{
|
||||
$tags=tag::getById($id);
|
||||
return json_encode($tags);
|
||||
}
|
||||
|
||||
public function updatePostTag(Request $request)
|
||||
{
|
||||
$validated=$request->validate([
|
||||
'cat_name' => 'required',
|
||||
]);
|
||||
tag::updateById($request);
|
||||
return redirect(route('tags'));
|
||||
}
|
||||
|
||||
public function apiList()
|
||||
{
|
||||
$tags=tag::all();
|
||||
return json_encode($tags);
|
||||
}
|
||||
|
||||
public function deleteTag($id){
|
||||
tag::deleteTag($id);
|
||||
return redirect(route('tags'));
|
||||
}
|
||||
}
|
40
app/Http/Controllers/TaskController.php
Normal file
40
app/Http/Controllers/TaskController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Task;
|
||||
|
||||
class TaskController extends Controller
|
||||
{
|
||||
//
|
||||
public function listTask()
|
||||
{
|
||||
return Task::where('termine_il','>=', now())->get();
|
||||
// debug
|
||||
// return get_class_methods($this);
|
||||
}
|
||||
|
||||
public function Task()
|
||||
{
|
||||
return view('tasks.list',['tasks'=>$this->listTask()]);
|
||||
}
|
||||
|
||||
public function newTask(Request $data)
|
||||
{
|
||||
Task::create([
|
||||
'titolo'=>$data['titolo'],
|
||||
'descrizione'=>$data['descrizione'],
|
||||
'assegnato_a'=>$data['assegnato_a'],
|
||||
'creato_da'=>$data['creato_da'],
|
||||
'termine_il'=>$data['termine_il'],
|
||||
'creato_il'=>$data['creato_il'],
|
||||
'chiuso_il'=>$data['chiuso_il'],
|
||||
'stato'=>$data['stato'],
|
||||
]);
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
65
app/Http/Controllers/TodolistController.php
Normal file
65
app/Http/Controllers/TodolistController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Todolist;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TodolistController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Todolist $todolist)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Todolist $todolist)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Todolist $todolist)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Todolist $todolist)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
144
app/Http/Controllers/Utenti.php
Normal file
144
app/Http/Controllers/Utenti.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
// use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
// use Junges\ACL\Models\Group;
|
||||
// use Junges\ACL\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use App\Models\User;
|
||||
|
||||
class Utenti extends Controller
|
||||
{
|
||||
|
||||
public function createRole($ruolo)
|
||||
{
|
||||
$role=Role::create(['name'=>$ruolo]);
|
||||
return json_encode(Role::all()->pluck('name'));
|
||||
}
|
||||
|
||||
function createPermission($permesso){
|
||||
$permission=Permission::create(['name'=>$permesso]);
|
||||
return json_encode(Permission::all()->pluck('name'));
|
||||
}
|
||||
|
||||
function userClass() {
|
||||
$user=new User();
|
||||
return get_class_methods($user);
|
||||
}
|
||||
|
||||
// post del create user
|
||||
function createUser(Request $params){
|
||||
User::addUser($params);
|
||||
return redirect('/admin/users/new');
|
||||
}
|
||||
|
||||
// mostra il form della creazione dell'utente
|
||||
function addUser(){
|
||||
$roles = Role::all();
|
||||
$users = User::all();
|
||||
return view('users.create',['ruoli'=>$roles,'users'=>$users]);
|
||||
}
|
||||
|
||||
function listUser(){
|
||||
$users = User::all();
|
||||
return view('users.list',['users'=>$users]);
|
||||
}
|
||||
|
||||
function getUsers(){
|
||||
return User::getUsers();
|
||||
}
|
||||
|
||||
function listRoles(){
|
||||
$roles = Role::all();
|
||||
return $roles;
|
||||
}
|
||||
|
||||
function deleteUser($id) {
|
||||
User::destroy($id);
|
||||
|
||||
return redirect('/admin/users/new');
|
||||
}
|
||||
|
||||
function givePermissionToUser()
|
||||
{
|
||||
$users=User::all();
|
||||
$permissions=Permission::all();
|
||||
return view('users.assignperm',['users'=>$users,'permissions'=>$permissions]);
|
||||
}
|
||||
|
||||
function assignPermission(Request $request)
|
||||
{
|
||||
//$user=User::getUserbyId($request['user']);
|
||||
$user=User::findOrFail($request['user']);
|
||||
foreach($request['permesso'] as $key => $value){
|
||||
if($value=='true')
|
||||
{
|
||||
$key=str_replace('\'','',$key);
|
||||
$user->givePermissionTo($key);
|
||||
// $permission['allowed'][]=$key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$key=str_replace('\'','',$key);
|
||||
$user->revokePermissionTo($key);
|
||||
// $permission['denied'][]=$key;
|
||||
}
|
||||
|
||||
}
|
||||
return redirect('/admin/users/givepermission');
|
||||
}
|
||||
|
||||
function giveRoleToUser()
|
||||
{
|
||||
$users=User::all();
|
||||
$roles=Role::all();
|
||||
return view('users.assignrole',['users'=>$users,'roles'=>$roles]);
|
||||
}
|
||||
|
||||
function assignRole(Request $request)
|
||||
{
|
||||
//$user=User::getUserbyId($request['user']);
|
||||
$user=User::findOrFail($request['user']);
|
||||
$user->assignRole($request['role']);
|
||||
return redirect('/admin/users/giverole');
|
||||
}
|
||||
|
||||
public function changePassword(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$request->validate([
|
||||
'current_password' => 'required|string|min:5',
|
||||
'new_password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
if (Hash::check($request->current_password, $user->password))
|
||||
{
|
||||
$user->password = Hash::make($request->new_password);
|
||||
$user->save();
|
||||
return redirect()->route('changePassword')->with('success','Password changed successfully!');
|
||||
} else {
|
||||
return redirect()->back()->withErrors(['current_password' => 'Current password does not match']);
|
||||
}
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
// Crea un token unico di accesso per l'utente
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|string|min:3',
|
||||
]);
|
||||
$user=User::where('email',$request->email)->first();
|
||||
if(!$user || !Hash::check($request->password, $user->password)){
|
||||
return response()->json(['error'=>'The provided credentials are incorrect.'], 401);
|
||||
}
|
||||
$token=$user->createToken($user->name.'_Api-AuthToken')->plainTextToken;
|
||||
return response()->json(['token'=>$token]);
|
||||
|
||||
}
|
||||
}
|
||||
|
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'/api/login',
|
||||
];
|
||||
}
|
24
app/Models/Accessori.php
Normal file
24
app/Models/Accessori.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Accessori extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function saveAccessori($id,$data)
|
||||
{
|
||||
DB::table('accessoris')->insert([
|
||||
'fk_operazione_id'=>$id,
|
||||
'descrizione'=>$data['descrizione'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getElementsbyOperazione($data) {
|
||||
return DB::table('accessoris')->where('fk_operazione_id','=',$data)->get();
|
||||
}
|
||||
}
|
11
app/Models/Associazione.php
Normal file
11
app/Models/Associazione.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Associazione extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
81
app/Models/Auto.php
Normal file
81
app/Models/Auto.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class Auto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getAutoById($id)
|
||||
{
|
||||
return $dettagli=DB::table('autos')->find($id);
|
||||
}
|
||||
|
||||
public static function getAutoList()
|
||||
{
|
||||
// return $lista=DB::table('autos')->select(['targa','marca','modello','id'])->get();
|
||||
return $lista = Auto::all();
|
||||
}
|
||||
|
||||
public static function saveAuto($request)
|
||||
{
|
||||
// TODO: inserire validazione post
|
||||
|
||||
$request->validate([
|
||||
'targa' => 'required|unique:posts|max:7',
|
||||
'marca' => 'required',
|
||||
'modello' => 'required',
|
||||
'cilindrata' => 'requierd',
|
||||
]);
|
||||
|
||||
try {
|
||||
DB::table('autos')->insert([
|
||||
'targa'=>$request['targa'],
|
||||
'marca'=>$request['marca'],
|
||||
'modello'=>$request['modello'],
|
||||
'cilindrata'=>$request['cilindrata'],
|
||||
'cvfiscali'=>$request['cvfiscali'],
|
||||
'alimentazione'=>$request['alimentazione'],
|
||||
'ntelaio'=>$request['ntelaio'],
|
||||
'nmotore'=>$request['nmotore'],
|
||||
'data_acquisto'=>$request['data_acquisto'],
|
||||
'note'=>$request['note'],
|
||||
]);
|
||||
Session::flash('success', 'Auto saved successfully.');
|
||||
} catch (\Exception $e) {
|
||||
Session::flash('error', 'Failed to save auto: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static function delAuto($id)
|
||||
{
|
||||
DB::table('autos')->delete($id['id']);
|
||||
}
|
||||
|
||||
public static function updateAuto($data)
|
||||
{
|
||||
try {
|
||||
DB::table('autos')->where('id','=',$data['id'])->update([
|
||||
'targa'=>$data['targa'],
|
||||
'marca'=>$data['marca'],
|
||||
'modello'=>$data['modello'],
|
||||
'cilindrata'=>$data['cilindrata'],
|
||||
'cvfiscali'=>$data['cvfiscali'],
|
||||
'alimentazione'=>$data['alimentazione'],
|
||||
'ntelaio'=>$data['ntelaio'],
|
||||
'nmotore'=>$data['nmotore'],
|
||||
'data_acquisto'=>$data['data_acquisto'],
|
||||
'note'=>$data['note'],
|
||||
|
||||
]);
|
||||
Session::flash('success', 'Auto updated successfully.');
|
||||
} catch (\Exception $e) {
|
||||
Session::flash('error', 'Failed to update auto: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
55
app/Models/Avviso.php
Normal file
55
app/Models/Avviso.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Avviso extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['avviso','creato_il', 'creato_da', 'urgente'];
|
||||
|
||||
public static function newAvviso($data)
|
||||
{
|
||||
self::create([
|
||||
'avviso'=>$data['avviso'],
|
||||
'creato_da'=>$data['creato_da'],
|
||||
'creato_il'=>date('Y-m-d'),
|
||||
'urgente'=>$data['urgente'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getAvvisi()
|
||||
{
|
||||
return self::all();
|
||||
}
|
||||
|
||||
public static function getActualAvvisi()
|
||||
{
|
||||
return self::where('creato_il','>=', now()->subMonth())->get();
|
||||
}
|
||||
|
||||
public static function getHAstatus()
|
||||
{
|
||||
/*$response = Http::withHeaders([
|
||||
'Authorization'=>' Bearer '.env('HA_TOKEN'),
|
||||
'Content-Type'=>' application/json',
|
||||
])->get('https://ha.lavorain.cloud/api/services',['domain']);
|
||||
return $response;
|
||||
// return dd($response);*/
|
||||
}
|
||||
|
||||
public static function getAnsaNews()
|
||||
{
|
||||
/*$xmlstring = Http::get('https://www.ansa.it/trentino/notizie/trentino_rss.xml');
|
||||
$xml_file = simplexml_load_string($xmlstring);
|
||||
$json = json_encode($xml_file );
|
||||
$array = json_decode($json,TRUE);
|
||||
dd($array); // return $array;*/
|
||||
|
||||
|
||||
}
|
||||
}
|
109
app/Models/Categorie.php
Normal file
109
app/Models/Categorie.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Categorie extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['cat_name'];
|
||||
|
||||
public function movimenti()
|
||||
{
|
||||
return $this->hasMany(Movimenti::class);
|
||||
}
|
||||
|
||||
public static function getIdCategoriaByName($name)
|
||||
{
|
||||
return DB::table('categories')->where('cat_name',$name)->get('id');
|
||||
}
|
||||
|
||||
public static function list()
|
||||
{
|
||||
return self::all();
|
||||
}
|
||||
public static function listCategorieAPI()
|
||||
{
|
||||
return self::orderBy('cat_name')->get();
|
||||
}
|
||||
public static function listSpesa()
|
||||
{
|
||||
return DB::table('categories')->where('cat_uscita','=',1)->orderBy('cat_name')->get();
|
||||
}
|
||||
|
||||
public static function listEntrata()
|
||||
{
|
||||
return DB::table('categories')->where('cat_entrata','=',1)->orderBy('cat_name')->get();
|
||||
}
|
||||
|
||||
public static function inserisci($request){
|
||||
if ($request['cat_entrata']==='on')
|
||||
{
|
||||
$entrata=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$entrata=0;
|
||||
}
|
||||
|
||||
if ($request['cat_uscita']==='on')
|
||||
{
|
||||
$uscita=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$uscita=0;
|
||||
}
|
||||
|
||||
return DB::table('categories')->insert([
|
||||
'cat_name'=> $request['cat_name'],
|
||||
'cat_entrata'=>$entrata,
|
||||
'cat_uscita'=>$uscita
|
||||
]);
|
||||
}
|
||||
|
||||
public static function deleteById($id){
|
||||
DB::table('categories')
|
||||
->where('id','=', $id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
public static function getById($id) {
|
||||
return DB::table('categories')
|
||||
->where('categories.id','=',$id)
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function updateNameById($request) {
|
||||
if ($request['cat_entrata']==='on')
|
||||
{
|
||||
$entrata=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$entrata=0;
|
||||
}
|
||||
|
||||
if ($request['cat_uscita']==='on')
|
||||
{
|
||||
$uscita=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$uscita=0;
|
||||
}
|
||||
|
||||
DB::table('categories')
|
||||
->where('id','=', $request['id'])
|
||||
->update([
|
||||
'cat_name' => $request['cat_name'],
|
||||
'cat_entrata' => $entrata,
|
||||
'cat_uscita'=>$uscita,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
74
app/Models/CentralTenant.php
Normal file
74
app/Models/CentralTenant.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use ZipArchive;
|
||||
|
||||
class CentralTenant extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
public static function listTenants()
|
||||
{
|
||||
return Tenant::all();
|
||||
}
|
||||
|
||||
public static function getTenant($id)
|
||||
{
|
||||
return Tenant::where('id', $id)->get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function backupTenant($tenantId) {
|
||||
// 1. Identificazione del tenant
|
||||
$tenant = Tenant::find($tenantId);
|
||||
if (!$tenant) {
|
||||
return 'Tenant non trovato.';
|
||||
}
|
||||
|
||||
// 2. Switch al tenant
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
// 3. Generazione del nome del file zip
|
||||
$fileName = $tenantId . '_' . date('YmdHms') . '.zip';
|
||||
$zipPath = storage_path('app/' . $fileName);
|
||||
|
||||
// 4. Creazione dell'archivio zip
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
|
||||
return 'Impossibile creare l\'archivio zip.';
|
||||
}
|
||||
|
||||
// 5. Dump del database
|
||||
$databaseName = config('database.connections.tenant.database'); // Assumi 'tenant' come connessione per i tenant
|
||||
$dumpFile = storage_path('app/temp_dump.sql');
|
||||
$command = "mysqldump -u " . config('database.connections.tenant.username') . " -p" . config('database.connections.tenant.password') . " " . $databaseName . " > " . $dumpFile;
|
||||
exec($command);
|
||||
$zip->addFile($dumpFile, 'database.sql');
|
||||
|
||||
// 6. Aggiunta della cartella storage
|
||||
//$storagePath = storage_path('app/tenant/' .$tenantId); // Assumi una struttura di storage separata per tenant
|
||||
$storagePath = storage_path();
|
||||
$files = \File::allFiles($storagePath);
|
||||
foreach ($files as $file) {
|
||||
$relativePath = str_replace($storagePath . '/', '', $file->getPathname());
|
||||
$zip->addFile($file->getPathname(), 'storage/' . $relativePath);
|
||||
}
|
||||
|
||||
// 7. Chiusura dell'archivio zip
|
||||
$zip->close();
|
||||
|
||||
// 8. Download del file
|
||||
// dd($zipPath);
|
||||
return response()->download($zipPath, $fileName, [
|
||||
'Content-Type' => 'application/zip',
|
||||
'Content-Disposition' => 'attachment; filename="' . $fileName . '"',
|
||||
])->deleteFileAfterSend(true); // Cancella il file dopo il download
|
||||
}
|
||||
}
|
30
app/Models/Conto.php
Normal file
30
app/Models/Conto.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Conto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'nomeConto',
|
||||
'Banca',
|
||||
'IBAN',
|
||||
'saldo_iniziale',
|
||||
'note',
|
||||
];
|
||||
|
||||
public function movimenti()
|
||||
{
|
||||
return $this->hasMany(Movimenti::class);
|
||||
}
|
||||
|
||||
public function saldo()
|
||||
{
|
||||
return $this->saldo_iniziale + $this->movimenti()->sum('importo');
|
||||
}
|
||||
}
|
||||
// Compare this snippet from app/Models/Movimenti.php:
|
43
app/Models/Contratti.php
Normal file
43
app/Models/Contratti.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class Contratti extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=[
|
||||
'numero',
|
||||
'nome',
|
||||
'datainizio',
|
||||
'datatermine',
|
||||
'fornitore',
|
||||
'tipo',
|
||||
'importo',
|
||||
'scadenzapagamento',
|
||||
'stato',
|
||||
'note',
|
||||
'filename'
|
||||
];
|
||||
|
||||
|
||||
public static function storeContratto(Request $req){
|
||||
/* dd($req); */
|
||||
|
||||
}
|
||||
|
||||
public static function getAllContratto(){
|
||||
return self::all();
|
||||
}
|
||||
|
||||
public static function getContrattoById($id){
|
||||
return DB::table('contrattis')->where('id','=',$id)->get();
|
||||
}
|
||||
|
||||
}
|
74
app/Models/Documenti.php
Normal file
74
app/Models/Documenti.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Documenti extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'descrizione',
|
||||
'path',
|
||||
];
|
||||
|
||||
public static function countDocument($id){
|
||||
$quanti=DB::table('documentis')
|
||||
->where('movimenti_id','=',$id)
|
||||
->count();
|
||||
return $quanti;
|
||||
}
|
||||
|
||||
// Proposta modifica {issue #5} gitea (generalizzazione del documento)
|
||||
/*
|
||||
public static function countDocument($id,$entity)
|
||||
{
|
||||
return self::where('entita','=',$entity)->where('entita_id','=',$id)->count();
|
||||
}
|
||||
*/
|
||||
|
||||
public static function store($req) {
|
||||
// $movimento_id=$req->input('id');
|
||||
// $filename=$req->file('filename')->store('Documenti');
|
||||
DB::table('documentis')
|
||||
->insert([
|
||||
// 'movimenti_id'=>$movimento_id,
|
||||
'descrizione'=>$req->input('descrizione'),
|
||||
'path'=>$req->input('path'),
|
||||
// 'filename'=>$filename,
|
||||
]);
|
||||
}
|
||||
|
||||
// Proposta modifica {issue #5} gitea (generalizzazione del documento)
|
||||
/*
|
||||
public static function store($req) {
|
||||
$movimento_id=$req->input('id');
|
||||
$filename=$req->file('filename')->store('Documenti');
|
||||
self::create([
|
||||
'entità'=>$req['entita'], // aggiunto per determinare il tipo di entità a cui si riferisce il documento
|
||||
'entita_id'=>$req['entita_id'], // aggiunto per identificare il record al quale associare il documento (al posto di id_movimento)
|
||||
'descrizione'=>$req['descrizione'],
|
||||
'filename'=>$filename
|
||||
]);
|
||||
}
|
||||
*/
|
||||
|
||||
public static function getList($id)
|
||||
{
|
||||
return DB::table('documentis')
|
||||
->where('movimenti_id','=', $id)
|
||||
->get();
|
||||
}
|
||||
|
||||
// Proposta modifica issue {#5 gitea} (generalizzazione del documento)
|
||||
/*
|
||||
public static function getList($id,$entity)
|
||||
{
|
||||
self::where('entita','=',$entity)->where('entita_id','=',$id)->get();
|
||||
}
|
||||
*/
|
||||
}
|
27
app/Models/Event.php
Normal file
27
app/Models/Event.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
|
||||
class Event extends Model
|
||||
|
||||
{
|
||||
|
||||
use HasFactory;
|
||||
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'title','description', 'start', 'end'
|
||||
];
|
||||
|
||||
}
|
61
app/Models/GenDoc.php
Normal file
61
app/Models/GenDoc.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\Documenti;
|
||||
|
||||
class GenDoc extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// DocumentiGenerali
|
||||
|
||||
public static function saveDocument($data){
|
||||
|
||||
$filename=$data->file('filename')->store(self::getEntityFolder($data['entity']));
|
||||
DB::table('gen_docs')
|
||||
->insert([
|
||||
'entity'=>$data['entity'],
|
||||
'entity_id'=>($data['entity_id'] ?? 0 ),
|
||||
'descrizione'=>$data['descrizione'],
|
||||
'filename'=>$filename,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function listDocument($entity,$entity_id = 0)
|
||||
{
|
||||
// Ritorna la lista dei documenti in base all'entità e al rispettivo id
|
||||
return DB::table('gen_docs')->where('entity','=',$entity)->where('entity_id','=',$entity_id)->get(); //nuova funzione
|
||||
// return DB::table('documentis')->where('movimenti_id','=', $entity_id)->get();
|
||||
}
|
||||
|
||||
public static function countDocument($entity,$entity_id = 0){
|
||||
// Conta i documenti inseriti per la determinata entità e id
|
||||
$quanti=DB::table('gen_docs')
|
||||
->where('entity','=',$entity)
|
||||
->where('entity_id','=',$entity_id)
|
||||
->count();
|
||||
return $quanti;
|
||||
}
|
||||
|
||||
private static function getEntityFolder($id)
|
||||
{
|
||||
// Recupera il percorso ('path') dell'entità con l'ID specificato dalla tabella 'Documenti'
|
||||
$entita = Documenti::where('id',$id)->pluck('path');
|
||||
// Restituisce il primo elemento del risultato, che dovrebbe essere il percorso dell'entità
|
||||
return $entita[0];
|
||||
|
||||
}
|
||||
|
||||
public static function delDocument($id){
|
||||
$deleted = GenDoc::where('id',$id)->get();
|
||||
Storage::delete($deleted[0]->filename);
|
||||
$removed = GenDoc::destroy($id);
|
||||
//$removed->detete();
|
||||
return 0;
|
||||
}
|
||||
}
|
11
app/Models/Gruppi.php
Normal file
11
app/Models/Gruppi.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Gruppi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
26
app/Models/HomeAssistantAPI.php
Normal file
26
app/Models/HomeAssistantAPI.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class HomeAssistantAPI extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getSensorState($sensor)
|
||||
{
|
||||
$result=Http::withHeaders(
|
||||
[
|
||||
'Authorization'=>'Bearer '.env('HA_TOKEN'),
|
||||
'Content-Type'=>'application/json',
|
||||
]
|
||||
)->get('https://ha.lavorain.cloud/api/states/'.$sensor);
|
||||
|
||||
return json_decode($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
11
app/Models/ImportRule.php
Normal file
11
app/Models/ImportRule.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ImportRule extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
24
app/Models/Manutenzione.php
Normal file
24
app/Models/Manutenzione.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Manutenzione extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function saveManutenzione($id,$data)
|
||||
{
|
||||
DB::table('manutenziones')->insert([
|
||||
'fk_operazione_id'=>$id,
|
||||
'descrizione'=>$data['descrizione'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getElementsbyOperazione($data) {
|
||||
return DB::table('manutenziones')->where('fk_operazione_id','=',$data)->get();
|
||||
}
|
||||
}
|
398
app/Models/Movimenti.php
Normal file
398
app/Models/Movimenti.php
Normal file
@ -0,0 +1,398 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Rap2hpoutre\FastExcel\FastExcel;
|
||||
use App\Models\Categorie;
|
||||
use App\Models\Conto;
|
||||
use App\Models\User;
|
||||
|
||||
class Movimenti extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $dates = ['mov_data'];
|
||||
protected $casts = [ 'mov_data'=>'datetime'];
|
||||
|
||||
public static $query= 'SELECT
|
||||
a.id,
|
||||
a.mov_data,
|
||||
a.mov_importo,
|
||||
a.mov_descrizione,
|
||||
c.cat_name,
|
||||
t.tag_name,
|
||||
(SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti
|
||||
FROM movimentis as a
|
||||
JOIN tags as t ON a.mov_fk_tags=t.id
|
||||
JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||
|
||||
public function Conto()
|
||||
{
|
||||
return $this->belongsTo(Conto::class);
|
||||
}
|
||||
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function Categorie()
|
||||
{
|
||||
return $this->belongsTo(Categorie::class);
|
||||
}
|
||||
|
||||
public function Tags()
|
||||
{
|
||||
return $this->belongsTo(Tags::class);
|
||||
}
|
||||
|
||||
public static function getList() {
|
||||
|
||||
|
||||
$expression=DB::raw(
|
||||
'SELECT
|
||||
a.id,
|
||||
a.mov_data,
|
||||
a.mov_importo,
|
||||
a.mov_descrizione,
|
||||
c.cat_name,
|
||||
t.tag_name,
|
||||
co.nomeConto,
|
||||
(SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti
|
||||
FROM movimentis as a
|
||||
JOIN tags as t ON a.mov_fk_tags=t.id
|
||||
JOIN categories as c ON a.mov_fk_categoria=c.id
|
||||
JOIN contos as co ON a.conto_id=co.id'
|
||||
);
|
||||
|
||||
$query = $expression->getValue(DB::connection()->getQueryGrammar());
|
||||
return DB::select($query);
|
||||
}
|
||||
|
||||
public static function getSaldo($date) {
|
||||
return DB::table('movimentis')->whereYear('mov_data','=',$date)->sum('mov_importo');
|
||||
}
|
||||
|
||||
public static function getSaldoTot() {
|
||||
return DB::table('movimentis')->sum('mov_importo');
|
||||
}
|
||||
|
||||
public static function insSpesa( $request) {
|
||||
DB::table('movimentis')->insert(
|
||||
[
|
||||
'mov_data'=>$request->mov_data,
|
||||
'mov_fk_categoria'=>$request->mov_fk_categoria,
|
||||
'mov_descrizione'=>$request->mov_descrizione,
|
||||
'mov_importo'=>'-'.$request->mov_importo,
|
||||
'mov_fk_tags'=>$request->mov_fk_tags,
|
||||
'mov_inserito_da'=>$request->userid,
|
||||
'conto_id'=>$request->conto_id,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function giroconto($request){
|
||||
|
||||
$requestUscita=$request;
|
||||
$requestEntrata=$request;
|
||||
|
||||
$requestUscita['conto_id']=$requestUscita->daConto;
|
||||
$requestUscita['mov_fk_tags']=1;
|
||||
$rqUscita = $requestUscita;
|
||||
self::insSpesa($rqUscita);
|
||||
|
||||
$requestEntrata['conto_id']=$requestEntrata->aConto;
|
||||
$requestEntrata['mov_fk_tags']=1;
|
||||
$rqEntrata = $requestEntrata;
|
||||
self::insEntrata($rqEntrata);
|
||||
unset($requestUscita['daConto']);
|
||||
unset($requestEntrata['aConto']);
|
||||
|
||||
}
|
||||
|
||||
public static function insEntrata( $request) {
|
||||
DB::table('movimentis')->insert(
|
||||
[
|
||||
'mov_data'=>$request['mov_data'],
|
||||
'mov_fk_categoria'=>$request['mov_fk_categoria'],
|
||||
'mov_descrizione'=>$request['mov_descrizione'],
|
||||
'mov_importo'=>$request['mov_importo'],
|
||||
'mov_fk_tags'=>$request['mov_fk_tags'],
|
||||
'mov_inserito_da'=>$request['userid'],
|
||||
'conto_id'=>$request->conto_id,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function export() {
|
||||
return DB::table('movimentis')
|
||||
->join('categories','movimentis.mov_fk_categoria','=','categories.id')
|
||||
->join('tags','movimentis.mov_fk_tags','=','tags.id')
|
||||
->join('contos','movimentis.conto_id','=','contos.id')
|
||||
->selectRaw('mov_data AS Data,cat_name AS Categoria,tag_name AS Tag,NomeConto AS Conto, mov_descrizione AS Descrizione,mov_importo AS Importo')
|
||||
->orderBy('Data','asc')
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function reportSpesa($year,$month) {
|
||||
return DB::table('movimentis')
|
||||
->selectRaw('ABS(Sum(movimentis.mov_importo)) as resoconto, categories.cat_name,categories.id')
|
||||
->join('categories','movimentis.mov_fk_categoria','=','categories.id')
|
||||
->where('mov_importo','<',0)
|
||||
->whereYear('mov_data',$year)
|
||||
->whereMonth('mov_data',$month)
|
||||
->groupBy('cat_name','categories.id')
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function reportEntrate($year,$month) {
|
||||
return DB::table('movimentis')
|
||||
->selectRaw('ABS(Sum(movimentis.mov_importo)) as resoconto, categories.cat_name,categories.id')
|
||||
->join('categories','movimentis.mov_fk_categoria','=','categories.id')
|
||||
->where('mov_importo','>',0)
|
||||
->whereYear('mov_data',$year)
|
||||
->whereMonth('mov_data',$month)
|
||||
->groupBy('cat_name','categories.id')
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function getMovimentoById($id) {
|
||||
return DB::table('movimentis')
|
||||
->join('categories','movimentis.mov_fk_categoria','=','categories.id')
|
||||
->join('tags','movimentis.mov_fk_tags','=','tags.id')
|
||||
->where('movimentis.id','=',$id)
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function updateMovimenti($request) {
|
||||
DB::table('movimentis')
|
||||
->where('id','=', $request['id'])
|
||||
->update([
|
||||
'mov_data' => $request['mov_data'],
|
||||
'mov_fk_categoria'=>$request['mov_fk_categoria'],
|
||||
'mov_descrizione'=>$request['mov_descrizione'],
|
||||
'mov_importo'=>$request['mov_importo'],
|
||||
'mov_fk_tags'=>$request['mov_fk_tags'],
|
||||
'mov_inserito_da'=>$request['userid'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function deleteMovimento($id) {
|
||||
DB::table('movimentis')
|
||||
->where('id','=', $id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
public static function listByCatMonth($month,$cat,$year) {
|
||||
|
||||
$expression= DB::raw('SELECT
|
||||
a.id,
|
||||
a.mov_data,
|
||||
a.mov_importo,
|
||||
a.mov_descrizione,
|
||||
c.cat_name,
|
||||
t.tag_name,
|
||||
(SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti
|
||||
FROM movimentis as a
|
||||
JOIN tags as t ON a.mov_fk_tags=t.id
|
||||
JOIN categories as c ON a.mov_fk_categoria=c.id
|
||||
WHERE Month(a.mov_data)='.$month.' AND Year(a.mov_data)='.$year.' AND a.mov_fk_categoria='.$cat
|
||||
);
|
||||
$query = $expression->getValue(DB::connection()->getQueryGrammar());
|
||||
return DB::select($query);
|
||||
|
||||
}
|
||||
|
||||
public static function listByCategory($cat) {
|
||||
|
||||
$expression=DB::raw(' SELECT a.id,
|
||||
a.mov_data,
|
||||
a.mov_importo,
|
||||
a.mov_descrizione,
|
||||
c.cat_name,
|
||||
t.tag_name,
|
||||
(SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti
|
||||
FROM movimentis as a
|
||||
JOIN tags as t ON a.mov_fk_tags=t.id
|
||||
JOIN categories as c ON a.mov_fk_categoria=c.id
|
||||
WHERE a.mov_fk_categoria = '.$cat );
|
||||
|
||||
$query = $expression->getValue(DB::connection()->getQueryGrammar());
|
||||
return DB::select($query);
|
||||
|
||||
}
|
||||
|
||||
public static function getByTag($tag) {
|
||||
$expression=DB::raw('SELECT
|
||||
a.id,
|
||||
a.mov_data,
|
||||
a.mov_importo,
|
||||
a.mov_descrizione,
|
||||
c.cat_name,
|
||||
t.tag_name,
|
||||
(SELECT Count(entity_id) as quanti FROM gen_docs WHERE entity=0 AND entity_id = a.id) as quanti
|
||||
FROM movimentis as a
|
||||
JOIN tags as t ON a.mov_fk_tags=t.id
|
||||
JOIN categories as c ON a.mov_fk_categoria=c.id
|
||||
WHERE a.mov_fk_tags = '.$tag );
|
||||
$query = $expression->getValue(DB::connection()->getQueryGrammar());
|
||||
return DB::select($query);
|
||||
}
|
||||
|
||||
public static function importEstrattoIng($filename)
|
||||
{
|
||||
|
||||
$inputPath='/var/www/html/gestionale_mt/public/storage/tenant'.tenant('id').'/'.$filename;
|
||||
// $outputPath='/var/www/html/gestionale_mt/public/tenant'.tenant('id').'/import/'.$filename.'.csv';
|
||||
$outputPath = $inputPath.'.csv';
|
||||
rename($inputPath,$outputPath);
|
||||
$collection = (new FastExcel)->configureCsv(";")->import($outputPath, function ($line){
|
||||
if($line['DATA VALUTA'])
|
||||
{
|
||||
if($line['ENTRATE']!=null)
|
||||
{
|
||||
$importo = $line['ENTRATE'];
|
||||
} elseif($line['USCITE']!=null)
|
||||
{
|
||||
$importo = $line['USCITE'];
|
||||
}
|
||||
$euro=str_replace(',','.',str_replace('+','',str_replace('.','', $importo)));
|
||||
list($giorno,$mese,$anno) = explode('/',$line['DATA VALUTA']);
|
||||
$data="$anno-$mese-$giorno";
|
||||
self::insEntrata([
|
||||
'mov_data'=>self::dateFormat(0,$line['DATA VALUTA']),
|
||||
'mov_fk_categoria'=>1,
|
||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||
'mov_importo'=>$euro,
|
||||
'mov_fk_tags'=>1,
|
||||
'userid'=>1,
|
||||
]);
|
||||
}
|
||||
});
|
||||
unlink($outputPath);
|
||||
|
||||
}
|
||||
|
||||
public static function importEstrattoCR($filename)
|
||||
{
|
||||
$inputPath='/var/www/html/gestionale_mt/public/storage/tenant'.tenant('id').'/'.$filename;
|
||||
// $outputPath='/var/www/html/gestionale_mt/public/'.tenant('id')."/app/".$filename;
|
||||
$outputPath = $inputPath.'.csv';
|
||||
rename($inputPath,$outputPath);
|
||||
|
||||
//$outputPath="/var/www/html/gestionale_mt/storage/tenant".tenant('id')."/app/".$filename;
|
||||
|
||||
$collection = (new FastExcel)->configureCsv(';')->import($outputPath, function ($line){
|
||||
if($line['VALUTA'])
|
||||
{
|
||||
if($line['DARE']<>'')
|
||||
{
|
||||
$dati=[
|
||||
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
||||
// date_format(date_create($movimento->mov_data),'d/m/Y'
|
||||
// 'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
||||
'mov_fk_categoria'=>1,
|
||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||
'mov_importo'=>'-'.trim(str_replace(',','.',(str_replace('.','',$line['DARE'])))),
|
||||
'mov_fk_tags'=>1,
|
||||
'userid'=>1,
|
||||
];
|
||||
}
|
||||
if($line['AVERE']<>'')
|
||||
{
|
||||
$dati=[
|
||||
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
||||
//'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
||||
'mov_fk_categoria'=>1,
|
||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',$line['AVERE'])))),
|
||||
'mov_fk_tags'=>1,
|
||||
'userid'=>1,
|
||||
];
|
||||
}
|
||||
self::insEntrata($dati);
|
||||
}
|
||||
});
|
||||
unlink($outputPath);
|
||||
}
|
||||
|
||||
// Test filtri categoria
|
||||
public function mapFieldByName($name)
|
||||
{
|
||||
// definisce lo schema per rigenerare il file CSV secondo standard di importazione
|
||||
$fields = Illuminate\Support\Facade\Schema::getColumnListing('movimentis')->mapFieldByName;
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
echo $column . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Test applicazione regole
|
||||
public function setCategoriaMovimento($movimento)
|
||||
{
|
||||
$rules= \App\Models\ImportRule::all();
|
||||
|
||||
foreach ($rules as $role)
|
||||
{
|
||||
if (preg_match("/$role->parola/i","$movimento->descrizione"))
|
||||
{
|
||||
$movimento->catemov_fk_categoria=$role->categoria_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$movimento->catemov_fk_categoria=1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getYearsFromMovimenti()
|
||||
{
|
||||
$anni=DB::table('movimentis')->select(DB::raw('DISTINCT YEAR(mov_data) as anno'))->get();
|
||||
// dd($anni); // for test purposes
|
||||
return $anni;
|
||||
}
|
||||
|
||||
|
||||
private static function dateFormat($type,$string)
|
||||
{
|
||||
// $string=(string)$string;
|
||||
if($type)
|
||||
{
|
||||
// $string=$string->format('Y-m-d');
|
||||
list($year,$month,$day) = explode('-',$string);
|
||||
return $day.'/'.$month.'/'.$year;
|
||||
} else {
|
||||
// $string=$string->format('d/m/Y');
|
||||
list($day,$month,$year) =explode('/',$string);
|
||||
return $year.'-'.$month.'-'.$day;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getEntrate($year)
|
||||
{
|
||||
$entrate_anno=DB::table('movimentis')
|
||||
->where('mov_importo','>',0)
|
||||
->whereYear('mov_data', '=' , $year)
|
||||
->sum('mov_importo');
|
||||
//->get();
|
||||
return $entrate_anno;
|
||||
}
|
||||
|
||||
public static function getUscite($year)
|
||||
{
|
||||
$uscite_anno=DB::table('movimentis')
|
||||
->where('mov_importo','<',0)
|
||||
->whereYear('mov_data', '=' , $year)
|
||||
->sum('mov_importo');
|
||||
//->get();
|
||||
return ($uscite_anno);
|
||||
}
|
||||
|
||||
}
|
131
app/Models/Operazione.php
Normal file
131
app/Models/Operazione.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
//use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Sfneal\ViewExport\Pdf\PdfExportService;
|
||||
|
||||
|
||||
class Operazione extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// Operazione effettuata sull'auto
|
||||
|
||||
public static function saveOperazione($data)
|
||||
{
|
||||
// inserisce nel database e ritorna l'id
|
||||
$id=DB::table('operaziones')->insertGetId(
|
||||
[
|
||||
'fk_auto_id'=>$data['auto'],
|
||||
'data'=>$data['data'],
|
||||
'km'=>$data['km'],
|
||||
'importo'=>$data['importo'],
|
||||
'type'=>$data['type']
|
||||
]
|
||||
);
|
||||
if (isset($data['inMovimenti']))
|
||||
{
|
||||
|
||||
$automobile=Auto::getAutoById($data['auto']);
|
||||
$auto=' '.$automobile->marca.' '.$automobile->modello.' '.$automobile->targa;
|
||||
$categoria=Categorie::getIdCategoriaByName('Automobili');
|
||||
$causale="Automobili: ".strtoUpper($data['type']).' ';
|
||||
|
||||
if(isset($data['descrizione']))
|
||||
{
|
||||
$causale.=$data['descrizione'].$auto;
|
||||
}
|
||||
if(isset($data['centrorevisione']))
|
||||
{
|
||||
$causale.= $data['centrorevisione'].$auto;
|
||||
}
|
||||
if(isset($data['litri']))
|
||||
{
|
||||
$causale.=$auto.' litri:'.$data['litri'].' Euro/litro:'.$data['eurolitro'];
|
||||
}
|
||||
|
||||
DB::table('movimentis')->insert([
|
||||
'mov_data'=>$data['data'],
|
||||
'mov_descrizione'=>$causale,
|
||||
'mov_importo'=>'-'.$data['importo'],
|
||||
'mov_fk_categoria'=> 1,
|
||||
'mov_inserito_da'=>1,
|
||||
'mov_fk_tags'=>1,
|
||||
|
||||
]);
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
public static function getOperazioni($autoId)
|
||||
{
|
||||
// Ritorna la lista delle operazioni effettuate sull'auto
|
||||
$automobile=Auto::getAutoById($autoId);
|
||||
$data=DB::table('operaziones')
|
||||
->where('fk_auto_id','=',$autoId)
|
||||
->orderBy('km')
|
||||
->get();
|
||||
foreach ($data as $dato)
|
||||
{
|
||||
$accessori[$dato->id]=Accessori::getElementsbyOperazione($dato->id);
|
||||
$manutenzione[$dato->id]=Manutenzione::getElementsbyOperazione($dato->id);
|
||||
$revisione[$dato->id]=Revisione::getElementsbyOperazione($dato->id);
|
||||
$rifornimento[$dato->id]=Rifornimento::getElementsbyOperazione($dato->id);
|
||||
if(isset($dato->km))
|
||||
{
|
||||
$km=$dato->km;
|
||||
}else{
|
||||
$km=0;
|
||||
}
|
||||
}
|
||||
// Debug
|
||||
/* dd($rifornimento);*/
|
||||
return view('auto.detail',[
|
||||
'dettagli'=>$automobile,
|
||||
'km'=>$km,
|
||||
|
||||
'operazione'=>$data,
|
||||
'accessori'=>$accessori,
|
||||
'manutenzione'=>$manutenzione,
|
||||
'revisione'=>$revisione,
|
||||
'rifornimento'=>$rifornimento,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function exportPdfOperazioni($autoId)
|
||||
{
|
||||
$automobile=Auto::getAutoById($autoId);
|
||||
$data=DB::table('operaziones')
|
||||
->where('fk_auto_id','=',$autoId)
|
||||
->orderBy('km')
|
||||
->get();
|
||||
foreach ($data as $dato)
|
||||
{
|
||||
$accessori[$dato->id]=Accessori::getElementsbyOperazione($dato->id);
|
||||
$manutenzione[$dato->id]=Manutenzione::getElementsbyOperazione($dato->id);
|
||||
$revisione[$dato->id]=Revisione::getElementsbyOperazione($dato->id);
|
||||
$rifornimento[$dato->id]=Rifornimento::getElementsbyOperazione($dato->id);
|
||||
if(isset($dato->km))
|
||||
{
|
||||
$km=$dato->km;
|
||||
}else{
|
||||
$km=0;
|
||||
}
|
||||
}
|
||||
$view= view('auto.detailpdf',[
|
||||
'dettagli'=>$automobile,
|
||||
'km'=>$km,
|
||||
|
||||
'operazione'=>$data,
|
||||
'accessori'=>$accessori,
|
||||
'manutenzione'=>$manutenzione,
|
||||
'revisione'=>$revisione,
|
||||
'rifornimento'=>$rifornimento,
|
||||
]);
|
||||
return $pdf=PdfExportService::fromView($view)->handle()->download();
|
||||
}
|
||||
}
|
80
app/Models/Progetti.php
Normal file
80
app/Models/Progetti.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Progetti extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getProgetti() {
|
||||
return DB::table('progettis')
|
||||
->select(
|
||||
'progettis.id as progetto',
|
||||
'users.id as userid',
|
||||
'nome',
|
||||
'name',
|
||||
'descrizione',
|
||||
'data_creazione',
|
||||
'data_fine',
|
||||
'budget',
|
||||
'stato',
|
||||
'note')
|
||||
->join('users','progettis.fk_user','=','users.id')->get();
|
||||
}
|
||||
|
||||
public static function getProgettoById($id){
|
||||
return DB::table('progettis')->
|
||||
join('users','progettis.fk_user','=','users.id')->
|
||||
select('users.id as userid', 'users.name as name', 'progettis.*')->
|
||||
where('progettis.id','=',$id)->
|
||||
get();
|
||||
}
|
||||
|
||||
public static function saveProgetto($progetto){
|
||||
DB::table('progettis')->insert([
|
||||
'nome'=>$progetto['nome'],
|
||||
'descrizione'=>$progetto['descrizione'],
|
||||
'data_creazione'=>date('Y-m-d'),
|
||||
'data_inizio'=>$progetto['data_inizio'],
|
||||
'data_fine'=>$progetto['data_fine'],
|
||||
'fk_user'=>$progetto['coordinatore'],
|
||||
'budget'=>$progetto['budget'],
|
||||
'stato'=>$progetto['stato'],
|
||||
'note'=>$progetto['note']
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function delProgetto($progetto_id)
|
||||
{
|
||||
DB::table('progettis')->delete($progetto_id);
|
||||
}
|
||||
|
||||
public static function chiudiProgetto($progetto_id)
|
||||
{
|
||||
// chiude il progetto e lo rende non cancellabile e non più editabile
|
||||
// potrà solo essere esportato in PDF
|
||||
DB::table('progettis')
|
||||
->where('id','=', $progetto_id)
|
||||
->update([
|
||||
'stato'=>'chiuso',
|
||||
'data_fine'=>date('Y-m-d'),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function riapriProgetto($progetto_id)
|
||||
{
|
||||
DB::table('progettis')
|
||||
->where('id','=', $progetto_id)
|
||||
->update([
|
||||
'stato'=>'aperto',
|
||||
'data_fine'=>null,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
27
app/Models/Revisione.php
Normal file
27
app/Models/Revisione.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Revisione extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function saveRevisione($id,$data)
|
||||
{
|
||||
DB::table('revisiones')->insert([
|
||||
'fk_operazione_id'=>$id,
|
||||
'descrizione'=>$data['descrizione'],
|
||||
'centrorevisione'=>$data['centrorevisione'],
|
||||
'superata'=>$data['superata'],
|
||||
'dataproxrevisione'=>$data['dataproxrevisione'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getElementsbyOperazione($data) {
|
||||
return DB::table('revisiones')->where('fk_operazione_id','=',$data)->get();
|
||||
}
|
||||
}
|
27
app/Models/Rifornimento.php
Normal file
27
app/Models/Rifornimento.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Rifornimento extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// Inserisce i dati di un rifornimento
|
||||
public static function saveRifornimento($id,$data)
|
||||
{
|
||||
DB::table('rifornimentos')->insert([
|
||||
'eurolitro'=>$data['eurolitro'],
|
||||
'litri'=>$data['litri'],
|
||||
'distributore'=>$data['distributore'],
|
||||
'fk_operazione_id'=>$id
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getElementsbyOperazione($data) {
|
||||
return DB::table('rifornimentos')->where('fk_operazione_id','=',$data)->get();
|
||||
}
|
||||
}
|
53
app/Models/RigaProgetto.php
Normal file
53
app/Models/RigaProgetto.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RigaProgetto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getRigheProgetto($progetto_id)
|
||||
{
|
||||
return DB::table('riga_progettos')->where('fk_id_progetto','=',$progetto_id)->orderBy('data')->get();
|
||||
}
|
||||
|
||||
public static function saveRiga($args,$id)
|
||||
{
|
||||
DB::table('riga_progettos')->insert([
|
||||
'fk_id_progetto'=>$id,
|
||||
'data'=>$args['data'],
|
||||
'descrizione'=>$args['descrizione'],
|
||||
'prezzo'=>$args['prezzo'],
|
||||
'ore'=>$args['ore'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function deleteRow($id)
|
||||
{
|
||||
DB::table('riga_progettos')->delete($id);
|
||||
}
|
||||
|
||||
public static function getCostoRighe($id)
|
||||
{
|
||||
return DB::table('riga_progettos')->select(DB::raw('SUM(prezzo) as costo'))->where('fk_id_progetto','=',$id)->get();
|
||||
}
|
||||
|
||||
public static function getRigaById($id)
|
||||
{
|
||||
return DB::table('riga_progettos')->where('id','=',$id)->get();
|
||||
}
|
||||
|
||||
public static function updateRiga($data)
|
||||
{
|
||||
DB::table('riga_progettos')->where('id','=',$data['idriga'])->update([
|
||||
'data'=>$data['data'],
|
||||
'descrizione'=>$data['descrizione'],
|
||||
'prezzo'=>$data['prezzo'],
|
||||
'ore'=>$data['ore'],
|
||||
]);
|
||||
}
|
||||
}
|
11
app/Models/Rivista.php
Normal file
11
app/Models/Rivista.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Rivista extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
50
app/Models/Task.php
Normal file
50
app/Models/Task.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Task extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable=['titolo','descrizione','creato_da','assegnato_a','creato_il','termine_il','chiuso_il','stato'];
|
||||
|
||||
public function getAllTasks()
|
||||
{
|
||||
return self::all();
|
||||
}
|
||||
|
||||
//
|
||||
public static function getTaskAssignedToUser($userid)
|
||||
{
|
||||
return self::where('assegnato_a',$userid)->where('termine_il','>=', now())->get();
|
||||
}
|
||||
|
||||
//
|
||||
public static function getTaskAssignedByUser($userid)
|
||||
{
|
||||
return self::where('creato_da',$userid)->get();
|
||||
}
|
||||
|
||||
public static function saveTask($collection)
|
||||
{
|
||||
self::create(
|
||||
[
|
||||
'titolo' => $collection['titolo'],
|
||||
'descrizione'=>$collection['descrizione'],
|
||||
'creato_da'=>$collection['creato_da'],
|
||||
'assegnato_a'=>$collection['assegnato_a'],
|
||||
'creato_il'=>date('Y-m-d'),
|
||||
'termine_il'=>$collection['termine_il'],
|
||||
'stato'=>'Aperto',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function todolist() {
|
||||
return $this->belongsTo(Todolist::class);
|
||||
}
|
||||
|
||||
}
|
19
app/Models/Todolist.php
Normal file
19
app/Models/Todolist.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Todolist extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function tasks() {
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
}
|
96
app/Models/User.php
Normal file
96
app/Models/User.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Illuminate\Foundation\Auth\Access\Authorizable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles,Authorizable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'user_role',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $guard_name = 'web';
|
||||
|
||||
public function movimenti()
|
||||
{
|
||||
return $this->hasMany(Movimenti::class);
|
||||
}
|
||||
|
||||
public function getLdapDomainColumn()
|
||||
{
|
||||
return 'domain';
|
||||
}
|
||||
|
||||
public function getLdapGuidColumn()
|
||||
{
|
||||
return 'guid';
|
||||
}
|
||||
|
||||
public static function addGroup($gruppo)
|
||||
{
|
||||
$user= new User();
|
||||
$user->assignGroup($gruppo);
|
||||
}
|
||||
|
||||
public static function getUserById($id)
|
||||
{
|
||||
return DB::table('users')->where('id','=',$id)->first();
|
||||
}
|
||||
|
||||
public static function getUsers()
|
||||
{
|
||||
return DB::table('users')->orderBy('name')->get();
|
||||
}
|
||||
|
||||
// Aggiunge un utente e assegna un ruolo
|
||||
public static function addUser($params)
|
||||
{
|
||||
self::create([
|
||||
'name'=>$params['name'],
|
||||
'email'=>$params['email'],
|
||||
'password'=>Hash::make($params['password']),
|
||||
])->assignRole($params['role']);
|
||||
|
||||
}
|
||||
|
||||
public function todolists() {
|
||||
return $this->hasMany(Todolist::class);
|
||||
}
|
||||
}
|
38
app/Models/anagrafica.php
Normal file
38
app/Models/anagrafica.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class anagrafica extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function inserisci($param) {
|
||||
DB::table('anagraficas')->insert([
|
||||
'ang_cognome'=>$param['ang_cognome'],
|
||||
'ang_nome'=>$param['ang_nome'],
|
||||
'ang_ragioneSociale'=>$param['ang_ragioneSociale'],
|
||||
'ang_codiceFiscale'=>$param['ang_codiceFiscale'],
|
||||
'ang_partitaIva'=>$param['ang_partitaIva'],
|
||||
'ang_indirizzo'=>$param['ang_indirizzo'],
|
||||
'ang_CAP'=>$param['ang_CAP'],
|
||||
'ang_Citta'=>$param['ang_Citta'],
|
||||
'ang_Provincia'=>$param['ang_Provincia'],
|
||||
'ang_telefono'=>$param['ang_telefono'],
|
||||
'ang_note'=>$param['ang_note'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getList() {
|
||||
$lista = DB::table('anagraficas')->OrderBy('ang_cognome')->get();
|
||||
return $lista;
|
||||
}
|
||||
|
||||
public static function getById($param) {
|
||||
|
||||
return DB::table('anagraficas')->where('id','=',$param)->get();
|
||||
}
|
||||
}
|
14
app/Models/condominio.php
Normal file
14
app/Models/condominio.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class condominio extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
}
|
||||
|
27
app/Models/contatoreEnEl.php
Normal file
27
app/Models/contatoreEnEl.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class contatoreEnEl extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function inserisci($data) {
|
||||
DB::table('contatore_en_els')->insert([
|
||||
'enel_date'=> $data['enel_date'],
|
||||
'enel_A'=> $data['enel_A'],
|
||||
'enel_R'=> $data['enel_R'],
|
||||
'enel_F1'=> $data['enel_F1'],
|
||||
'enel_F2'=> $data['enel_F2'],
|
||||
'enel_F3'=> $data['enel_F3'],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getList() {
|
||||
return DB::table('contatore_en_els')->orderBy('enel_date','desc')->get();
|
||||
}
|
||||
}
|
24
app/Models/contatoreGas.php
Normal file
24
app/Models/contatoreGas.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class contatoreGas extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getList()
|
||||
{
|
||||
return DB::table('contatore_gases')->orderBy('gas_date','asc')->get();
|
||||
}
|
||||
|
||||
public static function inserisci($data) {
|
||||
DB::table('contatore_gases')->insert([
|
||||
'gas_date'=> $data['gas_date'],
|
||||
'gas_lettura'=> $data['gas_lettura'],
|
||||
]);
|
||||
}
|
||||
}
|
34
app/Models/contatto.php
Normal file
34
app/Models/contatto.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class contatto extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
|
||||
public static function listContactsById($id)
|
||||
{
|
||||
$type=[1=>'Telefono',2=>'Cellulare',3=>'Fax',4=>'Email','Website'];
|
||||
$lista=DB::table('contattos')->where('cnt_fk_anagraficaId','=',$id)->get();
|
||||
return ['tipo'=>$type,'contatti'=>$lista];
|
||||
}
|
||||
|
||||
public static function saveNewContact($param) {
|
||||
DB::table('contattos')->insert([
|
||||
'cnt_tipo'=>$param['cnt_tipo'],
|
||||
'cnt_valore'=>$param['cnt_valore'],
|
||||
'cnt_note'=>$param['cnt_note'],
|
||||
'cnt_fk_anagraficaId'=>$param['cnt_fk_anagraficaId'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
48
app/Models/tag.php
Normal file
48
app/Models/tag.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class tag extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public static function getList() {
|
||||
return DB::table('tags')->orderBy('tag_name')->get();
|
||||
}
|
||||
|
||||
public static function getApiList()
|
||||
{
|
||||
return self::orderBy('tag:name')->get();
|
||||
}
|
||||
|
||||
public static function inserisci($param) {
|
||||
DB::table('tags')->insert(['tag_name'=> $param['tag_name']]);
|
||||
}
|
||||
|
||||
public static function getById($param) {
|
||||
return DB::table('tags')
|
||||
->where('tags.id','=',$param)
|
||||
->get();
|
||||
|
||||
}
|
||||
|
||||
public static function updateById($param) {
|
||||
DB::table('tags')
|
||||
->where('id','=', $param['id'])
|
||||
->update([
|
||||
'tag_name' => $param['tag_name'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function deleteTag($id)
|
||||
{
|
||||
DB::table('tags')
|
||||
//->where('id','=',$id)
|
||||
->delete($id);
|
||||
}
|
||||
}
|
24
app/Providers/AppServiceProvider.php
Normal file
24
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
161
app/Providers/TenancyServiceProvider.php
Normal file
161
app/Providers/TenancyServiceProvider.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
use Stancl\Tenancy\Events;
|
||||
use Stancl\Tenancy\Jobs;
|
||||
use Stancl\Tenancy\Listeners;
|
||||
use Stancl\Tenancy\Middleware;
|
||||
|
||||
class TenancyServiceProvider extends ServiceProvider
|
||||
{
|
||||
// By default, no namespace is used to support the callable array syntax.
|
||||
public static string $controllerNamespace = '';
|
||||
|
||||
public function events()
|
||||
{
|
||||
return [
|
||||
// Tenant events
|
||||
Events\CreatingTenant::class => [],
|
||||
Events\TenantCreated::class => [
|
||||
JobPipeline::make([
|
||||
Jobs\CreateDatabase::class,
|
||||
Jobs\MigrateDatabase::class,
|
||||
// Jobs\SeedDatabase::class,
|
||||
|
||||
// Your own jobs to prepare the tenant.
|
||||
// Provision API keys, create S3 buckets, anything you want!
|
||||
|
||||
])->send(function (Events\TenantCreated $event) {
|
||||
return $event->tenant;
|
||||
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
|
||||
],
|
||||
Events\SavingTenant::class => [],
|
||||
Events\TenantSaved::class => [],
|
||||
Events\UpdatingTenant::class => [],
|
||||
Events\TenantUpdated::class => [],
|
||||
Events\DeletingTenant::class => [],
|
||||
Events\TenantDeleted::class => [
|
||||
JobPipeline::make([
|
||||
Jobs\DeleteDatabase::class,
|
||||
])->send(function (Events\TenantDeleted $event) {
|
||||
return $event->tenant;
|
||||
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
|
||||
],
|
||||
|
||||
// Domain events
|
||||
Events\CreatingDomain::class => [],
|
||||
Events\DomainCreated::class => [],
|
||||
Events\SavingDomain::class => [],
|
||||
Events\DomainSaved::class => [],
|
||||
Events\UpdatingDomain::class => [],
|
||||
Events\DomainUpdated::class => [],
|
||||
Events\DeletingDomain::class => [],
|
||||
Events\DomainDeleted::class => [],
|
||||
|
||||
// Database events
|
||||
Events\DatabaseCreated::class => [],
|
||||
Events\DatabaseMigrated::class => [],
|
||||
Events\DatabaseSeeded::class => [],
|
||||
Events\DatabaseRolledBack::class => [],
|
||||
Events\DatabaseDeleted::class => [],
|
||||
|
||||
// Tenancy events
|
||||
Events\InitializingTenancy::class => [],
|
||||
Events\TenancyInitialized::class => [
|
||||
Listeners\BootstrapTenancy::class,
|
||||
],
|
||||
|
||||
Events\EndingTenancy::class => [],
|
||||
Events\TenancyEnded::class => [
|
||||
Listeners\RevertToCentralContext::class,
|
||||
],
|
||||
|
||||
Events\BootstrappingTenancy::class => [],
|
||||
Events\TenancyBootstrapped::class => [],
|
||||
Events\RevertingToCentralContext::class => [],
|
||||
Events\RevertedToCentralContext::class => [],
|
||||
|
||||
// Resource syncing
|
||||
Events\SyncedResourceSaved::class => [
|
||||
Listeners\UpdateSyncedResource::class,
|
||||
],
|
||||
|
||||
// Fired only when a synced resource is changed in a different DB than the origin DB (to avoid infinite loops)
|
||||
Events\SyncedResourceChangedInForeignDatabase::class => [],
|
||||
Events\TenancyBootstrapped::class => [
|
||||
function (Events\TenancyBootstrapped $event) {
|
||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache.tenant.' . $event->tenancy->tenant->getTenantKey();
|
||||
}
|
||||
],
|
||||
|
||||
Events\TenancyEnded::class => [
|
||||
function (Events\TenancyEnded $event) {
|
||||
$permissionRegistrar = app(\Spatie\Permission\PermissionRegistrar::class);
|
||||
$permissionRegistrar->cacheKey = 'spatie.permission.cache';
|
||||
}
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$this->bootEvents();
|
||||
$this->mapRoutes();
|
||||
|
||||
$this->makeTenancyMiddlewareHighestPriority();
|
||||
}
|
||||
|
||||
protected function bootEvents()
|
||||
{
|
||||
foreach ($this->events() as $event => $listeners) {
|
||||
foreach ($listeners as $listener) {
|
||||
if ($listener instanceof JobPipeline) {
|
||||
$listener = $listener->toListener();
|
||||
}
|
||||
|
||||
Event::listen($event, $listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function mapRoutes()
|
||||
{
|
||||
$this->app->booted(function () {
|
||||
if (file_exists(base_path('routes/tenant.php'))) {
|
||||
Route::namespace(static::$controllerNamespace)
|
||||
->group(base_path('routes/tenant.php'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function makeTenancyMiddlewareHighestPriority()
|
||||
{
|
||||
$tenancyMiddleware = [
|
||||
// Even higher priority than the initialization middleware
|
||||
Middleware\PreventAccessFromCentralDomains::class,
|
||||
|
||||
Middleware\InitializeTenancyByDomain::class,
|
||||
Middleware\InitializeTenancyBySubdomain::class,
|
||||
Middleware\InitializeTenancyByDomainOrSubdomain::class,
|
||||
Middleware\InitializeTenancyByPath::class,
|
||||
Middleware\InitializeTenancyByRequestData::class,
|
||||
];
|
||||
|
||||
foreach (array_reverse($tenancyMiddleware) as $middleware) {
|
||||
$this->app[\Illuminate\Contracts\Http\Kernel::class]->prependToMiddlewarePriority($middleware);
|
||||
}
|
||||
}
|
||||
}
|
18
artisan
Executable file
18
artisan
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
23
bootstrap/app.php
Normal file
23
bootstrap/app.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->alias([
|
||||
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
||||
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
|
||||
]);
|
||||
})
|
||||
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
})->create();
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
5
bootstrap/providers.php
Normal file
5
bootstrap/providers.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
];
|
82
composer.json
Normal file
82
composer.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"dompdf/dompdf": "^3.1",
|
||||
"jeroennoten/laravel-adminlte": "*",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/sail": "*",
|
||||
"laravel/sanctum": "*",
|
||||
"laravel/tinker": "^2.10.1",
|
||||
"laravel/ui": "^4.6",
|
||||
"rap2hpoutre/fast-excel": "^5.6",
|
||||
"spatie/laravel-backup": "^9.3",
|
||||
"spatie/laravel-permission": "^6.21"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.13",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
9274
composer.lock
generated
Normal file
9274
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
728
config/adminlte.php
Normal file
728
config/adminlte.php
Normal file
@ -0,0 +1,728 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Title
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can change the default title of your admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the title section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'title' => 'Gestionale',
|
||||
'title_prefix' => '',
|
||||
'title_postfix' => '',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Favicon
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can activate the favicon.
|
||||
|
|
||||
| For detailed instructions you can look the favicon section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'use_ico_only' => false,
|
||||
'use_full_favicon' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Google Fonts
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can allow or not the use of external google fonts. Disabling the
|
||||
| google fonts may be useful if your admin panel internet access is
|
||||
| restricted somehow.
|
||||
|
|
||||
| For detailed instructions you can look the google fonts section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'google_fonts' => [
|
||||
'allowed' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin Panel Logo
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can change the logo of your admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the logo section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'logo' => '<b>Gestionale</b>',
|
||||
'logo_img' => 'vendor/adminlte/dist/img/AdminLTELogo.png',
|
||||
'logo_img_class' => 'brand-image img-circle elevation-3',
|
||||
'logo_img_xl' => null,
|
||||
'logo_img_xl_class' => 'brand-image-xs',
|
||||
'logo_img_alt' => 'Admin Logo',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Logo
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can setup an alternative logo to use on your login and register
|
||||
| screens. When disabled, the admin panel logo will be used instead.
|
||||
|
|
||||
| For detailed instructions you can look the auth logo section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'auth_logo' => [
|
||||
'enabled' => false,
|
||||
'img' => [
|
||||
'path' => 'vendor/adminlte/dist/img/AdminLTELogo.png',
|
||||
'alt' => 'Auth Logo',
|
||||
'class' => '',
|
||||
'width' => 50,
|
||||
'height' => 50,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Preloader Animation
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can change the preloader animation configuration.
|
||||
|
|
||||
| For detailed instructions you can look the preloader section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'preloader' => [
|
||||
'enabled' => false,
|
||||
'img' => [
|
||||
'path' => 'vendor/adminlte/dist/img/AdminLTELogo.png',
|
||||
'alt' => 'AdminLTE Preloader Image',
|
||||
'effect' => 'animation__shake',
|
||||
'width' => 60,
|
||||
'height' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Menu
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can activate and change the user menu.
|
||||
|
|
||||
| For detailed instructions you can look the user menu section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'usermenu_enabled' => true,
|
||||
'usermenu_header' => false,
|
||||
'usermenu_header_class' => 'bg-primary',
|
||||
'usermenu_image' => false,
|
||||
'usermenu_desc' => false,
|
||||
'usermenu_profile_url' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Layout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we change the layout of your admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the layout section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Layout-and-Styling-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'layout_topnav' => null,
|
||||
'layout_boxed' => null,
|
||||
'layout_fixed_sidebar' => null,
|
||||
'layout_fixed_navbar' => null,
|
||||
'layout_fixed_footer' => null,
|
||||
'layout_dark_mode' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Views Classes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can change the look and behavior of the authentication views.
|
||||
|
|
||||
| For detailed instructions you can look the auth classes section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Layout-and-Styling-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'classes_auth_card' => 'card-outline card-primary',
|
||||
'classes_auth_header' => '',
|
||||
'classes_auth_body' => '',
|
||||
'classes_auth_footer' => '',
|
||||
'classes_auth_icon' => '',
|
||||
'classes_auth_btn' => 'btn-flat btn-primary',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Admin Panel Classes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can change the look and behavior of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the admin panel classes here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Layout-and-Styling-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'classes_body' => '',
|
||||
'classes_brand' => '',
|
||||
'classes_brand_text' => '',
|
||||
'classes_content_wrapper' => '',
|
||||
'classes_content_header' => '',
|
||||
'classes_content' => '',
|
||||
'classes_sidebar' => 'sidebar-dark-primary elevation-4',
|
||||
'classes_sidebar_nav' => '',
|
||||
'classes_topnav' => 'navbar-white navbar-light',
|
||||
'classes_topnav_nav' => 'navbar-expand',
|
||||
'classes_topnav_container' => 'container',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sidebar
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the sidebar of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the sidebar section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Layout-and-Styling-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'sidebar_mini' => 'lg',
|
||||
'sidebar_collapse' => false,
|
||||
'sidebar_collapse_auto_size' => false,
|
||||
'sidebar_collapse_remember' => false,
|
||||
'sidebar_collapse_remember_no_transition' => true,
|
||||
'sidebar_scrollbar_theme' => 'os-theme-light',
|
||||
'sidebar_scrollbar_auto_hide' => 'l',
|
||||
'sidebar_nav_accordion' => true,
|
||||
'sidebar_nav_animation_speed' => 300,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Control Sidebar (Right Sidebar)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the right sidebar aka control sidebar of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the right sidebar section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Layout-and-Styling-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'right_sidebar' => false,
|
||||
'right_sidebar_icon' => 'fas fa-cogs',
|
||||
'right_sidebar_theme' => 'dark',
|
||||
'right_sidebar_slide' => true,
|
||||
'right_sidebar_push' => true,
|
||||
'right_sidebar_scrollbar_theme' => 'os-theme-light',
|
||||
'right_sidebar_scrollbar_auto_hide' => 'l',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URLs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the url settings of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the urls section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Basic-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'use_route_url' => false,
|
||||
'dashboard_url' => '/admin',
|
||||
'logout_url' => 'logout',
|
||||
'login_url' => 'login',
|
||||
'register_url' => null,
|
||||
'password_reset_url' => 'password/reset',
|
||||
'password_email_url' => 'password/email',
|
||||
'profile_url' => '/changepassword',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laravel Mix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can enable the Laravel Mix option for the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the laravel mix section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Other-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled_laravel_mix' => false,
|
||||
'laravel_mix_css_path' => 'css/app.css',
|
||||
'laravel_mix_js_path' => 'js/app.js',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Menu Items
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the sidebar/top navigation of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Menu-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'menu' => [
|
||||
// Navbar items:
|
||||
[
|
||||
'type' => 'navbar-search',
|
||||
'text' => 'search',
|
||||
'topnav_right' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'fullscreen-widget',
|
||||
'topnav_right' => true,
|
||||
],
|
||||
|
||||
// Sidebar items:
|
||||
[
|
||||
'type' => 'sidebar-menu-search',
|
||||
'text' => 'search',
|
||||
],
|
||||
[
|
||||
'text' => 'Dashboard',
|
||||
'url' => '/admin',
|
||||
// 'can' => 'manage-blog',
|
||||
],
|
||||
[
|
||||
'text' => 'Gestione Economica',
|
||||
'url' => '#',
|
||||
'icon' => 'fas fa-fw fa-money-bill', //<i class="fa-solid fa-money-bill"></i>
|
||||
'can' => ['conti'],
|
||||
'submenu' => [
|
||||
[
|
||||
'text' => 'Lista movimenti',
|
||||
'route' => 'movimenti',
|
||||
'icon' => 'fas fa-fw fa-list-check'
|
||||
],
|
||||
[
|
||||
'text' => 'Giroconto',
|
||||
'route' => 'giroconto',
|
||||
'icon' => 'fas fa-fw fa-solid fa-recycle'
|
||||
],
|
||||
[ 'text' => 'Liste',
|
||||
'url' => '#',
|
||||
'icon' => 'fas fa-fw fa-gears',
|
||||
'submenu' => [
|
||||
[
|
||||
'text' => 'Categorie',
|
||||
'route' => 'categorie',
|
||||
'icon' => 'fas fa-fw fa-wine-bottle'
|
||||
],
|
||||
[
|
||||
'text' => 'Tags',
|
||||
'route' => 'tags',
|
||||
'icon' => 'fas fa-fw fa-tags'
|
||||
],
|
||||
[
|
||||
'text' => 'Conti',
|
||||
'url' => '/admin/conti',
|
||||
'icon' => 'fas fa-fw fa-wallet'
|
||||
],
|
||||
|
||||
]
|
||||
],
|
||||
[ 'text' => 'Reports',
|
||||
'url' => '#',
|
||||
'icon' => 'fas fa-fw fa-file',
|
||||
'submenu' => [
|
||||
|
||||
[
|
||||
'text' => 'Report movimenti',
|
||||
'route' => 'resoconto',
|
||||
'icon' => 'fas fa-fw fa-piggy-bank',
|
||||
],
|
||||
[
|
||||
'text' => 'Bilancio annuale',
|
||||
'route' => 'budget',
|
||||
'icon' => 'fas fa-fw fa-scale-balanced'
|
||||
],
|
||||
]
|
||||
],
|
||||
[
|
||||
'text' => 'Import/Export',
|
||||
'url' => '#',
|
||||
'icon' => 'fas fa-fw fa-file-arrow-down',
|
||||
'submenu' => [
|
||||
[
|
||||
'text' => 'Esporta tutti i movimenti',
|
||||
'route' => 'export',
|
||||
],
|
||||
[
|
||||
'text' => 'Importa Estratto conto ING',
|
||||
'route' => 'importING',
|
||||
],
|
||||
[
|
||||
'text' => 'Importa Estratto conto Cassa Rurale',
|
||||
'route' => 'importCR',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
['header' => 'GESTIONE DOCUMENTALE',
|
||||
'can' => ['documenti','contratti','progetti'],
|
||||
],
|
||||
[
|
||||
'text' => 'Documenti gen.',
|
||||
'url' => '/admin/documenti',
|
||||
'icon' => 'fas fa-fw fa-stop',
|
||||
'can' => ['documenti'],
|
||||
'color' => 'red',
|
||||
],
|
||||
[
|
||||
'text' => 'Contratti',
|
||||
'route' => 'contratti',
|
||||
'icon' => 'fas fa-fw fa-newspaper',
|
||||
'can' => ['contratti'],
|
||||
],
|
||||
[
|
||||
'text' => 'Progetti',
|
||||
'route' => 'progetti',
|
||||
'icon' => 'fas fa-fw fa-diagram-project',
|
||||
'can' => ['progetti'],
|
||||
],
|
||||
['header' => 'GESTIONE BENI',
|
||||
'can' => ['automobili'],],
|
||||
|
||||
[
|
||||
'text' => 'Automobili',
|
||||
'url' => '/admin/auto',
|
||||
'icon' => 'fas fa-fw fa-car',
|
||||
'can' => ['automobili'],
|
||||
],
|
||||
|
||||
['header' => 'GESTIONE PIM',
|
||||
'can' => ['contatti','tasks','appuntamenti','meetingroom'],
|
||||
],
|
||||
[
|
||||
'text' => 'Contatti',
|
||||
'url' => '/admin/contatti',
|
||||
'icon' => 'fas fa-fw fa-user',
|
||||
'can' => ['contatti'],
|
||||
'submenu' => [
|
||||
[
|
||||
'text' => 'Nuovo Contatto',
|
||||
'route' => 'newContact',
|
||||
'icon' => 'fas fa-fw fa-plus',
|
||||
],
|
||||
[
|
||||
'text' => 'Rubrica',
|
||||
'route' => 'contatti',
|
||||
'icon' => 'fas fa-fw fa-mobile',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'text' => 'Attività',
|
||||
'route' => 'tasks',
|
||||
'icon' => 'fas fa-fw fa-circle-check',
|
||||
'can' => ['tasks'],
|
||||
|
||||
],
|
||||
[
|
||||
'text' => 'Appuntamenti',
|
||||
'route' => 'calendario',
|
||||
'icon' => 'fas fa-fw fa-calendar',
|
||||
'can' => ['appuntamenti'],
|
||||
|
||||
],
|
||||
[
|
||||
'text' => 'Meeting Room',
|
||||
'route' => 'meeting',
|
||||
'icon' => 'fas fa-fw fa-file-video',
|
||||
|
||||
'can' => ['meetingroom']
|
||||
],
|
||||
['header' => 'CONSUMI',
|
||||
'can' => ['consumi'],
|
||||
],
|
||||
[
|
||||
'text' => 'GAS',
|
||||
'route' => 'gas',
|
||||
'icon' => 'fas fa-fw fa-fire',
|
||||
'can' => ['consumi'],
|
||||
],
|
||||
['header' => 'AMMINISTRAZIONE',
|
||||
'can' => ['amministrazione'],
|
||||
],
|
||||
[
|
||||
'text' => 'Utenti',
|
||||
'url' => '/admin/users/new',
|
||||
'icon' => 'fas fa-fw fa-user',
|
||||
'can' => ['amministrazione']
|
||||
],
|
||||
[
|
||||
'text' => 'Permessi',
|
||||
'route' => 'permessi',
|
||||
'icon' => 'fas fa-fw fa-solid fa-unlock-keyhole',
|
||||
'can' => ['amministrazione']
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Menu Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the menu filters of the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the menu filters section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Menu-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'filters' => [
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\GateFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\HrefFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\SearchFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\ActiveFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\ClassesFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\LangFilter::class,
|
||||
JeroenNoten\LaravelAdminLte\Menu\Filters\DataFilter::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Plugins Initialization
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can modify the plugins used inside the admin panel.
|
||||
|
|
||||
| For detailed instructions you can look the plugins section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Plugins-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'plugins' => [
|
||||
'Datatables' => [
|
||||
'active' => true,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.datatables.net/v/dt/dt-1.13.4/date-1.4.1/r-2.4.1/sb-1.4.2/sp-2.1.2/datatables.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css',
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.datatables.net/v/dt/dt-1.13.4/date-1.4.1/r-2.4.1/sb-1.4.2/sp-2.1.2/datatables.min.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
'DateRangePicker' => [
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
'JqueryUi' =>[
|
||||
'active' => false,
|
||||
'files' =>[
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//code.jquery.com/ui/1.13.1/jquery-ui.js',
|
||||
/// https://code.jquery.com/ui/1.13.1/jquery-ui.js
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//code.jquery.com/ui/1.13.1/themes/smoothness/jquery-ui.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Select2' => [
|
||||
'active' => true,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Chartjs' => [
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Sweetalert2' => [
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdn.jsdelivr.net/npm/sweetalert2@8',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Pace' => [
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/themes/blue/pace-theme-center-radar.min.css',
|
||||
],
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Fullcalendar' => [
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => true,
|
||||
'location' => '/vendor/fullcalendar/main.min.css',
|
||||
],
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => true,
|
||||
'location' => '/vendor/fullcalendar/main.min.js',
|
||||
],
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => true,
|
||||
'location' => '/vendor/fullcalendar/locales-all.min.js',
|
||||
],
|
||||
|
||||
],
|
||||
],
|
||||
'FontAwesome' =>[
|
||||
'active' => true,
|
||||
'files' =>[
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css',
|
||||
],
|
||||
],
|
||||
],
|
||||
'MomentJs' =>[
|
||||
'active' => false,
|
||||
'files' =>[
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => '//cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| IFrame
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we change the IFrame mode configuration. Note these changes will
|
||||
| only apply to the view that extends and enable the IFrame mode.
|
||||
|
|
||||
| For detailed instructions you can look the iframe mode section here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/IFrame-Mode-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'iframe' => [
|
||||
'default_tab' => [
|
||||
'url' => null,
|
||||
'title' => null,
|
||||
],
|
||||
'buttons' => [
|
||||
'close' => true,
|
||||
'close_all' => true,
|
||||
'close_all_other' => true,
|
||||
'scroll_left' => true,
|
||||
'scroll_right' => true,
|
||||
'fullscreen' => true,
|
||||
],
|
||||
'options' => [
|
||||
'loading_screen' => 1000,
|
||||
'auto_show_new_tab' => true,
|
||||
'use_navbar_items' => true,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Livewire
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we can enable the Livewire support.
|
||||
|
|
||||
| For detailed instructions you can look the livewire here:
|
||||
| https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Other-Configuration
|
||||
|
|
||||
*/
|
||||
|
||||
'livewire' => false,
|
||||
];
|
127
config/app.php
Normal file
127
config/app.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
115
config/auth.php
Normal file
115
config/auth.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
341
config/backup.php
Normal file
341
config/backup.php
Normal file
@ -0,0 +1,341 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
|
||||
'source' => [
|
||||
'files' => [
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
base_path(),
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*
|
||||
* Directories used by the backup process will automatically be excluded.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'follow_links' => false,
|
||||
|
||||
/*
|
||||
* Determines if it should avoid unreadable folders.
|
||||
*/
|
||||
'ignore_unreadable_directories' => false,
|
||||
|
||||
/*
|
||||
* This path is used to make directories in resulting zip-file relative
|
||||
* Set to `null` to include complete absolute path
|
||||
* Example: base_path()
|
||||
*/
|
||||
'relative_path' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*
|
||||
* The content of the database dump may be customized for each connection
|
||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'excludeTables' => [
|
||||
* 'table_to_exclude_from_backup',
|
||||
* 'another_table_to_exclude'
|
||||
* ]
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* If you are using only InnoDB tables on a MySQL server, you can
|
||||
* also supply the useSingleTransaction option to avoid table locking.
|
||||
*
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'useSingleTransaction' => true,
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||
*/
|
||||
'databases' => [
|
||||
'mysql',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The database dump can be compressed to decrease disk space usage.
|
||||
*
|
||||
* Out of the box Laravel-backup supplies
|
||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||
*
|
||||
* You can also create custom compressor. More info on that here:
|
||||
* https://github.com/spatie/db-dumper#using-compression
|
||||
*
|
||||
* If you do not want any compressor at all, set it to null.
|
||||
*/
|
||||
'database_dump_compressor' => null,
|
||||
|
||||
/*
|
||||
* If specified, the database dumped file name will contain a timestamp (e.g.: 'Y-m-d-H-i-s').
|
||||
*/
|
||||
'database_dump_file_timestamp_format' => null,
|
||||
|
||||
/*
|
||||
* The base of the dump filename, either 'database' or 'connection'
|
||||
*
|
||||
* If 'database' (default), the dumped filename will contain the database name.
|
||||
* If 'connection', the dumped filename will contain the connection name.
|
||||
*/
|
||||
'database_dump_filename_base' => 'database',
|
||||
|
||||
/*
|
||||
* The file extension used for the database dump files.
|
||||
*
|
||||
* If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
|
||||
* The file extension should be specified without a leading .
|
||||
*/
|
||||
'database_dump_file_extension' => '',
|
||||
|
||||
'destination' => [
|
||||
/*
|
||||
* The compression algorithm to be used for creating the zip archive.
|
||||
*
|
||||
* If backing up only database, you may choose gzip compression for db dump and no compression at zip.
|
||||
*
|
||||
* Some common algorithms are listed below:
|
||||
* ZipArchive::CM_STORE (no compression at all; set 0 as compression level)
|
||||
* ZipArchive::CM_DEFAULT
|
||||
* ZipArchive::CM_DEFLATE
|
||||
* ZipArchive::CM_BZIP2
|
||||
* ZipArchive::CM_XZ
|
||||
*
|
||||
* For more check https://www.php.net/manual/zip.constants.php and confirm it's supported by your system.
|
||||
*/
|
||||
'compression_method' => ZipArchive::CM_DEFAULT,
|
||||
|
||||
/*
|
||||
* The compression level corresponding to the used algorithm; an integer between 0 and 9.
|
||||
*
|
||||
* Check supported levels for the chosen algorithm, usually 1 means the fastest and weakest compression,
|
||||
* while 9 the slowest and strongest one.
|
||||
*
|
||||
* Setting of 0 for some algorithms may switch to the strongest compression.
|
||||
*/
|
||||
'compression_level' => 9,
|
||||
|
||||
/*
|
||||
* The filename prefix used for the backup zip file.
|
||||
*/
|
||||
'filename_prefix' => '',
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The directory where the temporary files will be stored.
|
||||
*/
|
||||
'temporary_directory' => storage_path('app/backup-temp'),
|
||||
|
||||
/*
|
||||
* The password to be used for archive encryption.
|
||||
* Set to `null` to disable encryption.
|
||||
*/
|
||||
'password' => env('BACKUP_ARCHIVE_PASSWORD'),
|
||||
|
||||
/*
|
||||
* The encryption algorithm to be used for archive encryption.
|
||||
* You can set it to `null` or `false` to disable encryption.
|
||||
*
|
||||
* When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
|
||||
* available on your system.
|
||||
*/
|
||||
'encryption' => 'default',
|
||||
|
||||
/*
|
||||
* The number of attempts, in case the backup command encounters an exception
|
||||
*/
|
||||
'tries' => 1,
|
||||
|
||||
/*
|
||||
* The number of seconds to wait before attempting a new backup if the previous try failed
|
||||
* Set to `0` for none
|
||||
*/
|
||||
'retry_delay' => 0,
|
||||
],
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install laravel/slack-notification-channel.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Notifications\Notifications` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => 'flavio.barachino@lavorain.cloud',
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
],
|
||||
|
||||
'discord' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is an empty string, the name field on the webhook will be used.
|
||||
*/
|
||||
'username' => '',
|
||||
|
||||
/*
|
||||
* If this is an empty string, the avatar on the webhook will be used.
|
||||
*/
|
||||
'avatar_url' => '',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound event will be fired.
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
'disks' => ['local'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* delete the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'default_strategy' => [
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
|
||||
/*
|
||||
* After the "keep_all_backups_for_days" period is over, the most recent backup
|
||||
* of that day will be kept. Older backups within the same day will be removed.
|
||||
* If you create backups only once a day, no backups will be removed yet.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 16,
|
||||
|
||||
/*
|
||||
* After the "keep_daily_backups_for_days" period is over, the most recent backup
|
||||
* of that week will be kept. Older backups within the same week will be removed.
|
||||
* If you create backups only once a week, no backups will be removed yet.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 8,
|
||||
|
||||
/*
|
||||
* After the "keep_weekly_backups_for_weeks" period is over, the most recent backup
|
||||
* of that month will be kept. Older backups within the same month will be removed.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
|
||||
/*
|
||||
* After the "keep_monthly_backups_for_months" period is over, the most recent backup
|
||||
* of that year will be kept. Older backups within the same year will be removed.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
* Set null for unlimited size.
|
||||
*/
|
||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||
],
|
||||
|
||||
/*
|
||||
* The number of attempts, in case the cleanup command encounters an exception
|
||||
*/
|
||||
'tries' => 1,
|
||||
|
||||
/*
|
||||
* The number of seconds to wait before attempting a new cleanup if the previous try failed
|
||||
* Set to `0` for none
|
||||
*/
|
||||
'retry_delay' => 0,
|
||||
],
|
||||
|
||||
];
|
107
config/cache.php
Normal file
107
config/cache.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
170
config/database.php
Normal file
170
config/database.php
Normal file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
76
config/filesystems.php
Normal file
76
config/filesystems.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
132
config/logging.php
Normal file
132
config/logging.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
116
config/mail.php
Normal file
116
config/mail.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
];
|
186
config/permission.php
Normal file
186
config/permission.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permission',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
|
||||
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
|
||||
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
|
||||
*/
|
||||
'register_octane_reset_listener' => false,
|
||||
|
||||
/*
|
||||
* Teams Feature.
|
||||
* When set to true the package implements teams using the 'team_foreign_key'.
|
||||
* If you want the migrations to register the 'team_foreign_key', you must
|
||||
* set this to true before doing the migration.
|
||||
* If you already did the migration then you must make a new migration to also
|
||||
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
|
||||
* (view the latest version of this package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* Passport Client Credentials Grant
|
||||
* When set to true the package will use Passports Client to check permissions
|
||||
*/
|
||||
|
||||
'use_passport_client_credentials' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
* See documentation to understand supported syntax.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
/*
|
||||
* The class to use for interpreting wildcard permissions.
|
||||
* If you need to modify delimiters, override the class and specify its name here.
|
||||
*/
|
||||
// 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
|
||||
|
||||
/* Cache-specific settings */
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
112
config/queue.php
Normal file
112
config/queue.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
83
config/sanctum.php
Normal file
83
config/sanctum.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. This will override any values set in the token's
|
||||
| "expires_at" attribute, but first-party sessions are not affected.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Token Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Sanctum can prefix new tokens in order to take advantage of numerous
|
||||
| security scanning initiatives maintained by open source platforms
|
||||
| that notify developers if they commit tokens into repositories.
|
||||
|
|
||||
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
||||
|
|
||||
*/
|
||||
|
||||
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||
],
|
||||
|
||||
];
|
38
config/services.php
Normal file
38
config/services.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_KEY'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
217
config/session.php
Normal file
217
config/session.php
Normal file
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.sqlite*
|
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
49
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
49
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user