Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/Http/Controllers/StudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ public function all_students(){
$students = Student::paginate(5);
return response()->json($students);
}
public function edit_student($id){
$student = Student::find($id);
return response()->json($student);
}
}
329 changes: 326 additions & 3 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2039,13 +2039,110 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
students: {},
name: "",
email: "",
phone: ""
phone: "",
edit_name: "",
edit_email: "",
edit_phone: ""
};
},
mounted: function mounted() {
Expand All @@ -2066,8 +2163,19 @@ __webpack_require__.r(__webpack_exports__);

var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
axios.get("all_students/?page=" + page).then(function (response) {
console.log(response.data);
_this.students = response.data;
});
},
// create method edit student
editStudent: function editStudent(id) {
var _this2 = this;

axios.get("edit_student/" + id).then(function (response) {
console.log(response.data);
_this2.edit_name = response.data.name;
_this2.edit_email = response.data.email;
_this2.edit_phone = response.data.phone;
});
}
}
Expand Down Expand Up @@ -38502,7 +38610,46 @@ var render = function() {
_vm._v(" "),
_c("td", [_vm._v(_vm._s(student.phone))]),
_vm._v(" "),
_c("td", [_vm._v("Dele")])
_c("td", [
_c(
"button",
{
staticClass: "btn btn-primary",
attrs: {
type: "button",
"data-toggle": "modal",
"data-target": "#exampleModal"
},
on: {
click: function($event) {
return _vm.editStudent(student.id)
}
}
},
[
_vm._v(
"\n Edit\n "
)
]
),
_vm._v("\n |\n "),
_c(
"button",
{
staticClass: "btn btn-primary",
attrs: {
type: "button",
"data-toggle": "modal",
"data-target": "#exampleModal"
}
},
[
_vm._v(
"\n Delete\n "
)
]
)
])
])
}),
0
Expand All @@ -38518,7 +38665,137 @@ var render = function() {
)
])
])
])
]),
_vm._v(" "),
_c(
"div",
{
staticClass: "modal fade",
attrs: {
id: "exampleModal",
tabindex: "-1",
role: "dialog",
"aria-labelledby": "exampleModalLabel",
"aria-hidden": "true"
}
},
[
_c(
"div",
{ staticClass: "modal-dialog", attrs: { role: "document" } },
[
_c("div", { staticClass: "modal-content" }, [
_vm._m(1),
_vm._v(" "),
_c("div", { staticClass: "modal-body" }, [
_c("form", [
_c("div", { staticClass: "form-group" }, [
_c("label", { attrs: { for: "exampleInputEmail1" } }, [
_vm._v("Name")
]),
_vm._v(" "),
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: _vm.edit_name,
expression: "edit_name"
}
],
staticClass: "form-control",
attrs: { type: "text", placeholder: "Enter Name" },
domProps: { value: _vm.edit_name },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.edit_name = $event.target.value
}
}
})
]),
_vm._v(" "),
_c("div", { staticClass: "form-group" }, [
_c("label", { attrs: { for: "exampleInputEmail1" } }, [
_vm._v("Email")
]),
_vm._v(" "),
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: _vm.edit_email,
expression: "edit_email"
}
],
staticClass: "form-control",
attrs: { type: "email", placeholder: "Enter email" },
domProps: { value: _vm.edit_email },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.edit_email = $event.target.value
}
}
})
]),
_vm._v(" "),
_c("div", { staticClass: "form-group" }, [
_c("label", { attrs: { for: "exampleInputEmail1" } }, [
_vm._v("Phone")
]),
_vm._v(" "),
_c("input", {
directives: [
{
name: "model",
rawName: "v-model",
value: _vm.edit_phone,
expression: "edit_phone"
}
],
staticClass: "form-control",
attrs: { type: "phone", placeholder: "Enter Phone" },
domProps: { value: _vm.edit_phone },
on: {
input: function($event) {
if ($event.target.composing) {
return
}
_vm.edit_phone = $event.target.value
}
}
})
]),
_vm._v(" "),
_c(
"button",
{
staticClass: "btn btn-primary",
attrs: { type: "submit" },
on: {
click: function($event) {
$event.preventDefault()
return _vm.saveStudent($event)
}
}
},
[_vm._v("\n Submit\n ")]
)
])
]),
_vm._v(" "),
_vm._m(2)
])
]
)
]
)
])
}
var staticRenderFns = [
Expand All @@ -38539,6 +38816,52 @@ var staticRenderFns = [
_c("th", { attrs: { scope: "col" } }, [_vm._v("Action")])
])
])
},
function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("div", { staticClass: "modal-header" }, [
_c(
"h5",
{ staticClass: "modal-title", attrs: { id: "exampleModalLabel" } },
[_vm._v("Modal title")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "close",
attrs: {
type: "button",
"data-dismiss": "modal",
"aria-label": "Close"
}
},
[_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
)
])
},
function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("div", { staticClass: "modal-footer" }, [
_c(
"button",
{
staticClass: "btn btn-secondary",
attrs: { type: "button", "data-dismiss": "modal" }
},
[_vm._v("\n Close\n ")]
),
_vm._v(" "),
_c(
"button",
{ staticClass: "btn btn-primary", attrs: { type: "button" } },
[_vm._v("Save changes")]
)
])
}
]
render._withStripped = true
Expand Down
Loading