Laravel 5.0 Documentation
Contents iii. Controllers i. Introduction ii. Basic Controllers iii. Controller Middleware iv. Implicit Controllers v. RESTful Resource Controllers vi. Dependency Injection & Controllers vii. Route namespace. This default namespace can be quickly changed using the new app:name Artisan command. Controllers, middleware, and requests (a new type of class in Laravel 5.0) are now grouped under the app/Http $request, PostRepository $posts) { // } User registration, authentication, and password reset controllers are now included out of the box, as well as simple corresponding views, which are located at0 码力 | 242 页 | 1.44 MB | 1 年前3Laravel 3.2 Documentation
........................................................................................ 22 Controllers............................................................................................... ................................................................................. 23 Bundle Controllers .............................................................................................. ................................................................................. 24 Nested Controllers ..............................................................................................0 码力 | 139 页 | 1.13 MB | 1 年前3Learning Laravel
Exception 39 Chapter 10: Constants 40 Examples 40 Example 40 Chapter 11: Controllers 41 Introduction 41 Examples 41 Basic Controllers 41 Controller Middleware 41 Resource Controller 42 Example of how directory 68 Override Application class 68 Calling the new class 68 Composer 69 Change the Controllers directory 69 Chapter 21: Eloquent 70 Introduction 70 Remarks 70 Examples 70 Introduction 70 core-parts of the framework which work https://riptutorial.com/ 2 together: models, views and controllers. Controllers are the main part where most of the work is done. They connect to models to get, create0 码力 | 216 页 | 1.58 MB | 1 年前3Laravel 5.1 中文文档
function(){ // Controllers Within The "App\Http\Controllers\Admin" Name space Route::group(['namespace' => 'User'], function() { // Controllers Within The "App\Http\Controllers\Admin\Us Namespace });}); 默认情况下,RouteServiceProvider 包含 routes.php 并指定其所在命名空间,因此,我们 只需要指定命名空间的 App\Http\Controllers 之后的一部分。 4.3 子域名路由 路由群组还可以被用于子域名路由通配符,子域名可以像 URIs 一样被分配给路由参数,从 而允许捕获子域名的部分用于路由或者控制器,子域名可以通过群组属性数组中的 制器存放在 app/Http/Controllers 目录中。 2、基本控制器 下面是一个基本控制器类的例子。所有的 Laravel 控制器应该继承自 Laravel 安装默认的基 本控制器: Controllers; use App\User; use App\Http\Controllers\Controller;0 码力 | 307 页 | 3.46 MB | 1 年前3Laravel 5.2 中文文档
'Admin'], function(){ // 控制器在 "App\Http\Controllers\Admin" 命名空间下 Route::group(['namespace' => 'User'], function(){ // 控制器在 "App\Http\Controllers\Admin\User" 命名空间下 }); }); 默认 默认情况下,RouteServiceProvider 引入 routes.php 并指定其下所有控制器类所在的默 认命名空间 App\Http\Controllers,因此,我们在定义的时候只需要指定命名空 间 App\Http\Controllers 之后的部分即可。 子域名路由 路由群组还可以被用于子域名路由通配符,子域名可以像 URI 一样被分配给路由参数, 从而允许捕获子域名的部分用于 将所有的请求处理逻辑都放在单个 routes.php 中显然是不合理的,你也许还希望使用控制 器类组织管理这些行为。控制器可以将相关的 HTTP 请求封装到一个类中进行处理。通 常控制器存放在 app/Http/Controllers 目录中。 2、基本控制器 下面是一个基本控制器类的例子。所有的 Laravel 控制器应该继承自 Laravel 自带的控制 器基类 Controller: 本文档由 Laravel0 码力 | 377 页 | 4.56 MB | 1 年前3Laravel 5.3 中文文档
中文学习资源 17 AuthorizesResourcestrait 已 经 和 AuthorizesRequeststrait 合 并 到 一 起 , 你 需 要 从 app/Http/Controllers/Controller.php 中移除 AuthorizesResourcestrait。 Blade 自定义指令 在之前版本的 Laravel 中,我们使用 directive Laravel 版本高于 5.3.4: Controllers; use App\User; use Illuminate\Support\Facades\Auth; use App\Http\Controllers\Controller; class ProjectController extends Controller 目录下每天为应用生成日志文件,你可以使用 Log 门面记录日志信息到日志中: Controllers; use Log; use App\User; use App\Http\Controllers\Controller; class UserController extends Controller{ /**0 码力 | 691 页 | 9.37 MB | 1 年前3Laravel 5.6 中文文档
方法将类依赖注入到类中。 让我们看一个简单的例子: Controllers; use App\User; use App\Repositories\UserRepository; use App\Http\Controllers\Controller; class UserController extends Controller $api); 绑定原始值 你可能有一个接收注入类的类,同时需要注入一个原生的数值比如整型,可以结合上下文轻松注入这个类需要的任何值: $this->app->when('App\Http\Controllers\UserController') ->needs('$variableName') ->give($value); 绑定接口到实现 服务容器的一个非常强大的功能是其绑定接口到实现。我们假设有一个 契约的不同实现。Laravel 为此定义了简单、平滑的接口: use Illuminate\Support\Facades\Storage; use App\Http\Controllers\VideoController; use App\Http\Controllers\PhotoControllers; use Illuminate\Contracts\Filesystem\Filesystem; $t0 码力 | 377 页 | 14.56 MB | 1 年前3Laravel 6.0 中文文档
通过「setter」方法将类依赖注入到类中。 让我们看一个简单的例子: Controllers; use App\User; use App\Repositories\UserRepository; use App\Http\Controllers\Controller; class UserController extends Controller { $api); 绑定原始值 你可能有一个接收注入类的类,同时需要注入一个原生的数值比如整 型,可以结合上下文轻松注入这个类需要的任何值: $this->app->when('App\Http\Controllers\UserController ') ->needs('$variableName') 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun 实现。Laravel 为此定义了简单、平滑的接口: use Illuminate\Support\Facades\Storage; use App\Http\Controllers\VideoController; use App\Http\Controllers\PhotoControllers; use Illuminate\Contracts\Filesystem\Filesystem; $thi0 码力 | 1442 页 | 14.66 MB | 1 年前3The Laravel Handbook
make:controller DogController 29 Laravel adds a DogController.php file into the folder app/Http/Controllers/ What is a controller? A controller takes an action and determines what to do. For example we’ll call dogs . We now render the dogs view in it, which we have to create yet: use App\Http\Controllers\DogController; //... Route::post( '/dogs', [DogController::class, 'create'] 1:8000/newdog The style is not brilliant, but the form shows up: 31 Now back to the app/Http/Controllers/DogController.php file. Inside the class we import the Dog model, and we add the create method0 码力 | 111 页 | 14.25 MB | 1 年前3《Slides Dev Web》 03. Laravel
com/docs/master/artisan 30https://laravel.com/docs/master/routing 31https://laravel.com/docs/master/controllers 32https://laravel.com/docs/master/views 7 Ressources • Tips33 • Cheat Sheet34 • Laracast350 码力 | 8 页 | 224.34 KB | 1 年前3
共 10 条
- 1