1

when i executing php artisan make:controller Test command in laravel 5 i am getting below blueprint

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

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

class Test extends Controller
{
    //
}

But Documentation said we should get skeleton with RESTful methods

 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)
{
    //
}

}

So what is wrong in my case . how to get what exactly RESTful Resource Controllers should be ?

1 Answer 1

1

I think you have to add --resource option at the end of this command to generate a RESTful controller. Following the official laravel docs, your command should be like this:

php artisan make:controller Test --resource
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.