Guest User

Untitled

a guest
Dec 11th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Route::middleware('auth:api')->get('/{electionId}/form/image/d/{wilayahId}', 'ApiFormDController@getImageAtWilayah');
  2.  
  3. public function getImageAtWilayah($electionId, $wilayahId)
  4. {
  5. $result = FormDImageDetail::with('formd_image')
  6. ->where('jenis_pemilihan', $electionId)
  7. ->where('id_wilayah', $wilayahId)
  8. ->where('versi', function($query) use($electionId) {
  9. $query->select(DB::raw('max(versi)'))
  10. ->from('formd_image')
  11. ->whereColumn('id_wilayah', 'formd_image_detail.id_wilayah')
  12. ->where('flag_aktif', true)
  13. ->where('jenis_pemilihan', $electionId);
  14. });
  15. return $result;
  16. }
  17.  
  18. <template>
  19. <div>
  20. <div id="imageScroll">
  21. <ul>
  22. <li v-for="items in formd" id="listForm">
  23. <img :src="'/storage/image/formc/'+items.form_image" class="view-form-d-image"/>
  24. </li>
  25. </ul>
  26. </div>
  27. </div>
  28. </template>
  29.  
  30. methods:{
  31. getResult(url){
  32. eventBus.$on("wilayah-change", (wilayahId) => {
  33. url = "/api/" + this.electionId + "/form/image/d/" + wilayahId;
  34. axios.get(url)
  35. .then((response) => {
  36. if (response.data) {
  37. this.formd = response.data.data;
  38. this.makePagination(response.data);
  39. }
  40. });
  41. });
Add Comment
Please, Sign In to add comment