注销时出现错误,它向我显示此错误...“此路由不支持 GET 方法。支持的方法:POST。” 请帮我解决这个问题..
这是我的代码...
@if(Auth::check())
<li><i class="fa fa-user"></i> {{Auth::user()->name}}:
<a href="{{url('logout')}}">logout</a>
</li>
@else
<li>
<a href="{{route('login')}}"><i class="fa fa-user"></i>Login</a>
</li>
@endif
Run Code Online (Sandbox Code Playgroud) $ composer create-project --prefer-dist laravel/laravel="5.8.*" larastart
Run Code Online (Sandbox Code Playgroud)
它不起作用,我也尝试了其他一些方法,但对我不起作用
这是我得到的错误:
内容长度不匹配,收到 188377 字节超出预期 620920 repo.packagist.org 无法完全加载,包信息已从本地缓存加载,可能已过期
OS Name Microsoft Windows 10 Home Single Language
Version 10.0.18363 Build 18363
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-7CV9HTK
System Manufacturer HP
System Model HP ENVY Laptop 13-ah1xxx
System Type x64-based PC
System SKU 5HZ05PA#AKL
Processor Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz, 1992 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date Insyde F.12, 11/8/2018
SMBIOS Version 3.0
Embedded Controller Version 69.72 …Run Code Online (Sandbox Code Playgroud) 我有一个新的 Laravel 6,我尝试使用 Laravel 表单,但我收到错误消息“找不到类‘表单’”。
我尝试了以下但仍然无法正常工作:
1)。将此添加到 composer.json
"require": {
"laravelcollective/html": "~6.0"
}
Run Code Online (Sandbox Code Playgroud)
2)。从终端更新作曲家:
composer update
Run Code Online (Sandbox Code Playgroud)
3)。将此添加到 config/app.php 的提供者中:
'providers' => [
// ...
'Collective\Html\HtmlServiceProvider',
// ...
],
Run Code Online (Sandbox Code Playgroud)
4)。最后,在 config/app.php 的 aliases 数组中添加两个类别名:
'aliases' => [
// ...
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
// ...
],
Run Code Online (Sandbox Code Playgroud)
请给出建议,因为它仅适用于 Laravel 5.8。
我正在使用 Maatwebsite Excel 3.1 来实现导出功能。我们如何设置单元格的背景颜色和标题的字体大小?您能帮我解决这个问题吗?
谢谢你!
类别表
产品表
我想创建与类别表的关系 ->id 与产品表category_id 建议对此关系 数组与整数列关系的任何想法
控制器
Products::with('category')->get();
Run Code Online (Sandbox Code Playgroud)
产品型号
public function category() {
return $this->hasMany(App\Models\Categories::class, 'id', 'category_id');
}
Run Code Online (Sandbox Code Playgroud)
类别型号
public function product() {
return $this->belongsTo(Products::class,'category_id', 'id');
}
Run Code Online (Sandbox Code Playgroud) 我在 Laravel 6.6 中创建了一个具有以下定义的表。
public function up()
{
Schema::create('quarters', function (Blueprint $table) {
$table->integer('quarter_id')->unsigned();
$table->integer('year')->unsigned();
$table->integer('quarter_num')->unsigned();
$table->timestamp('valid_from');
$table->timestamp('valid_to'); // <------ error on this line
$table->string('description')->nullable();
$table->timestamps();
$table->primary('quarter_id');
});
}
Run Code Online (Sandbox Code Playgroud)
当我运行迁移命令时,出现以下错误。
Illuminate\Database\QueryException : SQLSTATE[42000]:语法错误或访问冲突:1067 'valid_to' 的默认值无效(SQL:创建表
quarters(quarter_idint unsigned not null、yearint unsigned not null、quarter_numint unsigned not null、valid_fromtimestamp not null、valid_to时间戳不为空、descriptionvarchar(255) 为空、created_at时间戳为空、updated_at时间戳为空) 默认字符集 utf8mb4 collate 'utf8mb4_unicode_ci')
这是 Eloquent 生成的 SQL:
CREATE TABLE `quarters`(
`quarter_id` INT UNSIGNED NOT …Run Code Online (Sandbox Code Playgroud) 我想在我的 Laravel 项目中安装 Chart.js。使用 npm install(Webpack 的配置),并查看我的索引页和一些 Chart.js 示例。在我第一次尝试时,我在浏览器中收到此错误。也许我没有正确配置 webpack?
未捕获的引用错误:图表未定义于(索引):134
因此,我复制并粘贴了在 Chart.js 文档集成中找到的此要求。
require(['path/to/chartjs/dist/Chart.min.js'], function(Chart){
var myChart = new Chart(ctx, {...});
});
Run Code Online (Sandbox Code Playgroud)
我在 上遇到了这个错误npm run dev。
./resources/js/app.js 中的错误模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):语法错误:/home/sa/laravelproject/resources/js/app.js:意外的标记(37:37)
35 | 35 36 | 36 需要(['路径/到/chartjs/dist/Chart.min.js'],函数(图表){
37 | 37 var myChart = new Chart(ctx, {...}); | ^ 38 | });
目前我的文件中有这 4 条资源丰富的路线web.php。
Route::resource('campaigns', 'CampaignController')->except(['show']);
Route::resource('users', 'UserController')->except(['show']);
Route::resource('models', 'ModelController')->except(['show']);
Route::resource('trims', 'TrimController')->except(['show']);
Run Code Online (Sandbox Code Playgroud)
我不禁想知道。我不能向该Route::resources函数添加一些内容以使其表现出这种方式吗?这是因为它们都有一个共同点。他们的except()方法show()。
它想要有这样的东西。(这个例子不起作用,因为resources()没有except()方法。
Route::resources([
'campaigns' => 'CampaignController',
'users' => 'UserController',
'models' => 'ModelController',
'trims' => 'TrimController'
])->except(['show']);
Run Code Online (Sandbox Code Playgroud) 我的控制器中有以下代码,我试图在其中加载所有“成员”。每个成员可以有多个电话号码。电话号码存储在一个名为的表中phone_numbers,并与用户 ID 相关联。下面,我正在尝试加载为每个成员存储的最后一个电话号码。注意,用户在手机上有 hasMany 关系。
用户名
public function phone()
{
return $this->hasMany('App\Model\PhoneNumber');
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的:
$members = \App\Model\User::all();
$members->load('phone');
Run Code Online (Sandbox Code Playgroud)
我很感激有关如何实现这一目标的任何建议。
laravel-6 ×10
laravel ×6
php ×5
eloquent ×4
laravel-5.8 ×2
chart.js ×1
foreign-keys ×1
laravel-5 ×1
laravel-5.7 ×1
mariadb ×1
orm ×1
routes ×1