我怎么能從數據庫created_data,在laravel中雄辯?,我使用的屬于許多關系,我想顯示借閱的書籍數據和借入的日期,我已經成功顯示了借閱的書籍數據,但我無法從數據庫中的另一個表中獲取created_at數據,名為borrow_history書.phppublic function borrowed(){ return $this->belongsToMany(User::class, 'borrow_history') ->withTimestamps();}用戶.phppublic function borrow(){ return $this->belongsToMany(Book::class, 'borrow_history') ->withTimestamps();}這是我目前的HomeController.php索引public function index(){ $books = auth()->user()->borrow; return view('home', [ 'books' => $books, ]);}我想在home.blade上顯示created_at數據.php@foreach($borrow_history as $borrow) <p> <i class="material-icons">date_range</i> Borrow_date : {{ ???? }} </p>@endforeach任何人都可以幫我嗎?
- 1 回答
- 0 關注
- 130 瀏覽
添加回答
舉報
0/150
提交
取消