You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel Blade视图出现Trying to access array offset on null错误求助

部署到服务器后Laravel视图报错,本地正常,求排查

本地开发环境运行完全正常,但部署到服务器后出现错误,已经卡了快4小时。错误详情记录在FlareApp中。

控制器代码:

public function readBlog($slug, Request $request)
{
    // Update job count views
    $blogView = blog::where('slug', $slug)->with('user', 'image', 'file', 'categories', 'subcategories')->first();
    $blogView->views += 1;
    $blogView->save();

    $blogGet = blog::where('userid', $blogView->user->id)->orderBy('views', 'DESC')->with('image')->limit(3)->get();
    return view('home.read-blog', ['blogs' => $blogView, 'blogArr' => $blogGet]);
    // return response()->json($blogView);
}

Blade视图代码:

@extends('welcome')
@section('title', $blogs->seo_title ?? $blogs->title)
@section('page_description', $blogs->seo_description)
@section('page_keywords', 'blog boxity, boxity, boxityerp, realizeboxity, boxity central
indonesia, erp boxity, warehouse management, human resources management, financial management, boxity warehouse, boxity
WMS, boxity financial, boxity indonesia, news from boxity')
@section('tag_cover',$blogs->image->file)
@section('content')
<section id="single-post" class="wide-100 inner-page-hero single-post-section division">
    <div class="container">
       blablabla
    </div>
</section>

恳请帮忙排查问题,感谢!

内容的提问来源于stack exchange,提问作者Bin Ski.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 21:27:12