我试图将我的项目从今天的5.3升级到laravel 5.4.我补充道
"laravel/framework": "5.4.*",
Run Code Online (Sandbox Code Playgroud)
要我composer.json和运行命令composer update,然后composer dump-autoload再测试了我的项目.它给了我这个错误:
错误:
2154f392745gf102547be138a945a11b58e5649203.php中的FatalThrowableError第2行:调用未定义的方法Illuminate\View\Factory :: getFirstLoop()
我错过了什么?
我有一个函数发送这样的电子邮件:
Mail::to($email)
->cc($arraywithemails)
->send(new document());
Run Code Online (Sandbox Code Playgroud)
如何将电子邮件发送给多个cc用户?我查了官方文档,但没有任何线索.
我通过执行一个雄辩的查询创建一个视图,然后将其传递给Blade.
@if($contacts != null)
//display contacts
@else
You dont have contacts
@endif
Run Code Online (Sandbox Code Playgroud)
但是它总是假设$ contacts有一些东西,即使查询没有给我任何东西.
我做了dd($contacts)并得到:
Collection {#247 ?
#items: []
}
Run Code Online (Sandbox Code Playgroud)
如何检查它是否为空?
我在Laravel有2个磁盘.
一个是本地磁盘,另一个是我需要上传文件的FTP服务器.它们都配置正确.
我这样尝试过:
Storage::disk('FTP')->copy('old/file1.jpg', 'new/file1.jpg');
Run Code Online (Sandbox Code Playgroud)
这只会复制文件,如果它已经在FTP服务器中.我也阅读了文档,似乎无法将两者结合起来以便上传文件.
有什么建议?
我想添加一个带有laravel URL的背景图像.我可以通过包含Web路径本身来实现这一点,但我想使用Laravel URL.
我现在就是这样做的:
.mystyle{
background-image: url("www.myproject.com/assets/img/background.png")
}
Run Code Online (Sandbox Code Playgroud)
这是我想要的方式:
.mystyle{
background-image: url("{{ URL::asset('assets/img/background.png }}")
}
Run Code Online (Sandbox Code Playgroud)
有线索吗?
我想在Laravel中自定义密码重置电子邮件.
我必须覆盖此功能:
namespace Illuminate\Auth\Passwords;
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
use Illuminate\Http\Request;
trait CanResetPassword
{
/**
* Get the e-mail address where password reset links are sent.
*
* @return string
*/
public function getEmailForPasswordReset()
{
return $this->email;
}
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPasswordNotification($token));
}
Run Code Online (Sandbox Code Playgroud)
这是我的尝试:
public function sendPasswordResetNotification($token, Requests $request)
{
Mail::to($request->email)->send(new newpassword($token));
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Illuminate声明\ Foundation\Auth\User :: sendPasswordResetNotification($ token,Illuminate\Http\Request $ request)必须与Illuminate\Contracts\Auth\CanResetPassword :: sendPasswordResetNotification($ …
我试图使用Laravel Migration来创建SQL表,但它不会让我.
这是错误:
SQLSTATE [42S01]:基表或视图已存在:1050表'mytable'已存在
这是我的代码:
Schema::create('mytable', function (Blueprint $table) {
$table->increments('id');
$table->foreign('othertable_id')
->references('id')->on('othertable')
->onDelete('cascade');
$table->string('variable');
$table->timestamps();
});
}
{
Schema::drop('mytable');
}
Run Code Online (Sandbox Code Playgroud)
我还检查了其他迁移是否被称为"mytable",但它们不是,所以我不确定它来自何处.
我尝试了以下方法:
第一
php artisan migrate:refresh
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误
然后我删除了整个数据库altogheter并使用:
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
仍然有错误
我肯定错过了什么。我有这个功能:
transform(value: number): string {
switch (value) {
case value > 1 && value < 86400:
return 'this';
break;
case value > 86401 && value < 259200:
return 'that';
break;
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试编译它时,出现以下错误:
ERROR in src/app/time-transform.pipe.ts:10:12 - error TS2678: Type 'boolean' is not comparable to type 'number'.
10 case value > 1 && value < 86400:
~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/time-transform.pipe.ts:13:12 - error TS2678: Type 'boolean' is not comparable to type 'number'.
13 case value > 86401 && value < 259200:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)
我希望能够比较数字。我在这里缺少什么?
我在 Laravel 中全局使用 Jquery,但是我也想包含 Jquery UI。
我有一个这样的刀片模板:
@section('scripts')
<script src="/assets/admin/js/sessions/myjavascript.js"></script>
@stop
content...
Run Code Online (Sandbox Code Playgroud)
我的javascript.js:
$( document ).ready(function() {
if (jQuery.ui) {
alert("loaded");
}
});
Run Code Online (Sandbox Code Playgroud)
jQuery.ui 不存在。我该如何实施?
编辑这里是扩展刀片:
<!DOCTYPE html>
<html>
<head>
<title>Mysite</title>
<link href='https://fonts.googleapis.com/css?family=Raleway:400,300,700' rel='stylesheet' type='text/css'>
<script src="/assets/admin/js/core/pace.js"></script>
<link href="/assets/admin/css/styles.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width,initial-scale=1">
@yield('styles')
</head>
<body id="app" class="layout-horizontal skin-default">
@include('admin.layouts.partials.notifs')
@include('admin.layouts.partials.header')
<div class="mobile-menu-overlay"></div>
@include('admin.layouts.partials.header-bottom')
@yield('content')
@include('admin.layouts.partials.footer')
@include('admin.layouts.partials.skintools')
<script src="/assets/admin/js/core/plugins.js"></script>
<script src="/assets/admin/js/demo/skintools.js"></script>
@yield('scripts')
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在查看 Laravel 代码并在 Authenticate.php 中间件中找到了这个:
public function handle($request, Closure $next, ...$guards)
{
$this->authenticate($guards);
return $next($request);
}
Run Code Online (Sandbox Code Playgroud)
没见过这种东西,3点有什么作用?我用谷歌搜索但什么也没找到