public function destroy($id)
 {
     $station = Station::where('id', $id)->first();
     if (!$station) {
         return response()->not_found('Estacion no encontrada');
     } else {
         $station->delete();
         return response()->json(['message' => 'Estacion ha sido eliminada']);
     }
 }
Example #2
0
 private function validateUnique()
 {
     $stationDuplicated = Station::where('name', $this->name)->where('state', $this->state);
     if ($this->id != null) {
         $stationDuplicated->where('id', '!=', $this->id);
     }
     if ($stationDuplicated->first()) {
         return false;
     } else {
         return true;
     }
 }
 public function getStation($stationId)
 {
     return Station::where('id_Station', '=', $stationId)->join('Banque', 'Banque.id_Banque', '=', 'Station.id_Banque')->first();
 }