控制器Laravel 5中的例外情况

时间:2015-06-17 16:37:01

标签: php laravel-5

我无法理解代码中的错误:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Input;
use Redirect;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class PostsController extends Controller
{

   public function getIndex()
   {
     $posts = \App\Models\Post::with('Author')->orderBy('id')->get();
     return view('ind')->with('posts',$posts);
   }

   public function getAdmin()
   {
     return view('addpost');
   }

   public function postAdd()
   {
     \App\Models\Post::create(array(
             'title' => Input::get('title'),
             'content' => Input::get('content'),
             'author_id' => Auth::user()->id
     ));
     return Redirect::route('ind');
   }
}

它返回错误:

> FatalErrorException in PostsController.php line 20: syntax error,
> unexpected 'public' (T_STRING), expecting function (T_FUNCTION). In
> line 20 there is the declaration of getadmin() function

所以我不明白为什么它告诉我期待功能。

0 个答案:

没有答案