Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-j 51
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-j 51
22_23-j 51
Commits
683e5c63
Commit
683e5c63
authored
Feb 07, 2023
by
Udaya Aththanayaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get audit New
parent
224637d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
fuel-sliit-bakend-main/app/Http/Controllers/AuditController.php
...liit-bakend-main/app/Http/Controllers/AuditController.php
+46
-0
No files found.
fuel-sliit-bakend-main/app/Http/Controllers/AuditController.php
0 → 100644
View file @
683e5c63
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Models\Audit
;
use
App\Models\Queue
;
use
App\Models\Fueltype
;
use
App\Models\Station
;
use
App\Models\User
;
use
App\Models\Fuelcapacity
;
class
AuditController
extends
Controller
{
// This function for get Audit
public
function
get_audit
(
Request
$req
){
$response
=
[
"amount"
=>
''
,
"filled"
=>
''
,
];
if
(
$req
->
role
==
"station"
){
$station
=
Station
::
where
(
'user_id'
,
$req
->
id
)
->
first
();
$response
=
[
"amount"
=>
Audit
::
where
(
'station_id'
,
$station
->
id
)
->
sum
(
'amount'
),
"filled"
=>
Audit
::
where
(
'station_id'
,
$station
->
id
)
->
count
()
];
}
else
if
(
$req
->
role
==
"user"
){
$response
=
[
"amount"
=>
Audit
::
where
(
'user_id'
,
$req
->
id
)
->
sum
(
'amount'
),
"filled"
=>
Audit
::
where
(
'user_id'
,
$req
->
id
)
->
count
(),
"list"
=>
Audit
::
join
(
'stations'
,
'stations.id'
,
'='
,
'audits.station_id'
)
->
join
(
'fueltypes'
,
'fueltypes.id'
,
'='
,
'audits.fueltype_id'
)
->
join
(
'vehicles'
,
'vehicles.id'
,
'='
,
'audits.vehicle_id'
)
->
join
(
'users'
,
'users.id'
,
'='
,
'audits.user_id'
)
->
where
(
'audits.user_id'
,
$req
->
id
)
->
get
([
'audits.id as aid'
,
'users.name as uname'
,
'stations.name as sname'
,
'vehicles.type as vtype'
,
'vehicles.vehicle_no as vno'
,
'fueltypes.name as ftyoe'
,
'audits.amount'
,
'audits.qty'
,
'audits.created_at'
])
];
}
return
response
()
->
json
([
'response'
=>
$response
]);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment