-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close #272 Enhancement: Newest Expenses - Payments: Recent payments n…
…ot showing on the top
- Loading branch information
1 parent
672159e
commit bf30fad
Showing
9 changed files
with
253 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Date; | ||
use Illuminate\Support\Facades\Request; | ||
|
||
class BillDateFormat | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
$company_id = session('company_id'); | ||
|
||
if (empty($company_id)) { | ||
return $next($request); | ||
} | ||
|
||
$uri = $request->path(); | ||
$method = Request::method(); | ||
|
||
if (($method == 'POST') || ($method == 'PATCH')) { | ||
$time = Date::now()->format('H:i:s'); | ||
|
||
if (basename($uri) == 'payment') { | ||
$request['paid_at'] = $request['paid_at'] . ' ' . $time; | ||
} else { | ||
$request['billed_at'] = $request['billed_at'] . ' ' . $time; | ||
$request['due_at'] = $request['due_at'] . ' ' . $time; | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Date; | ||
use Illuminate\Support\Facades\Request; | ||
|
||
class InvoiceDateFormat | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
$company_id = session('company_id'); | ||
|
||
if (empty($company_id)) { | ||
return $next($request); | ||
} | ||
|
||
$uri = $request->path(); | ||
$method = Request::method(); | ||
|
||
if (($method == 'POST') || ($method == 'PATCH')) { | ||
$time = Date::now()->format('H:i:s'); | ||
|
||
if (basename($uri) == 'payment') { | ||
$request['paid_at'] = $request['paid_at'] . ' ' . $time; | ||
} else { | ||
$request['invoiced_at'] = $request['invoiced_at'] . ' ' . $time; | ||
$request['due_at'] = $request['due_at'] . ' ' . $time; | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Date; | ||
use Illuminate\Support\Facades\Request; | ||
|
||
class PaymentDateFormat | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
$company_id = session('company_id'); | ||
|
||
if (empty($company_id)) { | ||
return $next($request); | ||
} | ||
|
||
$method = Request::method(); | ||
|
||
if (($method == 'POST') || ($method == 'PATCH')) { | ||
$time = Date::now()->format('H:i:s'); | ||
|
||
$request['paid_at'] = $request['paid_at'] . ' ' . $time; | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Date; | ||
use Illuminate\Support\Facades\Request; | ||
|
||
class RevenueDateFormat | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
{ | ||
$company_id = session('company_id'); | ||
|
||
if (empty($company_id)) { | ||
return $next($request); | ||
} | ||
|
||
$method = Request::method(); | ||
|
||
if (($method == 'POST') || ($method == 'PATCH')) { | ||
$time = Date::now()->format('H:i:s'); | ||
|
||
$request['paid_at'] = $request['paid_at'] . ' ' . $time; | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Listeners\Updates; | ||
|
||
use App\Events\UpdateFinished; | ||
use Artisan; | ||
|
||
class Version1211 extends Listener | ||
{ | ||
const ALIAS = 'core'; | ||
|
||
const VERSION = '1.2.11'; | ||
|
||
/** | ||
* Handle the event. | ||
* | ||
* @param $event | ||
* @return void | ||
*/ | ||
public function handle(UpdateFinished $event) | ||
{ | ||
// Check if should listen | ||
if (!$this->check($event)) { | ||
return; | ||
} | ||
|
||
// Update database | ||
Artisan::call('migrate', ['--force' => true]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
database/migrations/2018_07_07_000000_modify_date_column.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class ModifyDateColumn extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('bills', function (Blueprint $table) { | ||
$table->dateTime('billed_at')->change(); | ||
$table->dateTime('due_at')->change(); | ||
}); | ||
|
||
Schema::table('bill_payments', function (Blueprint $table) { | ||
$table->dateTime('paid_at')->change(); | ||
}); | ||
|
||
Schema::table('invoices', function (Blueprint $table) { | ||
$table->dateTime('invoiced_at')->change(); | ||
$table->dateTime('due_at')->change(); | ||
}); | ||
|
||
Schema::table('invoice_payments', function (Blueprint $table) { | ||
$table->dateTime('paid_at')->change(); | ||
}); | ||
|
||
Schema::table('payments', function (Blueprint $table) { | ||
$table->dateTime('paid_at')->change(); | ||
}); | ||
|
||
Schema::table('revenues', function (Blueprint $table) { | ||
$table->dateTime('paid_at')->change(); | ||
}); | ||
|
||
Schema::table('recurring', function (Blueprint $table) { | ||
$table->dateTime('started_at')->change(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters