Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
wilburpowery authored and StyleCIBot committed Jan 9, 2018
1 parent c2b3653 commit 88f0788
Show file tree
Hide file tree
Showing 63 changed files with 323 additions and 312 deletions.
12 changes: 6 additions & 6 deletions app/Business.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Business extends Model
protected $guarded = [];

/**
* Users relationship
* Users relationship.
*/
public function users(): HasMany
{
Expand All @@ -23,15 +23,15 @@ public function clients()
}

/**
* Daily Budgets relationship
* Daily Budgets relationship.
*/
public function dailyBudgets()
{
return $this->hasMany(DailyBudget::class);
}

/**
* Transactions relationship
* Transactions relationship.
*/
public function transactions()
{
Expand All @@ -41,9 +41,9 @@ public function transactions()
public function addClient($data)
{
return $this->clients()->create([
'name' => $data['name'],
'email' => $data['email'],
'phone_number' => $data['phone_number']
'name' => $data['name'],
'email' => $data['email'],
'phone_number' => $data['phone_number'],
]);
}
}
3 changes: 2 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
4 changes: 2 additions & 2 deletions app/DailyBudget.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class DailyBudget extends Model
{
Expand All @@ -18,6 +18,7 @@ public static function fromToday()
* Convert to cents before saving.
*
* @param string $value
*
* @return void
*/
public function setTotalAttribute($value)
Expand All @@ -27,7 +28,6 @@ public function setTotalAttribute($value)

/**
* Convert the total back to decimal value.
*
*/
public function getTotalAttribute()
{
Expand Down
2 changes: 1 addition & 1 deletion app/Desk.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Desk extends Model
{
Expand Down
8 changes: 5 additions & 3 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Exception $exception
*
* @return void
*/
public function report(Exception $exception)
Expand All @@ -42,8 +43,9 @@ public function report(Exception $exception)
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/AccountingDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Http\Controllers;

use App\Transaction;
use App\DailyBudget;
use App\Desk;
use App\Transaction;

class AccountingDataController extends Controller
{
Expand All @@ -24,9 +24,9 @@ public function __invoke()

return response([
'alreadyHasClosedDesk' => Desk::hasAlreadyBeenClosed(),
'dailyBudget' => $dailyBudget,
'income' => $incomes,
'expense' => $expenses
'dailyBudget' => $dailyBudget,
'income' => $incomes,
'expense' => $expenses,
]);
}
}
26 changes: 14 additions & 12 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
Expand Down Expand Up @@ -42,33 +42,35 @@ public function __construct()
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'business_id' => 'required|numeric'
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'business_id' => 'required|numeric',
]);
}

/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @param array $data
*
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'business_id' => $data['business_id'],
'is_admin' => true,
'is_admin' => true,
]);
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/BusinessesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class BusinessesController extends Controller
public function store()
{
$data = request()->validate([
'name' => 'required',
'description' => 'required'
'name' => 'required',
'description' => 'required',
]);

$business = Business::create($data);
Expand Down
15 changes: 8 additions & 7 deletions app/Http/Controllers/ClientsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

namespace App\Http\Controllers;

use App\Client;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use App\Client;

class ClientsController extends Controller
{
public function index()
{
if ($search = request('q')) {
$client = Client::where('name', 'like', "%$search%")->get();

return $client;
}

Expand All @@ -23,15 +24,15 @@ public function index()
public function store()
{
$data = request()->validate([
'name' => 'required|string|min:1',
'name' => 'required|string|min:1',
'email' => [
'required',
'email',
Rule::unique('clients')->where(function ($query) {
return $query->where('business_id', auth()->user()->business->id);
})
}),
],
'phone_number' => 'required'
'phone_number' => 'required',
]);

$client = auth()->user()->business->addClient($data);
Expand All @@ -51,15 +52,15 @@ public function update(Client $client)
$this->authorize('update', $client);

$data = request()->validate([
'name' => 'required|string|min:1',
'name' => 'required|string|min:1',
'email' => [
'required',
'email',
Rule::unique('clients')->ignore($client->id)->where(function ($query) {
return $query->where('business_id', auth()->user()->business->id);
})
}),
],
'phone_number' => 'required'
'phone_number' => 'required',
]);

$client->update($data);
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/DailyBudgetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\DailyBudget;
use Illuminate\Http\Request;

class DailyBudgetsController extends Controller
{
Expand All @@ -17,12 +17,12 @@ public function index()
public function store()
{
$data = request()->validate([
'daily_budget' => 'required|numeric'
'daily_budget' => 'required|numeric',
]);

$budget = DailyBudget::create([
'business_id' => auth()->user()->business->id,
'total' => $data['daily_budget']
'total' => $data['daily_budget'],
]);

return $budget;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function index()

return response([
'dailyBudget' => $dailyBudget,
'income' => $incomes,
'expense' => $expenses
'income' => $incomes,
'expense' => $expenses,
]);
}

Expand Down
24 changes: 12 additions & 12 deletions app/Http/Controllers/DeskClosesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ class DeskClosesController extends Controller
public function store()
{
$data = request()->validate([
'initial_balance' => 'required|numeric',
'income' => 'required|numeric',
'expense' => 'required|numeric',
'transfers' => 'required|numeric',
'card_payments' => 'required|numeric',
'earn_sp' => 'required|numeric',
'deposit_sp' => 'required|numeric',
'commission_sp' => 'required|numeric',
'refills' => 'required|numeric',
'initial_balance' => 'required|numeric',
'income' => 'required|numeric',
'expense' => 'required|numeric',
'transfers' => 'required|numeric',
'card_payments' => 'required|numeric',
'earn_sp' => 'required|numeric',
'deposit_sp' => 'required|numeric',
'commission_sp' => 'required|numeric',
'refills' => 'required|numeric',
'commission_refills' => 'required|numeric',
'cash_box' => 'required|numeric',
'final_balance' => 'required|numeric',
'real_balance' => 'required|numeric'
'cash_box' => 'required|numeric',
'final_balance' => 'required|numeric',
'real_balance' => 'required|numeric',
]);

auth()->user()->closeDesk($data);
Expand Down
18 changes: 9 additions & 9 deletions app/Http/Controllers/ExpensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Transaction;
use Illuminate\Http\Request;

class ExpensesController extends Controller
{
Expand All @@ -19,16 +19,16 @@ public function index()
public function store()
{
$data = request()->validate([
'type' => 'required',
'type' => 'required',
'description' => 'required',
'total' => 'required|numeric'
'total' => 'required|numeric',
]);

auth()->user()->business->transactions()->create([
'type' => $data['type'],
'description' => $data['description'],
'total' => $data['total'],
'transaction_type' => 'App\Expense'
'type' => $data['type'],
'description' => $data['description'],
'total' => $data['total'],
'transaction_type' => 'App\Expense',
]);
}

Expand All @@ -42,9 +42,9 @@ public function show(Transaction $expense)
public function update(Transaction $expense)
{
$data = request()->validate([
'type' => 'required',
'type' => 'required',
'description' => 'required',
'total' => 'required'
'total' => 'required',
]);

$this->authorize('update', $expense);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/GraphsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function income()

return [
'Ingresos' => $income,
'Egresos' => $expense
'Egresos' => $expense,
];
}
}
Loading

0 comments on commit 88f0788

Please sign in to comment.