0
我有兩種方法顯示和指數 我對指數方法的項目列表,當用戶點擊它帶她到包含另一個頁面加載顯示方法的內容laravel上的索引方法一些屬於該ID的數據。而不是這樣做我想用jQuery來實現這一點,使數據加載在同一頁面上。我有我的看法index.blade.php下面,請我如何在laravel實現這一如何使用jQuery
@foreach ($categories as $category)
<div class="body">
<h4><a style="text-decoration: none; " href="{{ URL::route('category.show', $category->id) }}">{{$category->name}}</a></h4>
</div>
@endforeach
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use illuminate\HttpResponse;
use App\Http\Requests\todolistRequest;
use App\Http\Requests\CreateCategoryRequest;
use App\Http\Requests;
use App\Companylist;
use App\Category;
use Illuminate\Support\Facades\DB;
class CategoryController extends Controller
{
public function create(){
return view('category.create');
}
public function index(){
$categories=Category::all();
return view('category.index',compact('categories'));
}
public function store(CreateCategoryRequest $request){
$category = new Category($request->all());
$category->save();
return \Redirect::route('category.create')->with('message', 'Your list has been created!');
}
public function show($id)
{
$category = Category::findOrFail($id)->companylist()->get();
$cat=Category::findOrFail($id);
// this my route
Route::resource('category','CategoryController');
return view('category.show')->with('category', $category)->with('cat',$cat);
}
//
}
顯示你的控制器代碼和路線 –
AV更新闕@ ARIF MAHMUD RANA –
阿里夫,您能有所幫助,AV更新我的AV做到了這一點利用正常程序PHP的問題 –