当我想详细查看我的物品Laravel时,连接受到保护

发布于 2025-02-09 04:59:05 字数 561 浏览 0 评论 0原文

我在Laravel 9上,我的数据库和我的元素要详细看到,但是当我想看到它时,它向我展示了这一点(当我想显示所有元素时,我会看到它)

控制器

public function show(Tickets $tickets)
{
    var_dump($tickets);
    return view('tickets.show', ['ticket' => $tickets]);
}

模型

class Tickets extends Model
{
use HasFactory, SoftDeletes;




protected $fillable = [
    'title',
    'description',
    'status',
    'priority',
    'type',
    'assigned_to',
];

}

路由

Route::get('oauth', [gCalendarController::class, 'oauth']);

I am on laravel 9, I have my database with my element that I want to see in detail but it shows me this when I want to see it, (I see it when I want to display all the elements)

error message

Controller

public function show(Tickets $tickets)
{
    var_dump($tickets);
    return view('tickets.show', ['ticket' => $tickets]);
}

Models

class Tickets extends Model
{
use HasFactory, SoftDeletes;




protected $fillable = [
    'title',
    'description',
    'status',
    'priority',
    'type',
    'assigned_to',
];

}

Routes

Route::get('oauth', [gCalendarController::class, 'oauth']);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2025-02-16 04:59:05

我认为您返回了@lagbox评论的门票模型的对象。

如果您想在访问show()函数时获得所有机票,则需要这样做:

public function show(Tickets $tickets)
{
    // Get all the ticket
    $ticket = $tickets->all();

    return view('tickets.show', compact('ticket'));
}

希望这是有帮助的。

I think you returned the object of Tickets Model like @lagbox commented.

If you want to get all ticket when accessing to show() function, you need to do like this:

public function show(Tickets $tickets)
{
    // Get all the ticket
    $ticket = $tickets->all();

    return view('tickets.show', compact('ticket'));
}

Hope this help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文