Merge pull request #1356 from akaunting/laravel-7

Laravel 7
This commit is contained in:
Denis Duliçi 2020-03-15 01:29:51 +03:00 committed by GitHub
commit 5e8d116f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 232 additions and 159 deletions

View File

@ -20,7 +20,7 @@ SESSION_DRIVER=file
QUEUE_CONNECTION=sync
LOG_CHANNEL=stack
MAIL_DRIVER=mail
MAIL_MAILER=mail
MAIL_HOST=localhost
MAIL_PORT=2525
MAIL_USERNAME=null
@ -31,4 +31,4 @@ MAIL_FROM_ADDRESS=null
FIREWALL_ENABLED=false
MODEL_CACHE_ENABLED=false
MODEL_CACHE_ENABLED=false

View File

@ -16,7 +16,7 @@ SESSION_DRIVER=file
QUEUE_CONNECTION=sync
LOG_CHANNEL=stack
MAIL_DRIVER=log
MAIL_MAILER=log
MAIL_HOST=localhost
MAIL_PORT=2525
MAIL_USERNAME=null

View File

@ -27,7 +27,7 @@
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group([
'middleware' => 'admin',
'namespace' => 'Modules\$STUDLY_NAME$\Http\Controllers'

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group([
'prefix' => 'portal',
'middleware' => 'portal',

View File

@ -2,12 +2,12 @@
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Throwable;
class Handler extends ExceptionHandler
{
@ -33,12 +33,12 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
@ -47,10 +47,12 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
if (env('APP_DEBUG') === false) {
return $this->handleExceptions($request, $exception);

View File

@ -36,18 +36,18 @@ class Overrider
// Email
$email_protocol = setting('email.protocol', 'mail');
config(['mail.driver' => $email_protocol]);
config(['mail.default' => $email_protocol]);
config(['mail.from.name' => setting('company.name')]);
config(['mail.from.address' => setting('company.email')]);
if ($email_protocol == 'sendmail') {
config(['mail.sendmail' => setting('email.sendmail_path')]);
config(['mail.sendmail.path' => setting('email.sendmail_path')]);
} elseif ($email_protocol == 'smtp') {
config(['mail.host' => setting('email.smtp_host')]);
config(['mail.port' => setting('email.smtp_port')]);
config(['mail.username' => setting('email.smtp_username')]);
config(['mail.password' => setting('email.smtp_password')]);
config(['mail.encryption' => setting('email.smtp_encryption')]);
config(['mail.smtp.host' => setting('email.smtp_host')]);
config(['mail.smtp.port' => setting('email.smtp_port')]);
config(['mail.smtp.username' => setting('email.smtp_username')]);
config(['mail.smtp.password' => setting('email.smtp_password')]);
config(['mail.smtp.encryption' => setting('email.smtp_encryption')]);
}
// Locale

View File

@ -12,7 +12,7 @@
"license": "GPL-3.0+",
"type": "project",
"require": {
"php": "^7.2",
"php": "^7.2.5",
"ext-bcmath": "*",
"akaunting/firewall": "1.2.*",
"akaunting/language": "1.0.*",
@ -24,38 +24,40 @@
"barryvdh/laravel-debugbar": "3.2.*",
"barryvdh/laravel-dompdf": "0.*",
"barryvdh/laravel-ide-helper": "2.6.*",
"bkwld/cloner": "3.5.*",
"bkwld/cloner": "3.6.*",
"consoletvs/charts": "6.5.*",
"dingo/api": "2.4.*",
"doctrine/dbal": "2.9.*",
"fideloper/proxy": "4.2.*",
"genealabs/laravel-model-caching": "0.7.*",
"dingo/api": "3.0.0-rc3",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"genealabs/laravel-model-caching": "0.8.*",
"graham-campbell/markdown": "12.0.*",
"guzzlehttp/guzzle": "6.5.*",
"guzzlehttp/guzzle": "^6.5",
"intervention/image": "2.5.*",
"jenssegers/date": "3.5.*",
"kyslik/column-sortable": "6.*",
"laracasts/flash": "3.0.*",
"laravel/framework": "6.*",
"laravel/tinker": "2.0.*",
"laravelcollective/html": "6.0.*",
"jenssegers/date": "4.0.0-beta",
"kyslik/column-sortable": "^6.0",
"laracasts/flash": "3.1.*",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"laravelcollective/html": "6.1.*",
"lorisleiva/laravel-search-string": "0.1.*",
"maatwebsite/excel": "3.1.*",
"misterphilip/maintenance-mode": "2.0.*",
"monooso/unobserve": "1.0.*",
"plank/laravel-mediable": "3.0.*",
"monooso/unobserve": "^2.0",
"plank/laravel-mediable": "4.2.*",
"santigarcor/laratrust": "5.2.*",
"simshaun/recurr": "4.0.*",
"staudenmeir/belongs-to-through": "2.9",
"staudenmeir/eloquent-has-many-deep": "1.11"
"staudenmeir/belongs-to-through": "^2.10",
"staudenmeir/eloquent-has-many-deep": "^1.12"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.9",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"extra": {
"laravel": {

View File

@ -38,7 +38,7 @@ return [
|
*/
'debug' => env('APP_DEBUG', false),
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
@ -212,6 +212,7 @@ return [
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,

View File

@ -97,7 +97,21 @@ return [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

View File

@ -39,6 +39,7 @@ return [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [

34
config/cors.php Normal file
View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@ -138,16 +138,16 @@ return [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],

View File

@ -85,9 +85,24 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => app()->runningInConsole() ? '' : url('/'),
'url' => env('AWS_URL'),
],
],
/*
|--------------------------------------------------------------------------
| 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'),
],
];

View File

@ -96,6 +96,10 @@ return [
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

View File

@ -4,45 +4,79 @@ return [
/*
|--------------------------------------------------------------------------
| Mail Driver
| Default Mailer
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| 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 to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
| "postmark", "log", "array", "mail"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
],
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'ses' => [
'transport' => 'ses',
],
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'mailgun' => [
'transport' => 'mailgun',
],
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'postmark' => [
'transport' => 'postmark',
],
'port' => env('MAIL_PORT', 587),
'sendgrid' => [
'transport' => 'sendgrid',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'mail' => [
'transport' => 'mail',
],
],
/*
|--------------------------------------------------------------------------
@ -60,47 +94,6 @@ return [
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
@ -120,17 +113,4 @@ return [
],
],
/*
|--------------------------------------------------------------------------
| Log Channel
|--------------------------------------------------------------------------
|
| If you are using the "log" driver, you may specify the logging channel
| if you prefer to keep mail messages separate from other log entries
| for simpler reading. Otherwise, the default channel will be used.
|
*/
'log_channel' => env('MAIL_LOG_CHANNEL'),
];

View File

@ -55,6 +55,7 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],

View File

@ -163,7 +163,7 @@ return [
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
@ -187,10 +187,10 @@ return [
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => null,
'same_site' => 'lax',
];

View File

@ -22,7 +22,7 @@ class SampleData extends Seeder
{
Model::reguard();
config(['mail.driver' => 'log']);
config(['mail.default' => 'log']);
$count = (int) $this->command->option('count');
$acc_count = ($count <= 10) ? $count : 10;

View File

@ -7,7 +7,7 @@
*/
// Define minimum supported PHP version
define('AKAUNTING_PHP', '7.2.0');
define('AKAUNTING_PHP', '7.2.5');
// Check PHP version
if (version_compare(PHP_VERSION, AKAUNTING_PHP, '<')) {

View File

@ -100,7 +100,7 @@ class MessageSelector
* Get the index to use for pluralization.
*
* The plural rules are derived from code of the Zend Framework (2010-09-25), which
* is subject to the new BSD license (http://framework.zend.com/license/new-bsd)
* is subject to the new BSD license (https://framework.zend.com/license)
* Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com)
*
* @param string $locale

View File

@ -1,23 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
colors="true">
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
<directory suffix="Test.php">./modules/**/Tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
<directory suffix="Test.php">./modules/**/Tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
<directory suffix="Test.php">./modules/**/Tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
@ -25,10 +19,13 @@
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="MAIL_DRIVER" value="array"/>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
</php>
</phpunit>

View File

@ -18,5 +18,6 @@ return [
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
'throttle' => 'Please wait before retrying.',
];

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'admin' middleware applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'api' prefix applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'common' middleware applied to all routes
*

View File

@ -1,6 +1,7 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'guest' middleware applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'install' middleware and prefix applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'portal' middleware and prefix applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'signed' middleware and prefix applied to all routes
*

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
/**
* 'wizard' middleware and prefix applied to all routes
*

View File

@ -13,7 +13,7 @@ trait CreatesApplication
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();

View File

@ -3,10 +3,10 @@
namespace Tests;
use App\Traits\Jobs;
use Artisan;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Artisan;
abstract class TestCase extends BaseTestCase
{
@ -19,4 +19,4 @@ abstract class TestCase extends BaseTestCase
Artisan::call('db:seed', ['--class' => '\Database\Seeds\TestCompany', '--force' => true]);
Artisan::call('company:seed', ['company' => 1]);
}
}
}

View File

@ -2,9 +2,7 @@
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{