Laravel 5.0 Documentation
on certain routes, remove this line from App\Http\Kernel 's middleware array: 'App\Http\Middleware\VerifyCsrfToken', If you want to use it elsewhere, add this line to $routeMiddleware : 'csrf' => also need to add the Form and HTML facades and service provider. Edit config/app.php , and add this line to the 'providers' array: Global IoC Bindings Views Blade Tag Changes Translation Files Public should be followed: The class namespace declaration must be on the same line as line as the class name. Functions and control structures must use Allman0 码力 | 242 页 | 1.44 MB | 1 年前3
Laravel 6.0 中文文档LazyCollection::make(function () { $handle = fopen('log.txt', 'r'); while (($line = fgets($handle)) !== false) { yield $line; } }) ->chunk(4) ->map(function ($lines) { return LogEntry::fromLines($lines); Capsule::table 方法 Eloquent 数组化 & toArray Eloquent BelongsTo::update 方法 Eloquent 主键类型 本地化 Lang::trans 和 Lang::transChoice 方法 本文档由学院君提供 学院君致力于提供优质 Laravel 中文学习资源:https://xueyuanjun.com 12 本地化 Lang::getFromJson Lang::trans & Lang::transChoice 方法 影响级别:中等 翻译器的 Lang::trans 和 Lang::transChoice 方法被重命名 为 Lang::get 和 Lang::choice 方法。 此外,如果你自行实现 了 Illuminate\Contracts\Translation\Translator 契约,需要 更新实现类的 trans 和 transChoice0 码力 | 1442 页 | 14.66 MB | 1 年前3
Laravel 5.6 中文文档当然,你可以在 message 方法中调用辅助函数 trans 来返回一个在语言文件中定义的错误消息: /** * Get the validation error message. * * @return string */ public function message() { return trans('validation.uppercase'); } some|[20,*] There are many', 之后,你可以使用 trans_choice 函数获取给定行数的语言行,在本例中,由于行数大于 1,将会返回翻译字符串的复数形式: echo trans_choice('messages.apples', 10); 还可以在复数字符串中定义占位符属性,这些占位符会被传递给 trans_choice 函数的第三个数组参数替换: 'minutes_ago' 'minutes_ago' => '{1} :value minute ago|[2,*] :value minutes ago', echo trans_choice('time.minutes_ago', 5, ['value' => 5]); 覆盖 Vendor 包的语言文件 有些扩展包可能会自己处理语言文件。你可以通过将自己的文件放在 resources/lang/vendor/{package}/{locale}0 码力 | 377 页 | 14.56 MB | 1 年前3
Laravel 5.3 中文文档你可以使用帮助函数 trans 从语言文件中获取行,该方法接收文件和语言行的键作为第一个参数, 例如,让我们在语言文件 resources/lang/messages.php 中获取语言行 welcome: echo trans('messages.welcome'); 当然如果你使用 Blade 模板引擎,可以使用{{ }}语法打印语言行或者使用 @lang 指令: {{ trans('messages trans('messages.welcome') }} @lang('messages.welcome') 如果指定的语言行不存在,trans 函数将返回语言行的键,所以,使用上面的例子,如果语言行 不存在的话,trans 函数将返回 messages.welcome。 替换语言行中的参数 如果需要的话,你可以在语言行中定义占位符,所有的占位符都有一个:前缀,例如,你可以用占 本文档由 216 位符名称定义一个 welcome 消息: 'welcome' => 'Welcome, :name', 要在获取语言行的时候替换占位符,传递一个替换数组作为 trans 函数的第二个参数: echo trans('messages.welcome', ['name' => 'Dayle']); 如果占位符都是大写的,或者首字母是大写的,那么相应的,传入的值也会保持和占位符格式一0 码力 | 691 页 | 9.37 MB | 1 年前3
Laravel 5.2 中文文档$name = $this->choice('What is your name?', ['Taylor', 'Dayle '], false); 3.4 编写输出 要将输出发送到控制台,使用 line,info, comment, question 和 error 方法,每个方法都会 使用相应的 ANSI 颜色以作标识。 要显示一条信息消息给用户,使用 info 方法。通常,在终端显示为绿色: error 方法。错误消息文本通常是红色: $this->error('Something went wrong!'); 如果你想要显示原生输出,可以使用 line 方法,该方法输出的字符不带颜色: $this->line('Display this on the screen'); 表格布局 table 方法使输出多行/列格式的数据变得简单,只需要将头和行传递给该方法,宽度和高 // FooBar trans() trans 函数使用本地文件翻译给定语言行: echo trans('validation.required'): 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 260 trans_choice() trans_choice 函数翻译带拐点的给定语言行:0 码力 | 377 页 | 4.56 MB | 1 年前3
Laravel 5.1 中文文档studly_case('foo_bar'); // FooBar trans() trans 函数使用本地文件翻译给定语言行: echo trans('validation.required'): trans_choice() trans_choice 函数翻译带拐点的给定语言行: $value = trans_choice('foo.bar', $count); 本文档由 你可以使用帮助函数 trans 从语言文件中获取行,该方法接收文件和语言行的键作为第一个 参数,例如,让我们在语言文件 resources/lang/messages.php 中获取语言行 welcome: echo trans('messages.welcome'); 当然如果你使用 Blade 模板引擎,可以使用{{ }}语法打印语言行: {{ trans('messages.welcome') welcome') }} 如果指定的语言行不存在,trans 函数将返回语言行的键,所以,使用上面的例子,如果语 言行不存在的话,trans 函数将返回 messages.welcome。 替换语言行中的参数 本文档由 Laravel 学院(LaravelAcademy.org)提供 239 如果需要的话,你可以在语言行中定义占位符,所有的占位符都有一个:前缀,例如,你可 以用占位符名称定义一个0 码力 | 307 页 | 3.46 MB | 1 年前3
Laravel 3.2 Documentation...................................................................... 70 Retrieving A Language Line .......................................................................................... 70 Place ....................................................... 122 Contributing to Laravel Via Command-Line ................................................................... 123 Getting Started ....... You can either download a bundle repository to your bundles directory or use the "Artisan" command-line tool to automatically install them. The Eloquent ORM is the most advanced PHP ActiveRecord implementation0 码力 | 139 页 | 1.13 MB | 1 年前3
Learning Laravelthey reach the controllers and can thus modify or reject requests. Artisan Artisan is the command line tool you can use to control parts of Laravel. There are a lot of commands available to create models resources needed for development. You can also write your own commands to extend the Artisan command line tool. Eloquent ORM To connect your models to various types of databases, Laravel offers its own making new controllers, models, event classes, and a lot more. Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing0 码力 | 216 页 | 1.58 MB | 1 年前3
The Laravel Handbook
different terminal windows). Now we’re ready to use Tailwind CSS in our Blade templates! Add this line to the page head : line interface, Artisan. We can write command line applications for our app, in PHP, and execute them, it’s pretty handy 17. Creating commands We’ve used Artisan, the Laravel command line tool0 码力 | 111 页 | 14.25 MB | 1 年前3
共 9 条
- 1













