我的问题是Laraval接受PNG图像或JPG旁边的任何其他格式.发生的事情是,当我将图像更改为JPG时,它可以找到它,但是一旦我将其更改为PNG,它就再也找不到图像了.
{{HTML::image('images/DRCSportslogo.png', 'DRC Sports Race Management', array('id' => 'DRCS-logo'));}}
Run Code Online (Sandbox Code Playgroud)
我在同一个文件目录中将这个图像格式化为PNG和JPG,所以我知道它不是文件的位置.
我正在尝试更改subjectLaravel 5.7附带的验证邮件中的默认字段.我如何以及在何处更改它?我自己和网上搜遍了整个地方.因为它是全新的我找不到答案.你能帮我吗?谢谢!
我的刀片中有以下内容......
<div>
<contact-form></contact-form>
</div>
Run Code Online (Sandbox Code Playgroud)
我想测试以确保Vue.js组件始终在我的测试中安装...
public function testRoute()
{
$this->visit('/');
//stuck here
}
Run Code Online (Sandbox Code Playgroud)
基本上我很期待测试刀片有<contact-form>.我该怎么办?
我已经有了一个表名,table_one.现在我想再添加两列。到目前为止一切正常。但是在我的方法中,我想检查表中是否存在某列,例如dropIfExists('table').
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('table_one', function (Blueprint $table) {
$table->string('column_one')->nullable();
$table->string('column_two')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('table_one', function (Blueprint $table) {
// in here i want to check column_one and column_two exists or not
$table->dropColumn('column_one');
$table->dropColumn('column_two');
});
}
Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用 Guzzle 并学习解决它的方法,但我对将请求与空值或空值结合使用感到有些困惑。
例如:
$response = $client->request('POST',
'https://www.testsite.com/coep/public/api/donations', [
'form_params' => [
'client' => [
'web_id' => NULL,
'name' => 'Test Name',
'address1' => '123 E 45th Avenue',
'address2' => 'Ste. 1',
'city' => 'Nowhere',
'state' => 'CO',
'zip' => '80002'
],
'contact' => [],
'donation' => [
'status_id' => 1,
'amount' => $donation->amount,
'balance' => $donation->balance,
'date' => $donation->date,
'group_id' => $group->id,
],
]
]);
Run Code Online (Sandbox Code Playgroud)
运行测试后,我发现'web_id'如果设置为 NULL ,则完全从我的请求中消失。我的问题是我如何确保它与我的条件一起使用的请求保持一致?
在这一点上,如果我 dd $request->client,我得到的只是除web_id. 谢谢!
我目前已经实现了一个在创建模型时触发的事件:
protected $dispatchesEvents = [
'created' => EvaluationRequestForZ0UQ0::class
];
Run Code Online (Sandbox Code Playgroud)
没什么特别的,工作正常。但我想使用多个参数调用模型创建事件。像这样的东西:
protected $dispatchesEvents = [
'created' => event(new EvaluationRequestForZ0UQ0(User $param1, Job $param2))
];
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?也许我的做法是错误的。如果是这样,请随时告诉我另一种方法。
我在 User 和 Message 之间创建了模型关系。我想为经过身份验证的用户实现消息列表,但出现以下错误。
方法 Illuminate\Database\Eloquent\Collection::links 不存在
控制器
public function index()
{
$user_id = auth()->user()->id;
$user = User::find($user_id);
return view('message.index')->with('messages', $user->message);
}
Run Code Online (Sandbox Code Playgroud)
消息提供者
class message extends Model
{
public function user() {
return $this->belongsTo('App\User');
}
}
Run Code Online (Sandbox Code Playgroud)
用户提供者
public function message ()
{
return $this->hasMany('App\Message');
}
Run Code Online (Sandbox Code Playgroud)
index.blade.php
@extends('layouts.app')
@section('content')
<h1>messages</h1>
@if(count($messages)>0)
@foreach ($messages as $message)
<div class="well">
<h3><a href="/message/{{$message->id}}">{{$message->user}}</a></h3>
<small>Written on {{$message->created_at}} </small>
</div>
@endforeach
{{$messages->links()}}
@else
<p> no post found </p>
@endif
@endsection
Run Code Online (Sandbox Code Playgroud)
错误
“方法Illuminate\Database\Eloquent\Collection::links 不存在。(查看:C:\xampp\htdocs\basicwebsite\resources\views\message\index.blade.php)”
最近,我们将 Laravel 应用程序从 5.6 升级到 Laravel 8.18.1。我们在RouteServiceProvider.php中使用cookie解密。
HomeController.php
Cookie::queue("频道", "移动", 60 24 1); // 通道加密值 = eyJpdiI6IjJVTGFzZHdEOXpjMk9VTGFFYmlSbXc9PSIsInZhbHVlIjoid0djMW9zbThWOXFQTk5aVXBDNmJBdz09IiwibWFjIjoiZGM4M2U1YTY0ZjVkNTE4NjBlNzg4NTZiNzhkNjdjYzcyODU zZWU1ZWMzNjdkNGNlMTgyZGIwNmQ4NjYzOWM3MSJ9
在 Laravel 5.6 中,它直接将哈希值解密为值。
路由服务提供商.php
$encrypter = app(\Illuminate\Contracts\Encryption\Encrypter::class);
$channel_cookie = $encrypter->decrypt(Cookie::get('channel')); // result "mobile"
Run Code Online (Sandbox Code Playgroud)
在 Laravel 8.18.1 中,它将哈希值解密为带有竖线的值。
路由服务提供商.php
$encrypter = app(\Illuminate\Contracts\Encryption\Encrypter::class);
$channel_cookie = $encrypter->decrypt(Cookie::get('channel')); // result "a86aa854d5e61e2873acd30373b6725e36fba671|mobile"
$channel_cookie = explode("|",$channel_cookie)[1]; // result mobile
Run Code Online (Sandbox Code Playgroud)
这是在 Laravel 8 中解密 cookie 的安全解决方案吗?
我在 Laravel 5 Blade/Bootstrap 应用程序中使用了laravelcollective/html包,现在我发现不支持 Laravel 8。你能建议一些与 Laravel 8 或这个库兼容的类似的东西吗?
如何处理将多个 .css 和 .js 文件混合到一个文件中(laravel mix迄今为止一直这样做)。
新的Laravel 9安装了Vite.js,并删除了laravel mix。由于我们最常使用laravel mix的主要功能是将 /resource 文件夹中的文件混合到 /public 文件夹中(许多文件合并为一个)。你是如何处理这个问题的,或者你还在使用 laravel mix 和 Vite 吗?
laravel ×9
php ×6
laravel-5 ×2
laravel-8 ×2
encryption ×1
guzzle ×1
html ×1
image ×1
laravel-4 ×1
laravel-5.7 ×1
laravel-9 ×1
laravel-mail ×1
laravel-vite ×1
sql ×1
vite ×1
vue.js ×1
vuejs2 ×1