Laravel 5.2 中文文档}); 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 21 Route::post('foo', function () { // }); 默认情况下,routes.php 文件包含单个路由和一个路由群组,该路由群组包含的所有路由 都使用了中间件组 web,而这个中间件组为路由提供了 能。通常,我们会将所有路由定义在这个路由组中。 有效的路由方法 我们可以注册路由来响应任何 HTTP 请求: Route::get($uri, $callback); Route::post($uri, $callback); Route::put($uri, $callback); Route::patch($uri, $callback); Route::delete($uri 有时候还需要注册路由响应多个 HTTP 请求——这可以通过 match 方法来实现。或者, 甚至可以使用 any 方法注册一个路由来响应所有 HTTP 请求: Route::match(['get', 'post'], '/', function () { // }); Route::any('foo', function () { // }); 2、路由参数0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 6.0 中文文档mass assignment protection or ev ents... $post->user()->update(['foo' => 'bar']); // Model update... provides mass assignment protection and events... $post->user->update(['foo' => 'bar']); 数组化 & toArray 重新发送验证路由 HTTP 方法 影响级别:中等 为了免除潜在的 CSRF 攻击,使用 Laravel 内置邮箱验证功能通过 路由器注册的 email/resend 路由请求方法已经由 GET 更新 为 POST。因此,你需要更新前端发送请求到该路由的请求类型。例 如,如果你是用的是内置的邮箱验证模板代码,需要像这样调整请求 方法: {{ __('Before proceeding, please check verification link.') }} {{ __('If you did not receive the email') }},
Laravel 5.6 中文文档rviceProvider; class ComposerServiceProvider extends ServiceProvider{ /** * Perform post-registration booting of services. * * @return void */ public function boot() 类来修 改路由前缀以及其他的路由群组选项:  有效的路由方法 我们可以注册路由来响应任何 HTTP 请求动作: Route::get($uri, $callback); Route::post($uri, $callback); Route::put($uri, $callback); Route::patch($uri, $callback); Route::delete($uri 方法来实现。或者,可以使用 any 方法注册一个路由来响应所有 HTTP 请求动作: Route::match(['get', 'post'], 'foo', function () { return 'This is a request from get or post'; }); Route::any('bar', function () { return 'This is0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 5.3 中文文档namespace App; use Laravel\Scout\Searchable; use Illuminate\Database\Eloquent\Model; class Post extends Model { use Searchable; } trait 被添加到模型之后,当保存模型实例的时候其信息将会被同步到搜索索引: $order 组 中 注 册 服 务 提 供 者 Illuminate\Notifications\NotificationServiceProvider。 POST 到 Logout Route::auth 方法现在为/logout 注册了一个 POST 路由取代之前的 GET 路由。这可以防止其它 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel Laravel 学院致力于提供优质 Laravel 中文学习资源 16 应用让用户从应用中退出。想要升级的话,需要将原来的退出请求转化为 POST 请求方式,或者 为/logout URI 自定义 GET 路由: Route::get('/logout', 'Auth\LoginController@logout'); 授权 使用类名调用策略方法 有时候一些策略方法只接收当前认证0 码力 | 691 页 | 9.37 MB | 1 年前3
Laravel 5.1 中文文档中间件参数可以再定义路由时通过:分隔中间件名称和参数名称来指定,多个参数可以通过 逗号进行分隔: 本文档由 Laravel 学院(LaravelAcademy.org)提供 3 Route::put('post/{id}', ['middleware' => 'role:editor', functio n ($id) { // }]); 更多关于中间件的内容,请查看中间件一节。 测试革新 Laravel 路由接收一个 URI 和一个闭包: Route::get('/', function () { return 'Hello World'; }); Route::post('foo/bar', function () { return 'Hello World'; }); Route::put('foo/bar', function () { }); 为多个动作注册路由 有时候需要注册一个路由来响应多个不同的 HTTP 动作,你可以使用 Route 门面的 match 方法来实现: Route::match(['get', 'post'], '/', function () { return 'Hello World'; }); 或者,还可以使用 any 方法注册一个路由响应所有 HTTP 动作: Route::any('foo'0 码力 | 307 页 | 3.46 MB | 1 年前3
Learning LaravelExample 187 Array Validation 188 Other Validation Approaches 189 Single Form Request Class for POST, PUT, PATCH 191 Error messages 192 Customizing error messages 192 Customising error messages within filtered by multiple methods php artisan route:list --method=GET --method=POST This will include all routes that accept GET and POST methods simultaneously. https://riptutorial.com/ 8 Running Laravel Artisan iterated over is empty, as a way to show default content .) @forelse($posts as $post){{ $post }} is the post content.
@emptyThere are no posts.
@endforelse Within loops, a0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 3.2 Documentationoptional way to separate your GET and POST request logic. In a login example your controller's get_login() action would serve up the form and your controller's post_login() action would accept the posted are saying. Many of us hang out every day in the #laravel IRC channel on FreeNode. Here's a forum post explaining how you can join us. Hanging out in the IRC channel is a really great way to learn more valid for any HTTP verb (GET, POST, PUT, and DELETE): Route::any('/', function() { return "Hello World!"; }); Registering routes for other request methods: Route::post('user', function() {0 码力 | 139 页 | 1.13 MB | 1 年前3
Laravel 5.0 Documentation
Route::post('foo/bar', function() { return 'Hello World'; }); Route::put('foo/bar', function() { // }); Route::delete('foo/bar', function() { // }); Route::match(['get', 'post'], '/', function() type="hidden" name="_token" value="{{ csrf_token() }}"> You do not need to manually verify the CSRF token on POST, PUT, or DELETE requests. The VerifyCsrfToken HTTP middleware will verify token in the request request input matches the token stored in the session. In addition to looking for the CSRF token as a "POST" parameter, the middleware will also check for the X-XSRF-TOKEN request header, which is commonly0 码力 | 242 页 | 1.44 MB | 1 年前3
The Laravel Handbook
controller takes an action and determines what to do. For example we’ll create a form that sends a POST request to the /dogs route. The router will say “this controller is in charge” and will tell us that perform actions, like adding data to the database, or updating it. If you’re unsure what is a POST request, check my HTTP tutorial. We will start by adding a create method to the controller to handle the form, so we can store that to the database. Before doing so, in routes/web.php we add the POST /dogs route handle controller and we assign it the name dog.create We also add a /dogs route0 码力 | 111 页 | 14.25 MB | 1 年前3
《Slides Dev Web》 06. HTTP & AJAX
4xx : Erreur Client • 5xx : Erreur Serveur Méthodes HTTP (verbes) • GET : Demander une ressource • POST : Création d’une ressource • PUT : Remplacement total d’une ressource • PATCH : Remplacement partiel moved here.













