Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
other minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitulgolakiya committed May 23, 2015
1 parent 5f6964f commit 7b6fc43
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/Mitul/Generator/Templates/API/ControllerRepo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use $MODEL_NAMESPACE$;
use Illuminate\Http\Request;
use $REPO_NAMESPACE$\$MODEL_NAME$Repository;
use Response;
use Schema;

class $MODEL_NAME$APIController extends AppBaseController
{
Expand All @@ -22,6 +23,8 @@ class $MODEL_NAME$APIController extends AppBaseController
/**
* Display a listing of the $MODEL_NAME$.
*
* @param Request $request
*
* @return Response
*/
public function index(Request $request)
Expand All @@ -36,23 +39,23 @@ class $MODEL_NAME$APIController extends AppBaseController
}

public function search($input)
{
$query = $MODEL_NAME$::query();

$columns = Schema::getColumnListing('$TABLE_NAME$');
$attributes = array();
{
$query = $MODEL_NAME$::query();

foreach($columns as $attribute){
if(isset($input[$attribute]))
{
$query->where($attribute, $input[$attribute]);
}
};

return $query->get();
$columns = Schema::getColumnListing('$TABLE_NAME$');
$attributes = array();

foreach($columns as $attribute)
{
if(isset($input[$attribute]))
{
$query->where($attribute, $input[$attribute]);
}
}

return $query->get();
}

/**
* Show the form for creating a new $MODEL_NAME$.
*
Expand Down Expand Up @@ -150,5 +153,4 @@ class $MODEL_NAME$APIController extends AppBaseController

return Response::json(ResponseManager::makeResult($id, "$MODEL_NAME$ deleted successfully."));
}

}
2 changes: 2 additions & 0 deletions src/Mitul/Generator/Templates/Scaffold/ControllerRepo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class $MODEL_NAME$Controller extends AppBaseController
/**
* Display a listing of the $MODEL_NAME$.
*
* @param Request $request
*
* @return Response
*/
public function index(Request $request)
Expand Down

0 comments on commit 7b6fc43

Please sign in to comment.