Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Controller and method
- public function store(Request $request)
- {
- $user = Sentinel::getUser();
- $plan = new Plan();
- $plan->plan_start = $request->plan_start;
- $plan->part_id = $request->part_id;
- $plan->exercise_id = $request->exercise_id;
- $plan->weight = $request->weight;
- $plan->series = $request->series;
- $plan->repeat = $request->repeat;
- $plan->time = $request->time;
- $user->plans()->save($plan);
- return response()->json(['plan' => $plan], 202);
- }
- //app.js
- validation working when send form is problem
- POST http://localhost:3000/klient/plany/zapisz 500 (Internal Server Error)
- validateBeforeSubmit: function() {
- this.$validator.updateDictionary({
- pl: {
- attributes: {
- repeat: 'powtórzenia',
- weight: 'ciężar',
- time: 'czas',
- }
- }
- })
- this.$validator.setLocale('pl')
- // this could be error
- this.$validator.validateAll().then(() => {
- // Data is valid, so we can submit the form.
- this.submitForm()
- }).catch(() => {
- return false
- })
- //
- },
- submitForm:function(){
- axios.post('/klient/plany/zapisz')
- .then(function (response) {
- console.log(response);
- })
- .catch(function (error) {
- console.log(error);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement