Completed
Push — master ( 63d8d6...28be9d )
by Raphael
11:25
created
stubs/Api/Controller/FileController.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -15,56 +15,56 @@
 block discarded – undo
15 15
 
16 16
 class {{class_name}}Controller extends Controller
17 17
 {
18
-	// blade views
19
-	// index view
18
+    // blade views
19
+    // index view
20 20
 
21
-	public function show($id)
22
-	{
23
-		$file = {{class_name}}Model::find($id);
24
-		return $file ;
25
-	}
21
+    public function show($id)
22
+    {
23
+        $file = {{class_name}}Model::find($id);
24
+        return $file ;
25
+    }
26 26
 
27
-	public function upload()
28
-	{
29
-		$config = new FlowConfig();
30
-		$config->setTempDir(storage_path() . '/tmp');
31
-		$config->setDeleteChunksOnSave(true);
27
+    public function upload()
28
+    {
29
+        $config = new FlowConfig();
30
+        $config->setTempDir(storage_path() . '/tmp');
31
+        $config->setDeleteChunksOnSave(true);
32 32
 
33
-		$request = new FlowRequest();
33
+        $request = new FlowRequest();
34 34
 
35
-		$totalSize = $request->getTotalSize();
35
+        $totalSize = $request->getTotalSize();
36 36
 
37
-		if ($totalSize && $totalSize > (1024 * 1024 * 4))
38
-		{
39
-			return $this->responseWithError('File size exceeds 4MB');
40
-		}
37
+        if ($totalSize && $totalSize > (1024 * 1024 * 4))
38
+        {
39
+            return $this->responseWithError('File size exceeds 4MB');
40
+        }
41 41
 
42
-		$requestFile = $request->getFile();
42
+        $requestFile = $request->getFile();
43 43
 
44
-		$file = new ScaffolderFile($config, $request);
44
+        $file = new ScaffolderFile($config, $request);
45 45
 
46
-		if ($file->validateChunk()) {
47
-			$file->saveChunk();
48
-		}
46
+        if ($file->validateChunk()) {
47
+            $file->saveChunk();
48
+        }
49 49
 
50
-		if ($file->save(storage_path() . '/tmp/' .  $request->getFileName()))
51
-		{
52
-			$file = FileModel::create([
53
-				'mime_type' => $requestFile['type'],
54
-				'size' => $requestFile['size'],
55
-				'file_path' => storage_path() . '/tmp/',
56
-				'filename' => $requestFile['name'],
57
-				'disk' => 'local',
58
-				'status' => false,
59
-			]);
50
+        if ($file->save(storage_path() . '/tmp/' .  $request->getFileName()))
51
+        {
52
+            $file = FileModel::create([
53
+                'mime_type' => $requestFile['type'],
54
+                'size' => $requestFile['size'],
55
+                'file_path' => storage_path() . '/tmp/',
56
+                'filename' => $requestFile['name'],
57
+                'disk' => 'local',
58
+                'status' => false,
59
+            ]);
60 60
 
61
-			return $file->id;
62
-		}
63
-		else
64
-		{
65
-			// Indicate that we are not done with all the chunks.
66
-			return null;
67
-		}
68
-	}
61
+            return $file->id;
62
+        }
63
+        else
64
+        {
65
+            // Indicate that we are not done with all the chunks.
66
+            return null;
67
+        }
68
+    }
69 69
 
70 70
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Http\Request;
6 6
 use Illuminate\Pagination\Paginator;
7 7
 use App\Http\Controllers\Controller;
8
-use App\Models\{{class_name}} as {{class_name}}Model;;
8
+use App\Models\{{class_name}} as {{class_name}}Model; ;
9 9
 use App\Http\Controllers\File as ScaffolderFile;
10 10
 use Log;
11 11
 use Flow\Config as FlowConfig;
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	public function show($id)
22 22
 	{
23 23
 		$file = {{class_name}}Model::find($id);
24
-		return $file ;
24
+		return $file;
25 25
 	}
26 26
 
27 27
 	public function upload()
28 28
 	{
29 29
 		$config = new FlowConfig();
30
-		$config->setTempDir(storage_path() . '/tmp');
30
+		$config->setTempDir(storage_path().'/tmp');
31 31
 		$config->setDeleteChunksOnSave(true);
32 32
 
33 33
 		$request = new FlowRequest();
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 			$file->saveChunk();
48 48
 		}
49 49
 
50
-		if ($file->save(storage_path() . '/tmp/' .  $request->getFileName()))
50
+		if ($file->save(storage_path().'/tmp/'.$request->getFileName()))
51 51
 		{
52 52
 			$file = FileModel::create([
53 53
 				'mime_type' => $requestFile['type'],
54 54
 				'size' => $requestFile['size'],
55
-				'file_path' => storage_path() . '/tmp/',
55
+				'file_path' => storage_path().'/tmp/',
56 56
 				'filename' => $requestFile['name'],
57 57
 				'disk' => 'local',
58 58
 				'status' => false,
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@
 block discarded – undo
59 59
 			]);
60 60
 
61 61
 			return $file->id;
62
-		}
63
-		else
62
+		} else
64 63
 		{
65 64
 			// Indicate that we are not done with all the chunks.
66 65
 			return null;
Please login to merge, or discard this patch.
stubs/Api/Controller/Controller.php 3 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 
15 15
 class {{class_name}}Controller extends Controller
16 16
 {
17
-	// blade views
18
-	// index view
19
-	public function index()
20
-	{
21
-		return view('{{class_name_lw}}.index');
22
-	}
23
-	// create view
24
-	public function create()
25
-	{
26
-		return view('{{class_name_lw}}.create');
27
-	}
28
-
29
-	// edit view
30
-	public function edit($id)
31
-	{
32
-		${{class_name_lw}} = {{class_name}}::find($id);
33
-
34
-		return view('{{class_name_lw}}.edit')->with('model', ${{class_name_lw}});
35
-	}
36
-
37
-	// api resources
17
+    // blade views
18
+    // index view
19
+    public function index()
20
+    {
21
+        return view('{{class_name_lw}}.index');
22
+    }
23
+    // create view
24
+    public function create()
25
+    {
26
+        return view('{{class_name_lw}}.create');
27
+    }
28
+
29
+    // edit view
30
+    public function edit($id)
31
+    {
32
+        ${{class_name_lw}} = {{class_name}}::find($id);
33
+
34
+        return view('{{class_name_lw}}.edit')->with('model', ${{class_name_lw}});
35
+    }
36
+
37
+    // api resources
38 38
 	
39
-	// save {{class_name_lw}}
40
-	/*public function store(Request $request)
39
+    // save {{class_name_lw}}
40
+    /*public function store(Request $request)
41 41
 	{
42 42
 		// validate {{class_name_lw}} and eager objects
43 43
 		$this->validate($request, $this->getRules());
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
 		return ${{class_name_lw}} ;
56 56
 	}*/
57 57
 
58
-	// save {{class_name_lw}}
59
-	public function store(Request $request)
60
-	{
61
-		// validate {{class_name_lw}} and eager objects
62
-		$this->validate($request, $this->getRules());
58
+    // save {{class_name_lw}}
59
+    public function store(Request $request)
60
+    {
61
+        // validate {{class_name_lw}} and eager objects
62
+        $this->validate($request, $this->getRules());
63 63
 		
64
-		$model = new {{class_name}}();
64
+        $model = new {{class_name}}();
65 65
 
66
-		${{class_name_lw}} = $model->store($request);
66
+        ${{class_name_lw}} = $model->store($request);
67 67
 
68
-		return ${{class_name_lw}};
69
-	}
68
+        return ${{class_name_lw}};
69
+    }
70 70
 
71
-	/*// update {{class_name_lw}} by id
71
+    /*// update {{class_name_lw}} by id
72 72
 	public function update($id, Request $request)
73 73
 	{
74 74
 		// get vars
@@ -89,45 +89,45 @@  discard block
 block discarded – undo
89 89
 		{{relationship_tables_call}}
90 90
 		return ${{class_name_lw}};
91 91
 	}*/
92
-	public function update($id, Request $request)
93
-	{
94
-		// validate {{table_name}} and eager objects
95
-		$this->validate($request, $this->getRules($id));
92
+    public function update($id, Request $request)
93
+    {
94
+        // validate {{table_name}} and eager objects
95
+        $this->validate($request, $this->getRules($id));
96 96
 		
97
-		$model = new {{class_name}}();
98
-		${{class_name_lw}} = $model->updateModel($id, $request);
97
+        $model = new {{class_name}}();
98
+        ${{class_name_lw}} = $model->updateModel($id, $request);
99 99
 
100
-		return ${{class_name_lw}};
101
-	}
100
+        return ${{class_name_lw}};
101
+    }
102 102
 
103 103
 
104
-	/*// get {{class_name_lw}} by id
104
+    /*// get {{class_name_lw}} by id
105 105
 	public function show($id)
106 106
 	{
107 107
 		${{class_name_lw}} = {{class_name}}::find($id);
108 108
 		return ${{class_name_lw}} ;
109 109
 	}*/
110
-	public function show($id)
111
-	{
112
-		$model = new {{class_name}}();
113
-		${{class_name_lw}} = $model->show($id);
114
-		return ${{class_name_lw}} ;
115
-	}
116
-
117
-	/*// find first by field and value
110
+    public function show($id)
111
+    {
112
+        $model = new {{class_name}}();
113
+        ${{class_name_lw}} = $model->show($id);
114
+        return ${{class_name_lw}} ;
115
+    }
116
+
117
+    /*// find first by field and value
118 118
 	public function findByField(Request $request)
119 119
 	{
120 120
 		${{class_name_lw}} = {{class_name}}::where($request->input('field') , '=', $request->input('value'))->first();
121 121
 		return ${{class_name_lw}} ;
122 122
 	}*/
123
-	public function findByField(Request $request)
124
-	{
125
-		$model = new {{class_name}}();
126
-		${{class_name_lw}} = $model->findByField($request);
127
-		return ${{class_name_lw}} ;
128
-	}
129
-
130
-	/*// build all validation rules
123
+    public function findByField(Request $request)
124
+    {
125
+        $model = new {{class_name}}();
126
+        ${{class_name_lw}} = $model->findByField($request);
127
+        return ${{class_name_lw}} ;
128
+    }
129
+
130
+    /*// build all validation rules
131 131
 	protected function getRules($id = null){
132 132
 		// default object rules
133 133
 		$rules = {{class_name}}::$rules;
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
 		
139 139
 		return $rules;
140 140
 	}*/
141
-	protected function getRules($id = null){
142
-		// default object rules
143
-		$model = new {{class_name}}();
144
-		$rules = $model::$rules;
145
-		${{class_name_lw}} = $model->show($id);
146
-		{{unique_rules}}
147
-		// nested rules for eager objects
148
-		{{rules_eager}}
141
+    protected function getRules($id = null){
142
+        // default object rules
143
+        $model = new {{class_name}}();
144
+        $rules = $model::$rules;
145
+        ${{class_name_lw}} = $model->show($id);
146
+        {{unique_rules}}
147
+        // nested rules for eager objects
148
+        {{rules_eager}}
149 149
 		
150
-		return $rules;
151
-	}
150
+        return $rules;
151
+    }
152 152
 
153
-	/*// delete model by id
153
+    /*// delete model by id
154 154
 	public function destroy($id)
155 155
 	{	
156 156
 		$ids = explode(",", $id);
@@ -164,32 +164,32 @@  discard block
 block discarded – undo
164 164
 
165 165
 		return json_encode($status);
166 166
 	}*/
167
-	public function destroy($id)
168
-	{
169
-		$ids = explode(",", $id);
170
-	    $ids = array_unique($ids);
167
+    public function destroy($id)
168
+    {
169
+        $ids = explode(",", $id);
170
+        $ids = array_unique($ids);
171 171
 
172
-	    $model = new {{class_name}}();
172
+        $model = new {{class_name}}();
173 173
 
174
-	    $success = $model->destroy($ids);
174
+        $success = $model->destroy($ids);
175 175
 
176
-	    $status = array("error" => true, "message" => "Error deleting object");
177
-		if ($success)
178
-			$status = array("error" => false, "message" => "Object successfully deleted");
176
+        $status = array("error" => true, "message" => "Error deleting object");
177
+        if ($success)
178
+            $status = array("error" => false, "message" => "Object successfully deleted");
179 179
 
180
-		return json_encode($status);
180
+        return json_encode($status);
181 181
 
182
-	}
182
+    }
183 183
 
184
-	{{reverseRelationships}}
185
-	{{relationship_tables_store}}
186
-	{{remove_relationship_objects}}
187
-	{{enum}}
188
-	{{checkbox}}
184
+    {{reverseRelationships}}
185
+    {{relationship_tables_store}}
186
+    {{remove_relationship_objects}}
187
+    {{enum}}
188
+    {{checkbox}}
189 189
 
190 190
 
191
-	// query with search and pagination options
192
-	/*public function query(Request $request)
191
+    // query with search and pagination options
192
+    /*public function query(Request $request)
193 193
 	{
194 194
 		// get query parameters
195 195
 		$params = $request->all();
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
 		return $query->paginate($pagination["itensPerPage"]);
239 239
 	}*/
240 240
 
241
-	// query with search and pagination options
242
-	public function query(Request $request)
243
-	{
244
-		$model = new {{class_name}}();
241
+    // query with search and pagination options
242
+    public function query(Request $request)
243
+    {
244
+        $model = new {{class_name}}();
245 245
 
246
-		$query = $model->querySearch($request);
246
+        $query = $model->querySearch($request);
247 247
 
248
-		return $query;
249
-	}
248
+        return $query;
249
+    }
250 250
 
251 251
 
252
-	// query with fields filters and pagination
253
-	//json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
254
-	/*public function queryFilters(Request $request)
252
+    // query with fields filters and pagination
253
+    //json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
254
+    /*public function queryFilters(Request $request)
255 255
 	{
256 256
 		// get query parameters
257 257
 		$params = $request->all();
@@ -311,16 +311,16 @@  discard block
 block discarded – undo
311 311
 
312 312
 		return ${{class_name_lw}}->paginate($pagination["itensPerPage"]);
313 313
 	}*/
314
-	// query with fields filters and pagination
315
-	//json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
316
-	public function queryFilters(Request $request)
317
-	{
318
-		$model = new {{class_name}}();
314
+    // query with fields filters and pagination
315
+    //json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
316
+    public function queryFilters(Request $request)
317
+    {
318
+        $model = new {{class_name}}();
319 319
 
320
-		${{class_name_lw}} = $model->queryFilters($request);
320
+        ${{class_name_lw}} = $model->queryFilters($request);
321 321
 		
322
-		return ${{class_name_lw}};
323
-	}
322
+        return ${{class_name_lw}};
323
+    }
324 324
 
325 325
 	
326 326
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
 		
139 139
 		return $rules;
140 140
 	}*/
141
-	protected function getRules($id = null){
141
+	protected function getRules($id = null) {
142 142
 		// default object rules
143 143
 		$model = new {{class_name}}();
144 144
 		$rules = $model::$rules;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,8 +174,9 @@
 block discarded – undo
174 174
 	    $success = $model->destroy($ids);
175 175
 
176 176
 	    $status = array("error" => true, "message" => "Error deleting object");
177
-		if ($success)
178
-			$status = array("error" => false, "message" => "Object successfully deleted");
177
+		if ($success) {
178
+					$status = array("error" => false, "message" => "Object successfully deleted");
179
+		}
179 180
 
180 181
 		return json_encode($status);
181 182
 
Please login to merge, or discard this patch.
stubs/Api/Model/Model.php 3 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -13,209 +13,209 @@
 block discarded – undo
13 13
 
14 14
 class {{class_name}} extends Model
15 15
 {
16
-	/**
17
-	 * The database table used by the model.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $table = '{{table_name}}';
22
-	{{timestamps}}
23
-
24
-	{{primaryAttribute}}
25
-	public $fillable = [
26
-		{{fillable}}
27
-	];
28
-
29
-	// validation rules 
30
-	public static $rules = 	[
31
-			{{validations}}
32
-	];
33
-
34
-	// eager loading objects
35
-	public $with = [
36
-		{{eager}}
37
-	];
38
-
39
-	{{enum}}
40
-
41
-	{{belongsTo}}
42
-
43
-	{{reverseRelationship}}
16
+    /**
17
+     * The database table used by the model.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $table = '{{table_name}}';
22
+    {{timestamps}}
23
+
24
+    {{primaryAttribute}}
25
+    public $fillable = [
26
+        {{fillable}}
27
+    ];
28
+
29
+    // validation rules 
30
+    public static $rules = 	[
31
+            {{validations}}
32
+    ];
33
+
34
+    // eager loading objects
35
+    public $with = [
36
+        {{eager}}
37
+    ];
38
+
39
+    {{enum}}
40
+
41
+    {{belongsTo}}
42
+
43
+    {{reverseRelationship}}
44 44
 	
45 45
 
46
-	//api resources
46
+    //api resources
47 47
 
48 48
 
49 49
 
50
-	// save {{class_name_lw}}
51
-	public function store(Request $request)
52
-	{
53
-		$vars = $request->all();
50
+    // save {{class_name_lw}}
51
+    public function store(Request $request)
52
+    {
53
+        $vars = $request->all();
54 54
 
55
-		//create eager objects
56
-		{{store_eager_objects}}
55
+        //create eager objects
56
+        {{store_eager_objects}}
57 57
 
58
-		${{class_name_lw}} = {{class_name}}::create($vars);
58
+        ${{class_name_lw}} = {{class_name}}::create($vars);
59 59
 
60
-		//create relationship_tables objects
61
-		{{relationship_tables_call}}
60
+        //create relationship_tables objects
61
+        {{relationship_tables_call}}
62 62
 
63
-		return ${{class_name_lw}} ;
64
-	}
63
+        return ${{class_name_lw}} ;
64
+    }
65 65
 
66 66
 	
67
-	// get {{class_name_lw}} by id
68
-	public function show($id)
69
-	{
70
-		${{class_name_lw}} = {{class_name}}::find($id);
71
-		return ${{class_name_lw}};
72
-	}
67
+    // get {{class_name_lw}} by id
68
+    public function show($id)
69
+    {
70
+        ${{class_name_lw}} = {{class_name}}::find($id);
71
+        return ${{class_name_lw}};
72
+    }
73 73
 
74 74
 
75 75
 	
76
-	//get first row by field and value
77
-	public function findByField(Request $request)
78
-	{
79
-		${{class_name_lw}} = {{class_name}}::where($request->input('field') , '=', $request->input('value'))->first();
80
-		return ${{class_name_lw}} ;
81
-	}
76
+    //get first row by field and value
77
+    public function findByField(Request $request)
78
+    {
79
+        ${{class_name_lw}} = {{class_name}}::where($request->input('field') , '=', $request->input('value'))->first();
80
+        return ${{class_name_lw}} ;
81
+    }
82 82
 
83 83
 	
84
-	// update {{class_name_lw}} by id
85
-	public function updateModel($id, Request $request)
86
-	{
87
-		// get vars
88
-		$vars = $request->all();
84
+    // update {{class_name_lw}} by id
85
+    public function updateModel($id, Request $request)
86
+    {
87
+        // get vars
88
+        $vars = $request->all();
89 89
 		
90
-		//update eager objects
91
-		{{update_eager_objects}}
90
+        //update eager objects
91
+        {{update_eager_objects}}
92 92
 
93
-		${{class_name_lw}} = {{class_name}}::find($id);
94
-		${{class_name_lw}}->fill($vars);
95
-		${{class_name_lw}}->save();
93
+        ${{class_name_lw}} = {{class_name}}::find($id);
94
+        ${{class_name_lw}}->fill($vars);
95
+        ${{class_name_lw}}->save();
96 96
 
97
-		//update relationship_tables objects
98
-		{{remove_relationship_objects_call}}
97
+        //update relationship_tables objects
98
+        {{remove_relationship_objects_call}}
99 99
 		
100
-		{{relationship_tables_call}}
100
+        {{relationship_tables_call}}
101 101
 
102
-		return ${{class_name_lw}};
103
-	}
102
+        return ${{class_name_lw}};
103
+    }
104 104
 
105 105
 
106
-	// delete model by id or ids
107
-	public static function destroy($ids)
108
-	{	
109
-		$success = {{class_name}}::whereIn('id', $ids)->delete();
106
+    // delete model by id or ids
107
+    public static function destroy($ids)
108
+    {	
109
+        $success = {{class_name}}::whereIn('id', $ids)->delete();
110 110
 		
111
-		return $success;
112
-	}
113
-
114
-	// query with search and pagination options
115
-	public function querySearch(Request $request)
116
-	{
117
-		// get query parameters
118
-		$params = $request->all();
119
-
120
-		// get pagination conditions
121
-		if(isset($params["pagination"])) {
122
-			$pagination = $params["pagination"];
123
-		}
124
-		else { // set default 
125
-			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
126
-		}
127
-
128
-		// resolve current page
129
-		$currentPage = $pagination["actual"];
130
-		Paginator::currentPageResolver(function () use ($currentPage) {
131
-			return $currentPage;
132
-		});
133
-
134
-		// set first condition 1=1 (all results)
135
-		$query = {{class_name}}::WhereNotNull('{{table_name}}.{{primary_key}}');
136
-
137
-		// get filters conditions
138
-		$filters = isset($params["filters"]) ? $params["filters"] : $params;
111
+        return $success;
112
+    }
113
+
114
+    // query with search and pagination options
115
+    public function querySearch(Request $request)
116
+    {
117
+        // get query parameters
118
+        $params = $request->all();
119
+
120
+        // get pagination conditions
121
+        if(isset($params["pagination"])) {
122
+            $pagination = $params["pagination"];
123
+        }
124
+        else { // set default 
125
+            $pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
126
+        }
127
+
128
+        // resolve current page
129
+        $currentPage = $pagination["actual"];
130
+        Paginator::currentPageResolver(function () use ($currentPage) {
131
+            return $currentPage;
132
+        });
133
+
134
+        // set first condition 1=1 (all results)
135
+        $query = {{class_name}}::WhereNotNull('{{table_name}}.{{primary_key}}');
136
+
137
+        // get filters conditions
138
+        $filters = isset($params["filters"]) ? $params["filters"] : $params;
139 139
 		
140
-		// field by field condition
141
-		{{conditions}}
140
+        // field by field condition
141
+        {{conditions}}
142 142
 
143
-		// join eager objects
144
-		{{eager_joins}}
143
+        // join eager objects
144
+        {{eager_joins}}
145 145
 
146
-		// eager object condition
147
-		{{eager_conditions}}
146
+        // eager object condition
147
+        {{eager_conditions}}
148 148
 
149
-		// join relationship tables objects
150
-		{{relationship_tables_joins}}
151
-		// get sort clauses
152
-		if(isset($params["sort"]) && count($params["sort"])) {
153
-			foreach($params["sort"] as $sort){
154
-				{{relationship_tables_joins_sort}} 
155
-				$query->orderBy($sort["field"], $sort["order"]);
156
-			}
157
-		}
149
+        // join relationship tables objects
150
+        {{relationship_tables_joins}}
151
+        // get sort clauses
152
+        if(isset($params["sort"]) && count($params["sort"])) {
153
+            foreach($params["sort"] as $sort){
154
+                {{relationship_tables_joins_sort}} 
155
+                $query->orderBy($sort["field"], $sort["order"]);
156
+            }
157
+        }
158 158
 
159 159
 
160 160
 		
161
-		return $query->paginate($pagination["itensPerPage"]);
162
-	}
163
-
164
-
165
-	// query with fields filters and pagination
166
-	//json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
167
-	public function queryFilters(Request $request)
168
-	{
169
-		// get query parameters
170
-		$params = $request->all();
171
-
172
-		$orderBy = '{{primary_key}}';
173
-		$fields = null;
174
-		$selectArray = [];
175
-		array_push($selectArray,'{{primary_key}}');
176
-
177
-		// get pagination conditions
178
-		if(isset($params["pagination"])) {
179
-			$pagination = $params["pagination"];
180
-		}
181
-		else { // set default 
182
-			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
183
-		}
184
-
185
-		// resolve current page
186
-		$currentPage = $pagination["actual"];
187
-		Paginator::currentPageResolver(function () use ($currentPage) {
188
-			return $currentPage;
189
-		});
190
-
191
-		if(isset($params["fields"])) {
192
-			$fields = $params["fields"];
193
-
194
-			foreach ($fields as $field) {
195
-				if(Schema::hasColumn('{{table_name}}', $field)){
196
-					array_push($selectArray, $field);
197
-				}
198
-			}
199
-
200
-		}
201
-
202
-		if(isset($params["orderBy"])) {
203
-			if(Schema::hasColumn('{{table_name}}',$params["orderBy"])){
204
-				$orderBy = $params["orderBy"];
205
-			}
206
-		}
207
-
208
-		${{class_name_lw}} = {{class_name}}::WhereNotNull('{{table_name}}.{{primary_key}}');
209
-
210
-		${{class_name_lw}}->select($selectArray)->orderBy($orderBy,'asc');
161
+        return $query->paginate($pagination["itensPerPage"]);
162
+    }
163
+
164
+
165
+    // query with fields filters and pagination
166
+    //json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
167
+    public function queryFilters(Request $request)
168
+    {
169
+        // get query parameters
170
+        $params = $request->all();
171
+
172
+        $orderBy = '{{primary_key}}';
173
+        $fields = null;
174
+        $selectArray = [];
175
+        array_push($selectArray,'{{primary_key}}');
176
+
177
+        // get pagination conditions
178
+        if(isset($params["pagination"])) {
179
+            $pagination = $params["pagination"];
180
+        }
181
+        else { // set default 
182
+            $pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
183
+        }
184
+
185
+        // resolve current page
186
+        $currentPage = $pagination["actual"];
187
+        Paginator::currentPageResolver(function () use ($currentPage) {
188
+            return $currentPage;
189
+        });
190
+
191
+        if(isset($params["fields"])) {
192
+            $fields = $params["fields"];
193
+
194
+            foreach ($fields as $field) {
195
+                if(Schema::hasColumn('{{table_name}}', $field)){
196
+                    array_push($selectArray, $field);
197
+                }
198
+            }
199
+
200
+        }
201
+
202
+        if(isset($params["orderBy"])) {
203
+            if(Schema::hasColumn('{{table_name}}',$params["orderBy"])){
204
+                $orderBy = $params["orderBy"];
205
+            }
206
+        }
207
+
208
+        ${{class_name_lw}} = {{class_name}}::WhereNotNull('{{table_name}}.{{primary_key}}');
209
+
210
+        ${{class_name_lw}}->select($selectArray)->orderBy($orderBy,'asc');
211 211
 		
212
-		return ${{class_name_lw}}->paginate($pagination["itensPerPage"]);
213
-	}
212
+        return ${{class_name_lw}}->paginate($pagination["itensPerPage"]);
213
+    }
214 214
 
215 215
 	
216
-	{{relationship_tables_store}}
216
+    {{relationship_tables_store}}
217 217
 
218
-	{{remove_relationship_objects}}
218
+    {{remove_relationship_objects}}
219 219
 
220
-	{{checkbox}}
220
+    {{checkbox}}
221 221
 }
222 222
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	];
28 28
 
29 29
 	// validation rules 
30
-	public static $rules = 	[
30
+	public static $rules = [
31 31
 			{{validations}}
32 32
 	];
33 33
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	//get first row by field and value
77 77
 	public function findByField(Request $request)
78 78
 	{
79
-		${{class_name_lw}} = {{class_name}}::where($request->input('field') , '=', $request->input('value'))->first();
79
+		${{class_name_lw}} = {{class_name}}::where($request->input('field'), '=', $request->input('value'))->first();
80 80
 		return ${{class_name_lw}} ;
81 81
 	}
82 82
 
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 		$params = $request->all();
119 119
 
120 120
 		// get pagination conditions
121
-		if(isset($params["pagination"])) {
121
+		if (isset($params["pagination"])) {
122 122
 			$pagination = $params["pagination"];
123 123
 		}
124 124
 		else { // set default 
125
-			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
125
+			$pagination = ["actual" => 1, "itensPerPage" => 25];
126 126
 		}
127 127
 
128 128
 		// resolve current page
129 129
 		$currentPage = $pagination["actual"];
130
-		Paginator::currentPageResolver(function () use ($currentPage) {
130
+		Paginator::currentPageResolver(function() use ($currentPage) {
131 131
 			return $currentPage;
132 132
 		});
133 133
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 		// join relationship tables objects
150 150
 		{{relationship_tables_joins}}
151 151
 		// get sort clauses
152
-		if(isset($params["sort"]) && count($params["sort"])) {
153
-			foreach($params["sort"] as $sort){
152
+		if (isset($params["sort"]) && count($params["sort"])) {
153
+			foreach ($params["sort"] as $sort) {
154 154
 				{{relationship_tables_joins_sort}} 
155 155
 				$query->orderBy($sort["field"], $sort["order"]);
156 156
 			}
@@ -172,42 +172,42 @@  discard block
 block discarded – undo
172 172
 		$orderBy = '{{primary_key}}';
173 173
 		$fields = null;
174 174
 		$selectArray = [];
175
-		array_push($selectArray,'{{primary_key}}');
175
+		array_push($selectArray, '{{primary_key}}');
176 176
 
177 177
 		// get pagination conditions
178
-		if(isset($params["pagination"])) {
178
+		if (isset($params["pagination"])) {
179 179
 			$pagination = $params["pagination"];
180 180
 		}
181 181
 		else { // set default 
182
-			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
182
+			$pagination = ["actual" => 1, "itensPerPage" => 25];
183 183
 		}
184 184
 
185 185
 		// resolve current page
186 186
 		$currentPage = $pagination["actual"];
187
-		Paginator::currentPageResolver(function () use ($currentPage) {
187
+		Paginator::currentPageResolver(function() use ($currentPage) {
188 188
 			return $currentPage;
189 189
 		});
190 190
 
191
-		if(isset($params["fields"])) {
191
+		if (isset($params["fields"])) {
192 192
 			$fields = $params["fields"];
193 193
 
194 194
 			foreach ($fields as $field) {
195
-				if(Schema::hasColumn('{{table_name}}', $field)){
195
+				if (Schema::hasColumn('{{table_name}}', $field)) {
196 196
 					array_push($selectArray, $field);
197 197
 				}
198 198
 			}
199 199
 
200 200
 		}
201 201
 
202
-		if(isset($params["orderBy"])) {
203
-			if(Schema::hasColumn('{{table_name}}',$params["orderBy"])){
202
+		if (isset($params["orderBy"])) {
203
+			if (Schema::hasColumn('{{table_name}}', $params["orderBy"])) {
204 204
 				$orderBy = $params["orderBy"];
205 205
 			}
206 206
 		}
207 207
 
208 208
 		${{class_name_lw}} = {{class_name}}::WhereNotNull('{{table_name}}.{{primary_key}}');
209 209
 
210
-		${{class_name_lw}}->select($selectArray)->orderBy($orderBy,'asc');
210
+		${{class_name_lw}}->select($selectArray)->orderBy($orderBy, 'asc');
211 211
 		
212 212
 		return ${{class_name_lw}}->paginate($pagination["itensPerPage"]);
213 213
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,8 +120,7 @@  discard block
 block discarded – undo
120 120
 		// get pagination conditions
121 121
 		if(isset($params["pagination"])) {
122 122
 			$pagination = $params["pagination"];
123
-		}
124
-		else { // set default 
123
+		} else { // set default 
125 124
 			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
126 125
 		}
127 126
 
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
 		// get pagination conditions
178 177
 		if(isset($params["pagination"])) {
179 178
 			$pagination = $params["pagination"];
180
-		}
181
-		else { // set default 
179
+		} else { // set default 
182 180
 			$pagination =  ["actual" => 1, "itensPerPage" => 25 ] ;
183 181
 		}
184 182
 
Please login to merge, or discard this patch.
stubs/Api/Model/FileModel.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 
8 8
 class {{class_name}} extends Model
9 9
 {
10
-	/**
11
-	 * The database table used by the model.
12
-	 *
13
-	 * @var string
14
-	 */
15
-	protected $table = '{{table_name}}';
10
+    /**
11
+     * The database table used by the model.
12
+     *
13
+     * @var string
14
+     */
15
+    protected $table = '{{table_name}}';
16 16
 	
17
-	{{primaryAttribute}}
18
-	public $fillable = [
19
-		{{fillable}}
20
-	];
17
+    {{primaryAttribute}}
18
+    public $fillable = [
19
+        {{fillable}}
20
+    ];
21 21
 
22
-	public static function boot()
23
-	{
24
-		parent::boot();
22
+    public static function boot()
23
+    {
24
+        parent::boot();
25 25
 
26
-		static::deleting(function($model)
27
-		{
28
-			Storage::disk($model->disk)->delete($model->file_path);
29
-		});
30
-	}
26
+        static::deleting(function($model)
27
+        {
28
+            Storage::disk($model->disk)->delete($model->file_path);
29
+        });
30
+    }
31 31
 	
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
stubs/Api/Migration.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,21 +5,21 @@
 block discarded – undo
5 5
 
6 6
 class Create{{class_name}}Table extends Migration
7 7
 {
8
-	/**
9
-	 * Run the migrations.
10
-	 */
11
-	public function up()
12
-	{
13
-		Schema::create('{{table_name}}', function (Blueprint $table) {
8
+    /**
9
+     * Run the migrations.
10
+     */
11
+    public function up()
12
+    {
13
+        Schema::create('{{table_name}}', function (Blueprint $table) {
14 14
 {{fields}}
15
-		});
16
-	}
15
+        });
16
+    }
17 17
 
18
-	/**
19
-	 * Reverse the migrations.
20
-	 */
21
-	public function down()
22
-	{
23
-		Schema::drop('{{table_name}}');
24
-	}
18
+    /**
19
+     * Reverse the migrations.
20
+     */
21
+    public function down()
22
+    {
23
+        Schema::drop('{{table_name}}');
24
+    }
25 25
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@
 block discarded – undo
3 3
 use Illuminate\Database\Schema\Blueprint;
4 4
 use Illuminate\Database\Migrations\Migration;
5 5
 
6
-class Create{{class_name}}Table extends Migration
6
+class Create {{class_name}}Table extends Migration
7 7
 {
8 8
 	/**
9 9
 	 * Run the migrations.
10 10
 	 */
11 11
 	public function up()
12 12
 	{
13
-		Schema::create('{{table_name}}', function (Blueprint $table) {
13
+		Schema::create('{{table_name}}', function(Blueprint $table) {
14 14
 {{fields}}
15 15
 		});
16 16
 	}
Please login to merge, or discard this patch.