Laravel 5.0 Documentation
Protection iii. Method Spoofing iv. Route Parameters v. Named Routes vi. Route Groups vii. Route Model Binding viii. Throwing 404 Errors ii. Middleware i. Introduction ii. Defining Middleware iii vi. Push Queues vii. Failed Jobs xix. Session i. Configuration ii. Session Usage iii. Flash Data iv. Database Sessions v. Session Drivers xx. Templates i. Blade Templating ii. Other Blade Control Collections xvi. Accessors & Mutators xvii. Date Mutators xviii. Attribute Casting xix. Model Events xx. Model Observers xxi. Converting To Arrays / JSON iv. Schema Builder i. Introduction ii. Creating0 码力 | 242 页 | 1.44 MB | 1 年前3
Learning LaravelChecking for Existence 21 Raw echos 21 Including Partial Views 21 Layout Inheritance 22 Sharing data to all views 24 Using View::share 24 Using View::composer 24 Closure-based composer 24 Class-based Seeding 60 Examples 60 Running a Seeder 60 Creating a Seed 60 Inserting Data using a Seeder 60 Inserting data with a Model Factory 61 Seeding with MySQL Dump 61 Using faker And ModelFactories to generate 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: Eloquent: Accessors0 码力 | 216 页 | 1.58 MB | 1 年前3
Laravel 3.2 Documentation.................................................................................... 30 Binding Data To Views ........................................................................................ ..................................................................... 34 Redirecting With Flash Data......................................................................................... 36 Downloads ........................................................................... 112 Authentication Model .................................................................................................0 码力 | 139 页 | 1.13 MB | 1 年前3
The Laravel Handbook
anything other than HTML. 18 But you can do lots of interesting stuff in Blade templates: insert data, add conditionals, do loops, display something if the user is authenticated or not, or show different Blade (for more I highly recommend the official Blade guide). In the route definition, you can pass data to a Blade template: Route::get('/test', function () { return view('test', ['name' => 'Flavio']); 'Flavio']); }); and use it like this:{{ $name }}
The {{ }} syntax allows you to add any data to the template, escaped. Inside it you can also run any PHP function you like, and Blade will display0 码力 | 111 页 | 14.25 MB | 1 年前3
Laravel 5.6 中文文档目录用于存放与数据库交互的模型类应该没有什么异议, 而业务逻辑应该放到 services 这种目录之下。所以推荐大家在生成模型类的时候指定生成到 app/Models 目录下: php artisan make:model Models/Test 根目录 App 目录 app 目录包含了应用的核心代码,注意不是框架的核心代码,框架的核心代码在 /vendor/laravel/framework 里面,此外你为应用编写的代码绝大 test 在终端 ping 一下任意 *.test 域名,如果 Valet 安装正确就会看到来自 127.0.0.1 的响 应: PING foobar.dev (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.069 ms 64 bytes from 127.0.0.1: icmp_seq=1 namespace App; use App\Contracts\Publisher; use Illuminate\Database\Eloquent\Model; class Podcast extends Model { /** * Publish the podcast. * * @param Publisher $publisher0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 6.0 中文文档query... no mass assignment protection or ev ents... $post->user()->update(['foo' => 'bar']); // Model update... provides mass assignment protection and events... $post->user->update(['foo' => 'bar']); 目录用于存放与数据库交互的模型类应该没有 什么异议,而业务逻辑应该放到 services 这种目录之下。所以推荐 大家在生成模型类的时候指定生成到 app/Models 目录下: php artisan make:model Models/Test 根目录 应用目录 app 目录包含了应用的核心代码,注意不是框架的核心代码,框架的 核心代码在 /vendor/laravel/framework 里面,此外你为应用编写 php namespace App; use App\Contracts\Publisher; use Illuminate\Database\Eloquent\Model; class Podcast extends Model { /** * Publish the podcast. * * @param Publisher $publisher * @return void0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.2 中文文档Route::get('/user/{user}', function (User $user) { return $user; }); 在 Laravel 5.1 中,你需要通过 Route::model 方法告诉 Laravel 注入 App\User 实例以匹 配路由定义中的 {user} 参数。 现在,在 Laravel 5.2 中,框架将会基于相应 URI 片段自动注入模型,从而允许你快速 lScope($scope) 这种方式来调用。 在 Eloquent 查询构建器中新增了 withoutGlobalScope 和 withoutGlobalScopes 方法,任 何调用 $model->removeGlobalScopes($builder) 的地方现在都要改 成 $builder->withoutGlobalScopes()。 事件 核心事件对象 Laravel /** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; } 显式绑定 要注册显式绑定,需要使用路由的 model 方法来为给定参数指定绑定类。应该 在 RouteServiceProvider::boot0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.1 中文文档public static function find($id, $columns = ['*']){ $model = static::query()->find($id, $columns); // ... return $model; } lists 方法 lists 方法现在返回一个 Collection 实例而不是包含 Eloquent 44 2.1 视图响应 如果你需要控制响应状态和响应头,还需要返回一个视图作为响应内容,可以使用 view 方 法: return response()->view('hello', $data)->header('Content-Type', $type); 当然,如果你不需要传递一个自定义的 HTTP 状态码或者自定义头,只需要简单使用全局 的帮助函数 view 即可。 2 ”号来引用嵌套视图,比如,如 果视图存放路径是 resources/views/admin/profile.php,那我们可以这样引用它: return view('admin.profile', $data); 判断视图是否存在 如果需要判断视图是否存在,可调用不带参数的 view 之后再使用 exists 方法,如果视图在 磁盘存在则返回 true: if (view()->exists('emails0 码力 | 307 页 | 3.46 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 Laravel 学院致力于提供优质 Laravel 中文学习资源 22 ]); 例如,如果你之前定义了如下$morphClass: class User extends Model { protected $morphClass = 'user' } 现在则需要在 AppServiceProvider 的 boot 方法中定义如下 morphMap: single job... php artisan queue:work --once 事件数据修改 多个队列任务事件如 JobProcessing 和 JobProcessed 将不再包含$data 属性,你需要更新应用调 用$event->job->payload()来获取对应数据。 失败任务表 如果你的应用有了 failed_jobs 表,需要添加 exception 字段到这张表,exception0 码力 | 691 页 | 9.37 MB | 1 年前3
《Slides Dev Web》02. Introduction aux frameworks PHP
com/forums/flat.jsp?forum=106&thread=152104 1 Design Patterns et webdev • Inversion de contrôle (IoC4) • Model View Controller – M : Accès aux données, logique métier – V : Templates des pages à générer – C : – (bootstrap, ré-écriture des URL, …) • Object Relational Mapping5 – Active Record, Table Data Gateway, Data Mapper, … • UI Patterns6 MVC for webdev Conventions • Nommage – Classes – Base de données couche-modele-dal-dao-orm-crud/ 6http://ui-patterns.com/ 2 Figure 1: MVC 3 Bonnes pratiques • Heavy Model, Light Controller • Don’t Repeat Yourself • You Ain’t Gonna Need It • Convention Over Configuration0 码力 | 24 页 | 1.03 MB | 1 年前3
共 15 条
- 1
- 2













