• “黑神话·悟空”免安装在线玩,无视显卡等硬件要求!!
  • √ 游戏免下载安装 √ 5分钟随开随玩 √ 关机不计费!低至¥14.90/月!
🔥进入竞技-直面天命🔥

<?php

时间2023-03-20 15:57:24 提问来自 辽宁省沈阳市 的网友 分类创作 浏览403
namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Category; use App\Models\Product; class HomeController extends Controller { /** * Create a new controller instance. * Only guests are able to access the home page. The user is redirected to the dashboard if logged in. * @return void */ public function __construct() { $this->middleware('guest'); //redirects users who are logged in from accessing the home page. They will be redirected to their dashboard page instead. } /** * Show the application dashboard. * @return \Illuminate\Contracts\Support\Renderable */ public function index() { //this is the default index method for this controller - it will show when a user visits '/' in their browser and they are not logged in (guests) $categories = Category::all(); //fetch all categories from DB and assign them to variable so they can be used on view file (home.blade) - see line 18 of home/index blade file for more info on how this works return view('home', compact('categories')); //pass categories variable into view file (home) so they can be used on that page - see line 18 of home/index blade file for more info on how this works } }

点击这里,进行内容创作

创作工场 免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。
点击这里>>使用🔥专业版,更聪明、更完整、更原创!

上一篇 修复下这个PHP代码 下一篇 高技术在军事上的应用