最近在使用laravel的过程中
出现以下错误
Whoops, looks like something went wrong. Property [id] does not exist on this collection instance.
经过认真调试发现是关联关系的问题
简单说来取的是二维集合的属性,于是报错
解决办
在thinkphp框架
我们可以通过getLastSql输出查询的SQL语句
那么在laravel中如何实现
```
$list = (new Admin())->setTable('admin')->from('hl_admin as admin')->join('hl_t_admin as h','admin.id','=','h.t
我们知道laravel软删除的功能很好用
model软删除字段名修改
```
use Illuminate\Database\Eloquent\Builder;
public static function bootSoftDeletes()
{
static::addGlobalScope('dele
laravel 验证器 Validator::make只显示第一个错误
以下为方法
```
public function index(Request $request)
{
if ($request->isMethod('post')){
$validator = Validator::make($request->a
//获取父类所有的子类
public static function getAllChild($array,$id){
$array = SalesCatalog::select('id','parent_id')->where('parent_id',$id)->get()->toArray();
$arr =
在laravel框架中如何使用验证码
以下为详细的步骤
执行命令
```
composer require gregwar/captcha
```
创建控制器
```
use Gregwar\Captcha\CaptchaBuilder;
use Gregwar\Captcha\PhraseBuilder;
use C
laravel框架执行sql语句group by出错
`Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'product.id' which is not functionally dependent on columns
我们知道laravel中软删除使用起来很方便
最近在使用的过程中碰到一些问题
主要是联名查询
提示名的deleted_at字段不存在
```
$list = (new Admin())->setTable('admin')->from('hl_admin as admin')->join('hl_tenant_admin as h'
在日常的数据库查询中,我们经常用到in
比如
`select *from user where id in(1,3,2)`
有没有办法实现,按照1,3,2的顺序来排序
只需要
`select *from user where id in(1,3,2) order by field(id,1,3,2)`
在laravel中如
https://learnku.com/articles/20990https://www.codercto.com/a/12153.html<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Post;
use App\Markdown\Markdown;