diff --git a/app/Http/Controllers/changelogController.php b/app/Http/Controllers/changelogController.php index fe6c786..7695681 100644 --- a/app/Http/Controllers/changelogController.php +++ b/app/Http/Controllers/changelogController.php @@ -2,8 +2,7 @@ namespace App\Http\Controllers; - - +use Carbon\Carbon; class changelogController extends Controller { @@ -15,4 +14,13 @@ public function localadress() return $data; } + + public function info_update() + { + $data = $this->localadress(); + $data = $data[0]; + $date = Carbon::parse($data["date"])->format("d M Y"); + $data["date"] = $date; + return $data; + } } diff --git a/app/Http/Controllers/metarController.php b/app/Http/Controllers/metarController.php index 6b883ab..0380a02 100644 --- a/app/Http/Controllers/metarController.php +++ b/app/Http/Controllers/metarController.php @@ -228,7 +228,7 @@ public function clouds($metar) public function temp_qnh($metar) { - $regexTemparature = "/[0-9]{2}\/[0-9]{2}/"; + $regexTemparature = "/M?[0-9]{2}\/M?[0-9]{2}/"; $regexQNH = "/[Q][0-9]{4}/"; preg_match($regexTemparature, $metar, $temparature); preg_match($regexQNH, $metar, $QNH); diff --git a/app/Http/Controllers/my_fav_plateController.php b/app/Http/Controllers/my_fav_plateController.php new file mode 100644 index 0000000..05ebcc6 --- /dev/null +++ b/app/Http/Controllers/my_fav_plateController.php @@ -0,0 +1,50 @@ +icao; + $vid = $request->vid; + $id_user = auth()->user()->id; + $fav = metar_favModel::where("vid", $vid); + if ($fav == null) { + $fav = new \App\Models\metar_favModel(); + $fav->icao = $icao; + $fav->vid = $vid; + $fav->id_user = $id_user; + $fav->save(); + return response()->json(["status" => "success", "message" => "Saved"]); + } else { + $fav->delete(); + return response()->json(["status" => "success", "message" => "Deleted"]); + } + } + + public function get() + { + $id_user = auth()->user()->id; + $fav = metar_favModel::where("id_user", $id_user)->get(); + $plateforme = []; + foreach ($fav as $key => $value) { + $plateforme[] = $value->icao; + } + return $plateforme; + } + + public function update(Request $request) + { + $icao = $request->icao; + $vid = $request->vid; + $id_user = auth()->user()->id; + $fav = metar_favModel::where("vid", $vid)->where("id_user", $id_user)->first(); + $fav->icao = $icao; + $fav->save(); + return response()->json(["status" => "success", "message" => "Updated"]); + } +} diff --git a/app/Models/metar_favModel.php b/app/Models/metar_favModel.php new file mode 100644 index 0000000..cb401a3 --- /dev/null +++ b/app/Models/metar_favModel.php @@ -0,0 +1,15 @@ + - \ No newline at end of file diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 1e57f71..4caf4b9 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -20,8 +20,8 @@ @include('nav-wellcome')
{{$update["date"]}} - Update {{$update["name"]}} view the full Changelog.