Skip to content

Commit

Permalink
Merge branch '5.6' of https://github.com/OzairP/framework into OzairP…
Browse files Browse the repository at this point in the history
…-5.6
  • Loading branch information
taylorotwell committed Feb 3, 2018
2 parents 1f902c8 + 8628885 commit e5fa9e4
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Illuminate/Routing/Console/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,23 @@ class ControllerMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
$stub = null;

if ($this->option('parent')) {
return __DIR__.'/stubs/controller.nested.stub';
$stub = '/stubs/controller.nested.stub';
} elseif ($this->option('model')) {
return __DIR__.'/stubs/controller.model.stub';
$stub = '/stubs/controller.model.stub';
} elseif ($this->option('resource')) {
return __DIR__.'/stubs/controller.stub';
$stub = '/stubs/controller.stub';
}

if ($this->option('api') && $stub !== null) {
$stub = substr_replace($stub, '.api', -5, 0);
}

return __DIR__.'/stubs/controller.plain.stub';
$stub = $stub ?? '/stubs/controller.plain.stub';

return __DIR__.$stub;
}

/**
Expand Down Expand Up @@ -167,6 +175,8 @@ protected function getOptions()
['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'],

['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'],

['api', 'a', InputOption::VALUE_NONE, 'Generate api resource methods only for a controller class.'],
];
}
}
64 changes: 64 additions & 0 deletions src/Illuminate/Routing/Console/stubs/controller.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace DummyNamespace;

use Illuminate\Http\Request;
use DummyRootNamespaceHttp\Controllers\Controller;

class DummyClass extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

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

/**
* 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)
{
//
}
}
65 changes: 65 additions & 0 deletions src/Illuminate/Routing/Console/stubs/controller.model.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace DummyNamespace;

use DummyFullModelClass;
use Illuminate\Http\Request;
use DummyRootNamespaceHttp\Controllers\Controller;

class DummyClass extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* 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 \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function show(DummyModelClass $DummyModelVariable)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function update(Request $request, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function destroy(DummyModelClass $DummyModelVariable)
{
//
}
}
71 changes: 71 additions & 0 deletions src/Illuminate/Routing/Console/stubs/controller.nested.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

namespace DummyNamespace;

use DummyFullModelClass;
use ParentDummyFullModelClass;
use Illuminate\Http\Request;
use DummyRootNamespaceHttp\Controllers\Controller;

class DummyClass extends Controller
{
/**
* Display a listing of the resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @return \Illuminate\Http\Response
*/
public function index(ParentDummyModelClass $ParentDummyModelVariable)
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @return \Illuminate\Http\Response
*/
public function store(Request $request, ParentDummyModelClass $ParentDummyModelVariable)
{
//
}

/**
* Display the specified resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function show(ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function destroy(ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}
}

0 comments on commit e5fa9e4

Please sign in to comment.