inital commit
This commit is contained in:
137
app/Http/Controllers/WeatherNoticeController.php
Normal file
137
app/Http/Controllers/WeatherNoticeController.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\WeatherNotice;
|
||||
|
||||
|
||||
class WeatherNoticeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$allrecords = WeatherNotice::all();
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => '',
|
||||
'data' => $allrecords
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$input = $request->all();
|
||||
$RecStore=WeatherNotice::create($input);
|
||||
//:::::::::::::::::::::::::::::::::::
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => '',
|
||||
'data' => 1
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
$request->validate([
|
||||
'id' => 'required|integer|exists:b_b_jaheshes,id'
|
||||
]);
|
||||
$idd = $request->id;
|
||||
$validrecs = array_filter($request->all());
|
||||
// $id = $request->id;
|
||||
$uprecords = WeatherNotice::find($idd);
|
||||
|
||||
$uprecords->fill($validrecs);
|
||||
$uprecords->save();
|
||||
|
||||
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => '',
|
||||
'data' => 1
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
//
|
||||
$request->validate([
|
||||
'id' => 'required|integer|exists:b_b_jaheshes,id'
|
||||
]);
|
||||
$idd = $request->id;
|
||||
|
||||
$delrec = WeatherNotice::find($idd);
|
||||
$delrec->delete();
|
||||
|
||||
//:::::::::::::::::::::::::::::::::::
|
||||
$allrecords = WeatherNotice::all();
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => '',
|
||||
'data' => $allrecords
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user