title: Laravel- arranging records in ascending and descending order
body: <p>I have a create method in my controller</p>
  
  <pre><code>public function create()
  {
  $image = PropertyUser::where('user_id', '=', Auth::user()-&gt;id)-&gt;get();
  foreach($image as $property)
  {
      $id = $property-&gt;property_id;
  }
  $image_main = Image::where('property_id', $id)-&gt;get();
  return view('settings.photos', ['image_array' =&gt; $image_main]);
  }
  </code></pre>
  
  <p>This is my photos.blade file</p>
  
  <pre><code>&lt;form name="asc" action="{{route("settings.photos")}}" method="post" class="text-center"&gt;
      @csrf
      &lt;input type="submit"  value="Ascending " class="settings-photos-header2 text-center"/&gt;  |
  &lt;/form&gt;&lt;form name="dec" action="{{route("settings.photos")}}" method="post"  class="text-center"&gt;
      @csrf
      &lt;input type="submit"  value= " Descending" class="settings-photos-header2 text-center"/&gt;
  &lt;/form&gt;
  &lt;h2 class="settings-photos-header2 text-center"&gt;Photo Gallery&lt;/h2&gt;
  @foreach ($image_array as $images)
      &lt;div class="image-warp"&gt;&lt;img src="{{$images-&gt;filename}}"
                                   style="width:100px;height:100px;"&gt;&lt;br/&gt;&lt;span style="color: #1b1e21"&gt;{{$images-&gt;description}}&lt;/span&gt;
      &lt;/form&gt;
      &lt;/div&gt;
      @endforeach
  </code></pre>
  
  <p>Question- How can i make the asc button sort the images in ascending order and des in descending order, is there a way to connect it to my controller, or is there a way to sort them in ascending and descending order through any other means?</p>