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
ee84446c
Commit
ee84446c
authored
Feb 07, 2023
by
Udaya Aththanayaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get fuel types new fuel types
parent
fd3d491d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
fuel-sliit-bakend-main/app/Http/Controllers/FuelContoller.php
...-sliit-bakend-main/app/Http/Controllers/FuelContoller.php
+43
-0
No files found.
fuel-sliit-bakend-main/app/Http/Controllers/FuelContoller.php
0 → 100644
View file @
ee84446c
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Models\Fueltype
;
use
App\Models\Fuelcapacity
;
use
App\Models\Station
;
class
FuelController
extends
Controller
{
// This function for get Fuel Typespes
public
function
get_fuel_type
(
Request
$req
){
$fueltype
=
""
;
if
(
$req
->
id
){
$fueltype
=
Fueltype
::
find
(
$req
->
id
);
}
else
{
$fueltype
=
Fueltype
::
all
()
->
orderby
(
'id'
,
'DESC'
);
}
return
response
()
->
json
([
'respond'
=>
$fueltype
]);
}
// This function for create a new Fuel type
public
function
create_fuel_type
(
Request
$req
){
$message
=
''
;
if
(
$this
->
check_empty
(
$req
->
name
,
$req
->
price
)){
//create new User
$fueltype
=
new
Fueltype
;
$fueltype
->
name
=
$req
->
name
;
$fueltype
->
price
=
$req
->
price
;
$fueltype
->
save
();
$message
=
'Fuel Type successfully created'
;
}
else
{
$message
=
'Type or Price cannot be empty'
;
}
return
response
()
->
json
([
'message'
=>
$message
]);
}
\ No newline at end of file
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