Помогите мне, я пытаюсь разместить на своей странице некоторую разбивку на страницы, но продолжаю показывать эту ошибку Вызов неопределенного метода App \ Product :: link ()
мой код
Blade:
Контроллер:
<?php
пространство имен App \ Http \ Controllers;
используйте Illuminate \ Http \ Request; use App \ Product;
class ProductController extends Controller {/ ** * Отображение списка ресурса. * * @return \ Illuminate \ Http \ Response * / publi c function index ()
{
$products = Product::orderBy('name')->paginate(10);
return view('show')->with('products', $products);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'name' =>'required | unique:product|max:64',
'description' => 'required',
'price' => 'required',
]);
print_r($request->input());
$product = new Product;
$product->name = $request->name;
$product->description = $request->description;
$product->price = $request->price;
echo $product->save();
return redirect('/home');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
web. php:
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::resource('home', 'ProductController');
Route::get('profile', 'UserController@profile')->middleware('auth');
Route::post('profile', 'UserController@update_avatar')->name('profile');
Route::view('create', 'create')->middleware('auth');
Route::post('submit', 'ProductController@store');