laravel 5中的控制器RESTful方法

时间:2016-03-19 07:38:50

标签: laravel-5

当我在laravel 5执行php artisan make:controller测试命令时 我正在低于蓝图

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class Test extends Controller
{
    //
}

但文档说我们应该使用RESTful方法获得骨架

 class Test extends BaseController {

/**
 * Display a listing of the resource.
 *
 * @return Response
 */
public function index()
{
    //
}

/**
 * Show the form for creating a new resource.
 *
 * @return Response
 */
public function create()
{
    //
}

/**
 * Store a newly created resource in storage.
 *
 * @return Response
 */
public function store()
{
    //
}

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function show($id)
{
    //
}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
public function edit($id)
{
    //
}

/**
 * Update the specified resource in storage.
 *
 * @param  int  $id
 * @return Response
 */
public function update($id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return Response
 */
public function destroy($id)
{
    //
}

}

所以我的情况出了什么问题。如何获得RESTful资源控制器应该是什么?

1 个答案:

答案 0 :(得分:1)

我认为您必须在此命令的末尾添加TRISC6 = 1; \\ set in datasheet TRISC7 = 1; \\ set in datasheet SPBRG1=25; \\ 4 MHz oscilator SPBRGH1=0; TXSTA1bits.BRGH = 1; \\ high speed uart BAUDCON1bits.BRG16 = 0; \\ 8 bit data TXSTA1bits.TX9 = 0; TXSTA1bits.SYNC = 0; \\ asynchronus mode RCSTA1bits.SPEN = 1; \\ enable serial port INTCONbits.GIE = 0; \\ set off interrupt TXSTA1bits.TXEN = 1; \\ transmitter is enabled while (1) { TXSTA1bits.TXEN = 1; //UART_Write_Text("Bye pic \n"); TXREG = 76; __delay_ms(100); TXSTA1bits.TXEN = 0; } 选项以生成RESTful控制器。在official laravel docs之后,您的命令应该是这样的:

--resource