Laravel 5.0 Documentation
Services i. Authentication i. Introduction ii. Authenticating Users iii. Retrieving The Authenticated User iv. Protecting Routes v. HTTP Basic Authentication vi. Password Reminders & Reset vii. Social Method Injection public function createPost(Request $request, PostRepository $posts) { // } User registration, authentication, and password reset controllers are now included out of the box, as well auth/login and auth/register routes. The App\Services\Auth\Registrar service is responsible for user validation and creation. You may now define events as objects instead of simply using strings. For0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 5.2 中文文档中文学习资源 2 use App\User; Route::get('/user/{user}', function (User $user) { return $user; }); 在 Laravel 5.1 中,你需要通过 Route::model 方法告诉 Laravel 注入 App\User 实例以匹 配路由定义中的 {user} 参数。 现在,在 Laravel Laravel 5.2 中,框架将会基于相应 URI 片段自动注入模型,从而允许你快速 访问需要的模型实例。 如果路由参数片段 {user} 匹配路由闭包或控制器方法中相应变量 $user,并且被类型声明 为一个 Eloquent 模型类的话,Laravel 将会自动注入该模型。 更多隐式模型绑定详情请查看 Laravel 5.2 文档 HTTP 路由模型绑定部分。 中间件组 中间件组允许你 驱动,需要在配置文 件 session.php 中指定 legacy-database 驱动。 如果你想要使用新的驱动,还需要添加 user_id (nullable integer)、ip_address (nullable string) 以及 user_agent (text) 列到存放 Session 的数据表中。 Stringy 框架不再内置 Stringy 库,如果要在应用中使用,你需要通过0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.6 中文文档'throttle:60,1')->group(function () { Route::get('/user', function () { // }); }); 在 Laravel 5.6 中,你可以基于认证用户模型属性指定一个动态的最大请求次数,如果 User 模型包含 rate_limit 属性,可以将属性名传递 给 throttle 中间件,以便用于计算最大请求次数计数: 中间件,以便用于计算最大请求次数计数: Route::middleware('auth:api', 'throttle:rate_limit,1')->group(function () { Route::get('/user', function () { // }); }); 广播频道类 如果你的应用消费多个不同的频道,routes/channels.php 文件可能会变得很臃 方法。join 方法中的代码等同于之前位于频道授权闭包中的处理逻辑。当然,你还可以使用频道模 型绑定: User; use App\Order; class OrderChannel { /** * Create a new channel instance. *0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 6.0 中文文档授权响应消息来轻松实现。例如,给定如下策略方法: /** * 判断用户是否可以查看指定的航班. * * @param \App\User $user * @param \App\Flight $flight * @return mixed */ public function view(User $user, Flight $flight) { return $this->deny('Explanation 模型实例,如果使用传 统的 Laravel 集合,所有 10000 个 Eloquent 模型会同时加载到内 存中: $users = App\User::all()->filter(function ($user) { return $user->id > 500; }); 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 回调只有在迭代完每个用户时才会执行,从 而极大减少内存的使用量: $users = App\User::cursor()->filter(function ($user) { return $user->id > 500; }); foreach ($users as $user) { echo $user->id; } Eloquent 子查询优化 Laravel 6.0 引入了多个数据库子查询优化和增强支持。例如,假设0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.3 中文文档Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 4 个通知,你可以使用一个很简单的来实现: $user->notify(new InvoicePaid($invoice)); Laravel 社区已经为通知系统编写了各种各样的驱动,包括对 iOS 和 Android 通知的支持,要学习 更多关于通知系统的细节,查看其相应文档。 Authenticate the channel subscription... */ Broadcast::channel('orders.*', function ($user, $orderId) { return $user->placedOrder($orderId); }); Laravel Echo,通过 NPM 安装的全新的 JavaScript 包,将和 Laravel here((users) => { // }) .joining((user) => { console.log(user.name); }) .leaving((user) => { console.log(user.name); }); 要学习更多关于 Echo 和事件广播的内容,请参考其对应文档。0 码力 | 691 页 | 9.37 MB | 1 年前3
CakePHP Cookbook 2.x
CakePHP framework provides a robust base for your application. It can handle every aspect, from the user’s initial request all the way to the final rendering of a web page. And since the framework follows make the app/tmp directory writable by the webserver. The best way to do this is to find out what user your webserver runs as. You can run inside any PHP file your webserver execute. You should see a username printed. Change the ownership of the app/tmp directory to that user. The final command you run (in *nix) might look something like this: $ chown -R www-data app/tmp0 码力 | 1096 页 | 958.62 KB | 1 年前3
Learning LaravelRelationship Types 77 One to Many 77 One to One 78 How to associate between two models (example: User and Phone model) 78 Explanation 79 Many to Many 79 Polymorphic 80 Many To Many 82 Chapter 23: Events and Listeners 93 Examples 93 Using Event and Listeners for sending emails to a new registered user 93 Chapter 27: Filesystem / Cloud Storage 95 Examples 95 Configuration 95 Basic Usage 95 Custom explain how to implement multiauthentication feature in 5.3 First you need two different user Model cp App/User.php App/Admin.php change class name to Admin and set namespace if you use models different0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 5.1 中文文档*/ public function handle($request, Closure $next, $role) { if (! $request->user()->hasRole($role)) { // 跳转... } return $next($request); } Eloquent 模型定义一系列默认属性,然后为测试或数据库填充生成模型实例。 模型工厂还可以利用强大的 PHP 扩展库 Faker 类生成随机的属性数据。 $factory->define('App\User', function ($faker) { return [ 'name' => $faker->name, 'email' => $faker->email @var string */ 本文档由 Laravel 学院(LaravelAcademy.org)提供 4 protected $signature = 'email:send {user} {--force}'; 更多关于 Artisan 的内容,请查看命令行一节。 目录结构 为了更好地表达意图,app/Commands 目录被重命名为 app/Jobs,此外,app/Handlers0 码力 | 307 页 | 3.46 MB | 1 年前3
CakePHP Cookbook 2.x
CakePHP framework provides a robust base for your application. It can handle every aspect, from the user’s initial request all the way to the final rendering of a web page. And since the framework follows make the app/tmp directory writable by the webserver. The best way to do this is to find out what user your webserver runs as. You can run inside any PHP file your webserver execute. You should see a username printed. Change the ownership of the app/tmp directory to that user. The final command you run (in *nix) might look something like this: $ chown -R www-data app/tmp0 码力 | 820 页 | 2.52 MB | 1 年前3
Laravel 3.2 Documentation.................................................................. 114 Retrieving The Logged In User .................................................................................... 115 Logging posted form, validate, and either redirect to the login form with an error message or redirect your user to their dashboard. Class Auto Loading keeps you from having to maintain an autoloader configuration concatenated with an underscore. For example, if the relationship is between User and Role, the intermediate table name should be role_user. Remove Eloquent bundle. If you are using the Eloquent bundle with0 码力 | 139 页 | 1.13 MB | 1 年前3
共 82 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













