Laravel 5.2 中文文档le 契约但没有使 用 Authenticatable trait,那么需要添加一个新的 getAuthIdentifierName 方法到该契约 实现类。通常,该方法返回认证实体的主键字段名,如:id。 这对你的应用没有什么影响,除非你手动实现 了 Illuminate\Contracts\Auth\Authenticatable。 自定义驱动 如果你使用了 Auth::extend 方法自定义获取用户的方法,现在需要使 我们为框架编写了新的 database Session 驱动,该驱动包含更多的用户信息,例如用户 ID、IP 地址以及用户代理,如果你想要继续使用之前的 database 驱动,需要在配置文 件 session.php 中指定 legacy-database 驱动。 如果你想要使用新的驱动,还需要添加 user_id (nullable integer)、ip_address (nullable string) 盒子,你只需要 在 Homestead.yaml 文件中设置 Blackfire Server ID 和 token: blackfire: - id: your-server-id token: your-server-token client-id: your-client-id client-token: your-client-token0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.6 中文文档*/ public function join(User $user, Order $order) { return $user->id === $order->user_id; } } API 控制器生成 声明被 API 消费的资源控制器时,通常你会排除输出 HTML 模板的路由,例如 create 和 edit,要生成不包含这些方法的资源控制器,可以在使 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" eval "$(ssh-agent -s)" ssh-add -K ~/.ssh/id_rsa 再次运行上述命令即可添加成功: 安装 Homestead 你可以通过克隆仓库代码来实现 Homestead 安装。将仓库克隆到用户目录下的 Homestead 目录,这样 Homestead 机器上不能正常工作,可能需要添加如下区块到 Vagrantfile: config.vm.provider "virtualbox" do |v| v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] end Valet 简介 Valet 是为 Mac0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 5.1 中文文档逗号进行分隔: 本文档由 Laravel 学院(LaravelAcademy.org)提供 3 Route::put('post/{id}', ['middleware' => 'role:editor', functio n ($id) { // }]); 更多关于中间件的内容,请查看中间件一节。 测试革新 Laravel 中内置的测试功能获得了引入注目的 parent::find(),应该改由调用 Eloquent 查询构建器的 find 方法: public static function find($id, $columns = ['*']){ $model = static::query()->find($id, $columns); // ... return $model; } lists 方法 lists lists 方法现在返回一个 Collection 实例而不是包含 Eloquent 查询结果的数组,如果你想 将 Collection 转化为数组,使用 all 方法: User::lists('id')->all(); 注意:Query Builder 的 lists 返回的仍然是数组。 日期格式化 以前,模型中的 Eloquent 日期字段存储格式可以通过重写 getDateFormat0 码力 | 307 页 | 3.46 MB | 1 年前3
Laravel 6.0 中文文档10000 个 Eloquent 模型会同时加载到内 存中: $users = App\User::all()->filter(function ($user) { return $user->id > 500; }); 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 9 不过,从 Laravel 6.0 开始,查询构建器的 $users = App\User::cursor()->filter(function ($user) { return $user->id > 500; }); foreach ($users as $user) { echo $user->id; } Eloquent 子查询优化 Laravel 6.0 引入了多个数据库子查询优化和增强支持。例如,假设 我们有一个航班目的地表 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 10 ->whereColumn('destination_id', 'destinations.id ') ->orderBy('arrived_at', 'desc') ->limit(1) ])->get(); 此外,我们还可以使用查询构建器方法 orderBy 添加的新的子查询0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.3 中文文档return Order::search('Star Trek')->get(); return Order::search('Star Trek')->where('user_id', 1)->paginate(); 当然,Scout 还有很多其他特性,具体请查看其文档。 可邮寄对象 注:Laracasts 上有关于该特性的免费视频教程。 Laravel 5.3 ($loop->last) This is the last iteration. @endifThis is user {{ $user->id }}
@endforeach 更多详情请查看完整的 Blade 文档。 3、早期版本 更多早期版本发行说明: 本文档由 Laravel 学院(LaravelAcademy 显示指定用户的属性 * * @param int $id * @return Response */ public function showProfile($id) { Log::info('Showing user profile for user: '.$id); return view('user.profile'0 码力 | 691 页 | 9.37 MB | 1 年前3
Laravel 5.0 Documentation
can capture segments of the request URI within your route: Route::get('user/{id}', function($id) { return 'User '.$id; }); CSRF Protection Insert The CSRF Token Into A Form Method Spoofing Route '[A-Za-z]+'); Route::get('user/{id}', function($id) { // }) ->where('id', '[0-9]+'); Route::get('user/{id}/{name}', function($id, $name) { // }) ->where(['id' => '[0-9]+', 'name' => '[a-z]+']) $router->pattern('id', '[0-9]+'); Once the pattern has been defined, it is applied to all routes using that parameter: Route::get('user/{id}', function($id) { // Only called if {id} is numeric. });0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 3.2 DocumentationVersi PDF oleh Wuri Nugrahadi http://empu.web.id Laravel v3.2 A Framework For Web Artisans Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, default value on Config::get. Added the ability to add pattern based filters. Improved session ID assignment. Added support for "unsigned" integers in schema builder. Added config, view, their table name on your database. So, if the current index name is "id_unique" on the "users" table, make the index name "users_id_unique". Add alias for Eloquent in your application configuration.0 码力 | 139 页 | 1.13 MB | 1 年前3
Learning Laravel{ Schema::create('admins', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); Gate::define('view-content', function ($user, $content){ return $user->isSubscribedTo($content->id); }); A Gate always receives a user instance as the first argument, you don't need to pass it when a Policy like this: function view($user, $content) { return $user->isSubscribedTo($content->id); } Policies can contain more methods as needed to take care of all authorisation cases for a model0 码力 | 216 页 | 1.58 MB | 1 年前3
《Slides Dev Web》02. Introduction aux frameworks PHP
code disponible dans le dépôt HE-Arc/php-intro- framework18. $ curl -v "http://he-arc.ch/?id=25" > GET /?id=25 HTTP/1.1 > Host: he-arc.ch > < HTTP/1.1 200 OK < Content-Type: text/html; charset=utf-8 < une ligne vide). La requête HTTP commencent toujours par la demande, ici GET /index.php?page=equipe&id=25 HTTP/1.1 puis les entêtes, ici: Host: www.he-arc.ch. La réponse du serveur est du même type, le complexité. &id=`. $page = $_GET["page"] ?? null; $id = (int) ($_GET["id"] ?? 0); // Connexion à la base de données. $db = new PDO("sqlite:. 0 码力 | 24 页 | 1.03 MB | 1 年前3
The Laravel Handbook
columns, an id , a name string and the timestamp utility columns ( created_at and updated_at , as we’ll see). 24 Schema::create('dogs', function (Blueprint $table) { $table->id(); $ route('dog.create') }}"> @csrf id="name"> Run php artisan serve mt-4"> Add a new dog id="name" class="border border-gray-200 p-1">0 码力 | 111 页 | 14.25 MB | 1 年前3
共 17 条
- 1
- 2













