Update Module Province
This commit is contained in:
parent
9915b04fbd
commit
c4dd3a03cc
@ -47,10 +47,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$countries = Country::all();
|
$countries = Country::all();
|
||||||
$_table = $dataTable->render($this->module->alias . '::province.index', compact('countries'));
|
return $dataTable->render($this->module->alias . '::province.index', compact('countries'));
|
||||||
if(!empty($_table->data)){
|
|
||||||
return $_table;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
*
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show(Request $request)
|
||||||
|
{
|
||||||
|
if (is_null($this->user) || !$this->user->can($this->module->alias . '.read')) {
|
||||||
|
abort(403, 'Sorry !! You are Unauthorized to view any ' . $this->module->alias . ' !');
|
||||||
|
}
|
||||||
|
|
||||||
|
$provinces = Province::where('country_id', $request->country_id)->get();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
foreach ($provinces as $row) {
|
||||||
|
$result = [
|
||||||
|
$row->id => $row->name,
|
||||||
|
];
|
||||||
|
|
||||||
|
$data[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,33 +122,6 @@
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the specified resource.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
*
|
|
||||||
* @return Renderable
|
|
||||||
*/
|
|
||||||
public function show(Request $request)
|
|
||||||
{
|
|
||||||
if (is_null($this->user) || !$this->user->can($this->module->alias . '.read')) {
|
|
||||||
abort(403, 'Sorry !! You are Unauthorized to view any ' . $this->module->alias . ' !');
|
|
||||||
}
|
|
||||||
|
|
||||||
$provinces = Province::where('country_id', $request->country_id)->get();
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
foreach ($provinces as $row) {
|
|
||||||
$result = [
|
|
||||||
$row->id => $row->name,
|
|
||||||
];
|
|
||||||
|
|
||||||
$data[] = $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<span class="required">Area Code</span>
|
<span class="required">Area Code</span>
|
||||||
</label>
|
</label>
|
||||||
<!--end::Label-->
|
<!--end::Label-->
|
||||||
<input type="number" id="{{$route[0].'_'.$route[1]}}_code" minlength="2" maxlength="2" class="form-control form-control-solid" placeholder="Enter Area Code" name="code"/>
|
<input type="string" id="{{$route[0].'_'.$route[1]}}_code" class="form-control form-control-solid" placeholder="Enter Area Code" name="code"/>
|
||||||
</div>
|
</div>
|
||||||
<!--end::Input group-->
|
<!--end::Input group-->
|
||||||
|
|
||||||
|
@ -129,7 +129,11 @@
|
|||||||
$(".form_{{$route[0].'_'.$route[1]}}").attr('action', "{{ route($route[0].'.'.$route[1].'.store') }}");
|
$(".form_{{$route[0].'_'.$route[1]}}").attr('action', "{{ route($route[0].'.'.$route[1].'.store') }}");
|
||||||
$(".form_{{$route[0].'_'.$route[1]}}").find('input[name="_method"]').remove();
|
$(".form_{{$route[0].'_'.$route[1]}}").find('input[name="_method"]').remove();
|
||||||
$("#title_form").html("Create {{ucfirst($route[1])}}");
|
$("#title_form").html("Create {{ucfirst($route[1])}}");
|
||||||
})
|
});
|
||||||
|
|
||||||
|
Inputmask({
|
||||||
|
"mask" : "99"
|
||||||
|
}).mask("#{{$route[0].'_'.$route[1]}}_code");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
Loading…
Reference in New Issue
Block a user