maan56

maan56

Member Since 1 Year Ago

Experience Points
590
Total
Experience

4,410 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
590 XP
Sep
25
3 weeks ago
Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

I used another working ajax request with this and that was working. I don't know why this request was broken. and throwing error.

That ajax request was on another controller and I use the same route for both requests with an additional parameter named route_method to separate both requests. And that is working perfectly. Thanks to all of you!

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

Here is ajax funtion in jquery.tabledit.js file I'm using:

/**
         * Send AJAX request to server.
         *
         * @param {string} action
	* action can be 'edit' or 'delete'
         */
        function ajax(action)
        {
            var serialize = $table.find('.tabledit-input').serialize() + '&action=' + action;

            var result = settings.onAjax(action, serialize);

            if (result === false) {
                return false;
            }

            var jqXHR = $.post(settings.url, serialize, function(data, textStatus, jqXHR) {
                if (action === settings.buttons.edit.action) {
                    $lastEditedRow.removeClass(settings.dangerClass).addClass(settings.warningClass);
                    setTimeout(function() {
                        //$lastEditedRow.removeClass(settings.warningClass);
                        $table.find('tr.' + settings.warningClass).removeClass(settings.warningClass);
                    }, 1400);
                }

                settings.onSuccess(data, textStatus, jqXHR);
            }, 'json');

            jqXHR.fail(function(jqXHR, textStatus, errorThrown) {
                if (action === settings.buttons.delete.action) {
                    $lastDeletedRow.removeClass(settings.mutedClass).addClass(settings.dangerClass);
                    $lastDeletedRow.find('.tabledit-toolbar button').attr('disabled', false);
                    $lastDeletedRow.find('.tabledit-toolbar .tabledit-restore-button').hide();
                } else if (action === settings.buttons.edit.action) {
                    $lastEditedRow.addClass(settings.dangerClass);
                }

                settings.onFail(jqXHR, textStatus, errorThrown);
            });

            jqXHR.always(function() {
                settings.onAlways();
            });

            return jqXHR;
        }

See if this file can help

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

This is console error:

POST http://127.0.0.1:8000/client/bookingEdit 422 (Unprocessable Entity)

also check network tab, and request headers and form-data. everything is fine. but I don't know why this happening.

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

Even I tried making new controller and use different method name and route name. but getting same 422 unprocessable entity error. Having responseText {"message":"The given data was invalid.","errors":{"password":["New Password is required."]}}

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

yes, same error. tried it already

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

I'm using this jQuery Tabledit plugin. Markcell jQuery-Tabledit

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

@laracoft I tried changing route name and by passing direct URL too. same error

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

@laracoft No, I don't have any route named row_edit

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

@tykus @laracoft Here is my entire controller method. I didn't apply validation yet.

class ClientController extends Controller
{
	public function bookings($id){
		$date = Carbon::now()->toDateString();
		$cData = CourierData::whereDate('created_at', $date)->where([
			['client_id', '=', $id]
		])->get();
		return view('client.bookings')->with([
			'cData' => $cData,
			'date' => $date,
			'client_id' => $id,
		]);
	}
	
	public function bookingSearch(Request $request){
		$start = Str::before($request->selectedDate, ' -');
		$end = Str::after($request->selectedDate, '- ');
		$date = $request->selectedDate;
		if ($start === $end) {
$data = CourierData::whereDate('created_at', $start)->where([
                    ['client_id', '=', $request->client]
                ])->get();
                    if ($data->isEmpty()) return redirect()->back()->with('warning', 'There is no record in this date!');
                    else {
                        return view('client.bookings')->with([
                            'cData' => $data,
                            'date' => $date,
                            'client_id' => $request->client,
                        ]);
                    }
		} else {
			$data = CourierData::whereBetween('created_at', [$start, $end])->where([
				['client_id', '=', $request->client]
			])->get();
			if ($data->isEmpty()) return redirect()->back()->with('warning', 'There is no record in this date!');
			else {
				return view('client.bookings')->with([
					'cData' => $data,
					'date' => $date,
					'client_id' => $request->client,
				]);
			}
		}
	}

	public function bookingUpdate(Request $request){
        	if($request->ajax()){
            	return response()->json($request);
        	}
    	}
}

Route File:

Route::prefix('client')->group(function(){
	Route::get('/{client}/bookings', '[email protected]')->name('client.bookings');
	Route::post('/{client}/bookings', '[email protected]')->name('client.bookings_date');
	Route::post('/bookingEdit', '[email protected]')->name('row_edit');
});
Sep
24
3 weeks ago
Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

@tykus this is payload

 columns: {
                identifier: [10, 'id'],
                editable: [[5, 'pcs'], [6, 'weight'], [7, 'rate']]
            },

where 5, 6, and 7 are table column index

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

I checked in network tab in chrome browser and payload was there. and csrf_token was also shown in header

Activity icon

Replied to Ajax Request Error 422 (Unprocessable Entity)

@tykus this is jquery inline table edit plugin.

onAjax() function is called before AJAX request sent. and form data is serialized as I show it in console.

onSuccess() function is called when ajax request is completed successfully.

Activity icon

Started a new Conversation Ajax Request Error 422 (Unprocessable Entity)

Hey guys! I'm having issue with ajax request. I'm using jquery tabledit plugin and when saving edited row, facing error 422 (Unprocessable Entity) and in response text I get this error "{"message":"The given data was invalid.","errors":{"password":["New Password is required."]}}".

Here is my blade file. (after initiating table) jquery function

$.ajaxSetup({
            headers: {
                'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $('#editable').Tabledit({
            url: '{{ route("row_edit") }}',
            dataType:"json",
            type:"post",
            editButton: true,
            deleteButton: true,
            columns: {
                identifier: [10, 'id'],
                editable: [[5, 'pcs'], [6, 'weight'], [7, 'rate']]
            },
            restoreButton:false,
            onAjax: function(action, serialize) {
                // Executed before the ajax request If returns false, does not send the ajax request. (v1.2.2)
                console.log(serialize);
            },
            onSuccess:function(data, textStatus, jqXHR)
            {
                // Executed when the ajax request is completed
                console.log(data);
                console.log(textStatus);
                console.log(jqXHR);
            },
            onFail: function(jqXHR, textStatus, errorThrown) {
                // Executed when occurred an error on ajax request
                console.log("error");
                console.log(jqXHR);
            },
        });

on the controller side, I'm just returning same $request just to check wether the data is coming or not.

return response()->json($request);

Any help would be appreciated. Thanks in Advance