Skip to content

Commit a658101

Browse files
committed
Ajustes de layout e refatoração de código por phpstorm
1 parent 45df5a0 commit a658101

File tree

120 files changed

+6955
-6785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+6955
-6785
lines changed

.env.example

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ MAIL_ENCRYPTION=
3737

3838
PUSHER_APP_ID=
3939
PUSHER_APP_KEY=
40-
PUSHER_APP_SECRET=
40+
PUSHER_APP_SECRET=
41+
42+
GOOGLE_KEY=

.ruby

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.2

app/City.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class City extends Model
88
{
99
protected $table = "cities";
10-
protected $fillable = [ 'name', 'state_id' ];
10+
protected $fillable = ['name', 'state_id'];
1111

1212
public function state()
1313
{

app/Console/Kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel
1919
/**
2020
* Define the application's command schedule.
2121
*
22-
* @param \Illuminate\Console\Scheduling\Schedule $schedule
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
2323
* @return void
2424
*/
2525
protected function schedule(Schedule $schedule)

app/Contact.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Contact extends Model
88
{
99
protected $table = "contacts";
10-
protected $fillable = [ "value", "type_id", "user_id" ];
10+
protected $fillable = ["value", "type_id", "user_id"];
1111

1212
public function type()
1313
{

app/ContactType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
class ContactType extends Model
88
{
99
protected $table = "contact_types";
10-
protected $fillable = [ "name", "mask" ];
10+
protected $fillable = ["name", "mask"];
1111
}

app/Driver.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class Driver extends Model
88
{
99
protected $table = "drivers";
10-
protected $fillable = [ 'name', 'license_id' ];
10+
protected $fillable = ['name', 'license_id'];
1111

1212
public static function boot()
1313
{
1414
parent::boot();
1515

16-
self::creating(function($model){
16+
self::creating(function ($model) {
1717
$model->created_by = \Auth::user()->id;
1818
});
1919
}

app/Exceptions/Handler.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Handler extends ExceptionHandler
2727
*
2828
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
2929
*
30-
* @param \Exception $exception
30+
* @param \Exception $exception
3131
* @return void
3232
*/
3333
public function report(Exception $exception)
@@ -38,8 +38,8 @@ public function report(Exception $exception)
3838
/**
3939
* Render an exception into an HTTP response.
4040
*
41-
* @param \Illuminate\Http\Request $request
42-
* @param \Exception $exception
41+
* @param \Illuminate\Http\Request $request
42+
* @param \Exception $exception
4343
* @return \Illuminate\Http\Response
4444
*/
4545
public function render($request, Exception $exception)
@@ -50,8 +50,8 @@ public function render($request, Exception $exception)
5050
/**
5151
* Convert an authentication exception into an unauthenticated response.
5252
*
53-
* @param \Illuminate\Http\Request $request
54-
* @param \Illuminate\Auth\AuthenticationException $exception
53+
* @param \Illuminate\Http\Request $request
54+
* @param \Illuminate\Auth\AuthenticationException $exception
5555
* @return \Illuminate\Http\Response
5656
*/
5757
protected function unauthenticated($request, AuthenticationException $exception)

app/Fence.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class Fence extends Model
88
{
99
protected $table = "fences";
10-
protected $fillable = [ "name", "polygon" ];
10+
protected $fillable = ["name", "polygon"];
1111

1212
public static function boot()
1313
{
1414
parent::boot();
1515

16-
self::creating(function($model){
16+
self::creating(function ($model) {
1717
$model->created_by = \Auth::user()->id;
1818
});
1919
}

app/Http/Controllers/Auth/RegisterController.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace App\Http\Controllers\Auth;
44

5-
use App\User;
65
use App\Http\Controllers\Controller;
6+
use App\User;
7+
use DB;
8+
use Illuminate\Foundation\Auth\RegistersUsers;
79
use Illuminate\Support\Facades\Validator;
810
use jeremykenedy\LaravelRoles\Models\Role;
9-
use jeremykenedy\LaravelRoles\Models\Permission;
10-
use Illuminate\Foundation\Auth\RegistersUsers;
11-
use DB;
1211

1312
class RegisterController extends Controller
1413
{
@@ -45,7 +44,7 @@ public function __construct()
4544
/**
4645
* Get a validator for an incoming registration request.
4746
*
48-
* @param array $data
47+
* @param array $data
4948
* @return \Illuminate\Contracts\Validation\Validator
5049
*/
5150
protected function validator(array $data)
@@ -60,7 +59,7 @@ protected function validator(array $data)
6059
/**
6160
* Create a new user instance after a valid registration.
6261
*
63-
* @param array $data
62+
* @param array $data
6463
* @return \App\User
6564
*/
6665
protected function create(array $data)

app/Http/Controllers/CEPController.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use App\City;
66
use App\State;
7-
use App\Setting;
8-
use Illuminate\Http\Request;
97
use Illuminate\Support\Facades\Input;
108

119
class CEPController extends Controller
@@ -21,7 +19,8 @@ public function __construct()
2119
$this->middleware('role:admin|subadmin');
2220
}
2321

24-
public function contries(){
22+
public function contries()
23+
{
2524
$brazil = [
2625
"id" => 0,
2726
"nome" => "Brasil",
@@ -32,10 +31,11 @@ public function contries(){
3231
]);
3332
}
3433

35-
public function states(){
34+
public function states()
35+
{
3636
$states = State::all();
3737
$statesJson = [];
38-
foreach ($states as $state){
38+
foreach ($states as $state) {
3939
$statesJson[] = (object)[
4040
"id" => $state->id,
4141
"nome" => $state->name,
@@ -46,10 +46,11 @@ public function states(){
4646
return response()->json($statesJson);
4747
}
4848

49-
public function cities(){
50-
$cities = City::where(['state_id'=>Input::get('id')])->get();
49+
public function cities()
50+
{
51+
$cities = City::where(['state_id' => Input::get('id')])->get();
5152
$citiesJson = [];
52-
foreach ($cities as $city){
53+
foreach ($cities as $city) {
5354
$citiesJson[] = (object)[
5455
"id" => $city->id,
5556
"nome" => $city->name,

app/Http/Controllers/CitiesController.php

+26-25
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace App\Http\Controllers;
44

55
use App\City;
6-
use App\State;
76
use App\Setting;
7+
use App\State;
88
use Illuminate\Http\Request;
99
use Illuminate\Support\Facades\Input;
1010

@@ -20,6 +20,7 @@ public function __construct()
2020
$this->middleware('auth');
2121
$this->middleware('role:admin');
2222
}
23+
2324
/**
2425
* Display a listing of the resource.
2526
*
@@ -28,25 +29,14 @@ public function __construct()
2829
public function index()
2930
{
3031
$stateId = Input::get('state_id');
31-
if (!isset($stateId)){
32+
if (!isset($stateId)) {
3233
$stateId = State::first()->id;
3334
}
3435
$state = State::find($stateId);
3536
$cities = City::where(['state_id' => $stateId])->paginate(Setting::paginacao());
3637
return view('cities.index', ['state' => $state, 'cities' => $cities]);
3738
}
3839

39-
/**
40-
* Show the form for creating a new resource.
41-
*
42-
* @return \Illuminate\Http\Response
43-
*/
44-
public function create()
45-
{
46-
$states = State::all();
47-
return view('cities.form', ['city' => new City(), 'states'=>$states]);
48-
}
49-
5040
/**
5141
* Store a newly created resource in storage.
5242
*
@@ -55,33 +45,32 @@ public function create()
5545
*/
5646
public function store(Request $request)
5747
{
58-
if (City::create($request->input())){
59-
return redirect(route('cities.index')."?state_id=".$request->state_id);
48+
if (City::create($request->input())) {
49+
return redirect(route('cities.index') . "?state_id=" . $request->state_id);
6050
} else {
6151
return $this->create();
6252
}
6353
}
6454

6555
/**
66-
* Display the specified resource.
56+
* Show the form for creating a new resource.
6757
*
68-
* @param \City $city
6958
* @return \Illuminate\Http\Response
7059
*/
71-
public function show(City $city)
60+
public function create()
7261
{
62+
$states = State::all();
63+
return view('cities.form', ['city' => new City(), 'states' => $states]);
7364
}
7465

7566
/**
76-
* Show the form for editing the specified resource.
67+
* Display the specified resource.
7768
*
7869
* @param \City $city
7970
* @return \Illuminate\Http\Response
8071
*/
81-
public function edit(City $city)
72+
public function show(City $city)
8273
{
83-
$states = State::all();
84-
return view('cities.form',['city' => $city, 'states'=>$states]);
8574
}
8675

8776
/**
@@ -93,13 +82,25 @@ public function edit(City $city)
9382
*/
9483
public function update(Request $request, City $city)
9584
{
96-
if ($city->update($request->input())){
97-
return redirect(route('cities.index')."?state_id=".$city->state_id);
85+
if ($city->update($request->input())) {
86+
return redirect(route('cities.index') . "?state_id=" . $city->state_id);
9887
} else {
9988
return $this->edit($city);
10089
}
10190
}
10291

92+
/**
93+
* Show the form for editing the specified resource.
94+
*
95+
* @param \City $city
96+
* @return \Illuminate\Http\Response
97+
*/
98+
public function edit(City $city)
99+
{
100+
$states = State::all();
101+
return view('cities.form', ['city' => $city, 'states' => $states]);
102+
}
103+
103104
/**
104105
* Remove the specified resource from storage.
105106
*
@@ -110,6 +111,6 @@ public function destroy(City $city)
110111
{
111112
$stateId = $city->state_id;
112113
$city->delete();
113-
return redirect(route('cities.index')."?state_id=".$stateId);
114+
return redirect(route('cities.index') . "?state_id=" . $stateId);
114115
}
115116
}

0 commit comments

Comments
 (0)