Laravel 5.4上的迁移错误 php artisan make:auth
[Illuminate\Database\QueryException] SQLSTATE [42000]:语法错误或访问冲突:1071指定密钥太长; 最大密钥长度为767字节(SQL:alter tabl e
users
add uniqueusers_email_unique
([PDOException] SQLSTATE [42000]:语法错误或访问冲突:1071指定密钥太长; 最大密钥长度为767字节
我可以使用以下命令创建模型和资源控制器(绑定到模型)
php artisan make:controller TodoController --resource --model=Todo
Run Code Online (Sandbox Code Playgroud)
我想用上面的命令创建一个迁移,有可能吗?
我正在使用PHP7在Ubuntu 16.04服务器上运行laravel 5.4.试图安装cviebrock/eloquent-sluggable
包抛出一些错误:
pish@let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloquent-sluggable
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^4.2 for cviebrock/eloquent-sluggable
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested …
Run Code Online (Sandbox Code Playgroud) 我尝试在Laravel中验证数组POST:
$validator = Validator::make($request->all(), [
"name.*" => 'required|distinct|min:3',
"amount.*" => 'required|integer|min:1',
"description.*" => "required|string"
]);
Run Code Online (Sandbox Code Playgroud)
我发送空POST并将其if ($validator->fails()) {}
作为False
.这意味着验证是正确的,但事实并非如此.
如何在Laravel中验证数组?当我提交表格时input name="name[]"
您好,请阅读https://laravel.com/docs/5.4/migrations中包含的所有文档.
有没有办法如何迁移某个迁移文件(仅限1个迁移),现在每次我使用的更改都会导致php artisan migrate:refresh
所有字段都重置.
我试图在Laravel 5.4中运行的应用程序上禁用注册路由.
在我的路线文件中,我只有
Auth::routes();
Run Code Online (Sandbox Code Playgroud)
有没有办法禁用寄存器路由?
我正在使用Laravel 5.4并尝试实现身份验证系统.我使用php artisan命令make:auth来设置它.我根据我的布局编辑了视图.现在,当我尝试注销时,它会把这个错误抛给我
RouteCollection.php第161行中的NotFoundHttpException:
任何人都可以帮我注销吗?
嗨伙计们,我正试图在视图上显示我的降价电子邮件,但我的邮件视图有问题,它显示为
ErrorException in FileViewFinder.php line 112:
No hint path defined for [mail]. (View: /opt/lampp/htdocs/ppsb_new/core/resources/views/emails/tagihan.blade.php)
Run Code Online (Sandbox Code Playgroud)
和我的降价邮件视图
@component('mail::message')
# TAGIHAN PEMBAYARAN
Berikut tagihan anda untuk pembayaran
@component('mail::button', ['url' => ''])
wut ?
@endcomponent
Gunakan kode tagihan tersebut untuk membayar tagihan.
Thanks,<br>
{{ config('app.name') }}
@endcomponent
Run Code Online (Sandbox Code Playgroud)
我的观点中也有供应商有他们的组件,请帮助我.
Laravel 5.4 Blade引入了组件和插槽的概念 - 但我看不出它们在传统的@include上添加了什么.据我所知,使用组件/插槽,您可以:
在模板component-tpl.blade.php中:
<div class='container'>
<h1>{{$slot1}}</h1>
<h2>{{$slot2}}</h2>
</div>
Run Code Online (Sandbox Code Playgroud)
使用页面模板中的插槽,您可以:
@component('component-tpl')
@slot('slot1')
The content of Slot 1
@endslot
@slot('slot2')
The content of Slot 2
@endslot
@endcomponent
Run Code Online (Sandbox Code Playgroud)
与旧版本相比,它提供了哪些功能:
@include('component-tpl',['slot1'=>'The content of Slot 1',
'slot2'=>"The content of Slot 2"])
Run Code Online (Sandbox Code Playgroud)
使用完全相同的'component-tpl.blade.php'刀片模板?
我错过了什么?感谢您的任何见解.
克里斯
我可以使用列表
$specialities = Speciality::pluck('name','id')
Run Code Online (Sandbox Code Playgroud)
为什么以下代码不起作用?什么可以替代?我通过ajax返回此数组以形成一个选择框.所以我认为pluck
(在laravel 4+中列出)将是正确的选择.
$specialities = Speciality::pluck('name','id')->where('role_id',$request->roleid);
Run Code Online (Sandbox Code Playgroud)