Support the ongoing development of Laravel.io →
Authentication Security Requests
Last updated 1 year ago.
0

Here is my code, for some reason, my code got flagged as spam. :/


class RegisterRequest extends Request {

/**
 * Determine if the user is authorized to make this request.
 *
 * @return bool
 */
public function authorize()
{
	return true;
}

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
	return [
		'name' => 'required|min:3',
		'email' => 'required',
		'password' => 'required|min:6'
	];
}

}

0

Anyone? - Listening to bats in the echo of the cave?

0

You can pass back a json response with Response::json .

Assuming you are only replying in json with a model called Url.php

App\Http\Controllers\UrlController.php

public function store()
{
    $url = new Url;
    $url->url = Request::get('url');
    $url->description = Request::get('description');
    $url->user_id = Auth::user()->id;
 
    // normal validation and filtering 
 
    $url->save();
 
    return Response::json(array(
        'error' => false,
        'urls' => $urls->toArray()),
        200
    );
}
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ezos86 ezos86 Joined 13 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.