/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $hairstyle = Hairstyles::with('category')->get();
     $jsonArray = [];
     foreach ($hairstyle as $hs) {
         $jsonArray[] = ["hairstyleId" => (int) $hs->hairstyle_id, "categoryId" => (int) $hs->category_id, "hairstyleName" => $hs->name, "categoryName" => $hs->category->name, "image" => url('/uploads/hairstyles/' . $hs->image), "hairsyleDescription" => $hs->description, "categoryDescription" => $hs->category->description, "xPoint" => (double) $hs->Xpoint, "yPoint" => (double) $hs->Ypoint];
     }
     return response()->json($jsonArray);
 }
 public function delete($id)
 {
     $hairstyles = Hairstyles::find($id);
     $hairstyles->delete();
     return redirect()->intended('hairstyles');
 }