index.blade.php
@extends('layout')
@section('content')
<h1>文章列表</h1>
@foreach($articles as $value)
<h2><a href=" { action('ArticleController@show',[$value->id]) } "> { $value->title } </a></h2>
<h3> { $value->intro } </h3>
@endforeach
@stop
ArticleController.php
<?php
namespace App\Http\Controllers;
use App\Article;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ArticleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$articles = Article::all();
return view('article.index',compact('articles'));
}
/**
* Show the form for creating a new resource.
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$articles = Article::findOrfail($id);
return $articles;
}
/**
* 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)
{
//
}
}
ErrorException in UrlGenerator.php line 558:
Action App\Http\Controllers\ArticleController@show not defined. (View: F:\www\stlv\resources\views\article\index.blade.php)
那里错了。