close #273 Fixed: Banking - Transfer and Transactions - Latest dates should be first then descend for consistency
This commit is contained in:
36
app/Http/Middleware/TransferDateFormat.php
Normal file
36
app/Http/Middleware/TransferDateFormat.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Date;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class TransferDateFormat
|
||||
{
|
||||
/**
|
||||
* 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['transferred_at'] = $request['transferred_at'] . ' ' . $time;
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user