This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abb4a3e
commit 5332b73
Showing
8 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\metar_favModel; | ||
use Illuminate\Http\Request; | ||
|
||
class my_fav_plateController extends Controller | ||
{ | ||
public function save(Request $request) | ||
{ | ||
$icao = $request->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"]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class metar_favModel extends Model | ||
{ | ||
protected $table = "metar_fav"; | ||
protected $fillable = [ | ||
"id_user", | ||
"vid", | ||
"icao" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,5 @@ | |
|
||
</ul> | ||
</div> | ||
<button class="btn btn-success my-2 my-lg-0 rounded">AIRAC 2310</button> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters