我将 Laravel 5 与 MS Sql Server 2014 一起使用。我想创建一个唯一约束,但它应该允许多个空值。
这是我正在使用的代码。其中“passport_no”如果不为空,则必须是唯一的。
Schema::create('UserProfile', function(Blueprint $table){
$table->increments('userprofile_id');
$table->integer('user_id')->unsigned();
$table->string('passport_no', 50)->unique()->nullable();
$table->foreign('user_id')->references('id')->on('users')
->onUpdate('cascade')->onDelete('cascade');
});
Run Code Online (Sandbox Code Playgroud) 我试图在一个页面上有2个分页.
视图:
{{!! $items->appends(['page2' => Request::input('page2', 1)])->render() !!}}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为使用自定义$ pageName进行分页($ items-> setPageName('custom_page_parameter'))链接在laravel 5中不起作用.
以下是我在laravel 4中的表现:
Laravel Multiple Pagination在一页中
Laravel 5的做法是什么?