rtconner/laravel-plusplus

此包已被废弃,不再维护。作者建议使用 rtconner/laravel-plusplus 包。

我在每个我工作的 Laravel 项目中添加的内容

dev-master 2014-10-21 20:23 UTC

This package is auto-updated.

Last update: 2019-02-04 03:36:01 UTC


README

我真的只是为了自己才创建这个项目。但如果您喜欢,您也可以自由使用。这只是我想在所有 Laravel 项目中拥有的功能和添加物的集合。它假定完全使用 twitter bootstrap 和 jquery。

Laravel 让开发变得非常快速。这个包旨在让它变得更快捷一点。

'providers' => array(
	'\Conner\PlusPlus\PlusPlusServiceProvider',
),
'aliases' => array(
	'Form'            => '\Conner\PlusPlus\BootstrapFormFacade',
),

添加了常量:SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR, DS;在 copypasta 文件夹中提供了一些复制粘贴的模板。

一些非常有用的函数集合

array_make('New', 'Used'); // build array with key=values (great for selects)
cacert_path(); // full path to cacert.pem
csve($str, $quote=false); // escape for csv files
jse($str); // escape for inline javascript
money($amount, $fmt = 'USD'); // quick money format
strip_nl($str); // strip new lines from a string
ordinal(4); // 4th 3rd 2nd, etc
queries(); // array of query log
query_interpolate($query, $bindings); // manually create query from PDO bindings
valordash($val); // dash if str is empty

使用这个特性将 UUID 作为任何模型的主键。

$table->string('id', 36)->primary(); // put this into a migration on the table

use \Conner\PlusPlus\UuidableTrait;

额外添加的控制台命令

php artisan db:expunge # delete all tables from your database
php artisan code:perms # 660 files and 770 the folders
php artisan code:migrate # pull, clear caches, migrate, optimize

视图助手

Form::check('is_checked'); // same as checkbox, but with hidden field
HTML::gravatar('email@email.com');
HTML::pageHeader($title, $small=''); // create bootstrap page-header div
<!-- some view partials that I like to use -->
@include('plusplus::show')
@include('plusplus::delete-btn')

版权所有 2014 Robert Conner,您可以在 MIT 许可证 (MIT) 下使用此代码。