如何使用 Laravel 框架的 validator
1个回答
展开全部
Laravel Validation
Laravel’s base controller class use a ValidatesRequests trait
app/Http/routes.php :
Route::get(‘post/create’, ‘PostController@create’);
Route::post(‘post’, ‘PostController@store’);
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class PostController extends Controller
{
/**
* Show the form to create a new blog post.
*
* @return Response
*/
public function create()
{
return view('post.create');
}
/**
* Store a new blog post.
*
Laravel’s base controller class use a ValidatesRequests trait
app/Http/routes.php :
Route::get(‘post/create’, ‘PostController@create’);
Route::post(‘post’, ‘PostController@store’);
Controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class PostController extends Controller
{
/**
* Show the form to create a new blog post.
*
* @return Response
*/
public function create()
{
return view('post.create');
}
/**
* Store a new blog post.
*
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询