Skip to content

Commit

Permalink
PHP CS Fix to PSR2 for all code
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuebel committed May 7, 2019
1 parent d0a1619 commit 2f3597b
Show file tree
Hide file tree
Showing 56 changed files with 181 additions and 225 deletions.
5 changes: 1 addition & 4 deletions ContactsController.php
Expand Up @@ -15,7 +15,6 @@

class ClientsController extends Controller
{

protected $users;
protected $clients;
protected $settings;
Expand All @@ -24,8 +23,7 @@ public function __construct(
UserRepositoryContract $users,
ClientRepositoryContract $clients,
SettingRepositoryContract $settings
)
{
) {
$this->users = $users;
$this->clients = $clients;
$this->settings = $settings;
Expand Down Expand Up @@ -159,5 +157,4 @@ public function updateAssign($id, Request $request)
Session()->flash('flash_message', 'New user is assigned');
return redirect()->back();
}

}
2 changes: 1 addition & 1 deletion app/Dinero.php
Expand Up @@ -107,7 +107,7 @@ public static function sendInvoice($invoiceGuid, $timestamp)
}

public function getContacts($filter = "")
{
{
$res = self::getClient()->request("GET", "https://api.dinero.dk/v1/"
. self::$organizationId . "/contacts?field=Name,ContactGuid&queryFilter=Email+contains+" . "'" . $filter . "'", [
"verify" => false,
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/ClientsController.php
Expand Up @@ -15,7 +15,6 @@

class ClientsController extends Controller
{

protected $users;
protected $clients;
protected $settings;
Expand All @@ -24,8 +23,7 @@ public function __construct(
UserRepositoryContract $users,
ClientRepositoryContract $clients,
SettingRepositoryContract $settings
)
{
) {
$this->users = $users;
$this->clients = $clients;
$this->settings = $settings;
Expand Down Expand Up @@ -159,5 +157,4 @@ public function updateAssign($id, Request $request)
Session()->flash('flash_message', 'New user is assigned');
return redirect()->back();
}

}
5 changes: 2 additions & 3 deletions app/Http/Controllers/CommentController.php
Expand Up @@ -18,16 +18,15 @@ class CommentController extends Controller
* @return mixed
*/
public function store(Request $request)
{
{
$this->validate($request, [
'description' => 'required'
]);

$source = $request->type == "task" ? Task::find($request->id) : Lead::find($request->id);
$source = $request->type == "task" ? Task::find($request->id) : Lead::find($request->id);
$comment = $source->addComment(['description' => $request->description, 'user_id' => auth()->user()->id]);
event(new \App\Events\NewComment($comment));
Session::flash('flash_message', 'Comment successfully added!'); //Snippet in Master.blade.php
return redirect()->back();
}

}
1 change: 0 additions & 1 deletion app/Http/Controllers/DepartmentsController.php
Expand Up @@ -8,7 +8,6 @@

class DepartmentsController extends Controller
{

protected $departments;

/**
Expand Down
27 changes: 13 additions & 14 deletions app/Http/Controllers/DocumentsController.php
@@ -1,5 +1,6 @@
<?php
namespace App\Http\Controllers;

use Excel;
use Session;
use Validator;
Expand All @@ -11,8 +12,6 @@
use App\Models\Document;
use Illuminate\Http\Request;



class DocumentsController extends Controller
{
/**
Expand Down Expand Up @@ -81,16 +80,16 @@ public function import(Request $request)
}
}
}
public function destroy($id)
{
$document=Document::find($id);
$settings = Setting::findOrFail(1);
$companyname = $settings->company;
$path = $document->path;
$destroy_path = (public_path() . '/files/' . $companyname .'/' . $path);
File::delete(public_path() . '/files/' . $companyname .'/' . $path);
$document->delete();
Session()->flash('flash_message', 'File has been deleted');
return redirect()->back();
}
public function destroy($id)
{
$document=Document::find($id);
$settings = Setting::findOrFail(1);
$companyname = $settings->company;
$path = $document->path;
$destroy_path = (public_path() . '/files/' . $companyname .'/' . $path);
File::delete(public_path() . '/files/' . $companyname .'/' . $path);
$document->delete();
Session()->flash('flash_message', 'File has been deleted');
return redirect()->back();
}
}
5 changes: 1 addition & 4 deletions app/Http/Controllers/InvoicesController.php
Expand Up @@ -10,15 +10,13 @@

class InvoicesController extends Controller
{

protected $clients;
protected $invoices;

public function __construct(
InvoiceRepositoryContract $invoices,
ClientRepositoryContract $clients
)
{
) {
$this->invoices = $invoices;
$this->clients = $clients;
}
Expand Down Expand Up @@ -61,7 +59,6 @@ public function show($id)
if (!$invoiceContacts) {
$invoiceContacts = $api->getContacts();
}

} else {
$apiConnected = false;
$invoiceContacts = [];
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/LeadsController.php
Expand Up @@ -28,8 +28,7 @@ public function __construct(
UserRepositoryContract $users,
ClientRepositoryContract $clients,
SettingRepositoryContract $settings
)
{
) {
$this->users = $users;
$this->settings = $settings;
$this->clients = $clients;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/NotificationsController.php
Expand Up @@ -17,7 +17,7 @@ class NotificationsController extends Controller
public function markRead(Request $request)
{
$user = auth()->user();
$user->unreadNotifications()->where('id', $request->id)->first()->markAsRead();
$user->unreadNotifications()->where('id', $request->id)->first()->markAsRead();

return redirect($user->notifications->where('id', $request->id)->first()->data['url']);
}
Expand Down
67 changes: 33 additions & 34 deletions app/Http/Controllers/PagesController.php
Expand Up @@ -12,7 +12,6 @@

class PagesController extends Controller
{

protected $users;
protected $clients;
protected $settings;
Expand Down Expand Up @@ -49,60 +48,60 @@ public function dashboard()
$totalClients = $this->clients->getAllClientsCount();
$totalTimeSpent = $this->tasks->totalTimeSpent();

/**
* Statistics for all-time tasks.
*
*/
/**
* Statistics for all-time tasks.
*
*/
$alltasks = $this->tasks->tasks();
$allCompletedTasks = $this->tasks->allCompletedTasks();
$totalPercentageTasks = $this->tasks->percantageCompleted();

/**
* Statistics for today tasks.
*
*/
/**
* Statistics for today tasks.
*
*/
$completedTasksToday = $this->tasks->completedTasksToday();
$createdTasksToday = $this->tasks->createdTasksToday();

/**
* Statistics for tasks this month.
*
*/
$taskCompletedThisMonth = $this->tasks->completedTasksThisMonth();
/**
* Statistics for tasks this month.
*
*/
$taskCompletedThisMonth = $this->tasks->completedTasksThisMonth();


/**
* Statistics for tasks each month(For Charts).
*
*/
/**
* Statistics for tasks each month(For Charts).
*
*/
$createdTasksMonthly = $this->tasks->createdTasksMothly();
$completedTasksMonthly = $this->tasks->completedTasksMothly();

/**
* Statistics for all-time Leads.
*
*/
/**
* Statistics for all-time Leads.
*
*/

$allleads = $this->leads->leads();
$allCompletedLeads = $this->leads->allCompletedLeads();
$totalPercentageLeads = $this->leads->percantageCompleted();
/**
* Statistics for today leads.
*
*/
/**
* Statistics for today leads.
*
*/
$completedLeadsToday = $this->leads->completedLeadsToday();
$createdLeadsToday = $this->leads->createdLeadsToday();

/**
* Statistics for leads this month.
*
*/
/**
* Statistics for leads this month.
*
*/
$leadCompletedThisMonth = $this->leads->completedLeadsThisMonth();

/**
* Statistics for leads each month(For Charts).
*
*/
/**
* Statistics for leads each month(For Charts).
*
*/
$completedLeadsMonthly = $this->leads->createdLeadsMonthly();
$createdLeadsMonthly = $this->leads->completedLeadsMonthly();

Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/RolesController.php
Expand Up @@ -7,7 +7,6 @@

class RolesController extends Controller
{

protected $roles;

/**
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/SettingsController.php
Expand Up @@ -22,8 +22,7 @@ class SettingsController extends Controller
public function __construct(
SettingRepositoryContract $settings,
RoleRepositoryContract $roles
)
{
) {
$this->settings = $settings;
$this->roles = $roles;
$this->middleware('user.is.admin', ['only' => ['index']]);
Expand Down
4 changes: 1 addition & 3 deletions app/Http/Controllers/TasksController.php
Expand Up @@ -17,7 +17,6 @@

class TasksController extends Controller
{

protected $request;
protected $tasks;
protected $clients;
Expand All @@ -31,8 +30,7 @@ public function __construct(
ClientRepositoryContract $clients,
InvoiceRepositoryContract $invoices,
SettingRepositoryContract $settings
)
{
) {
$this->tasks = $tasks;
$this->users = $users;
$this->clients = $clients;
Expand Down
10 changes: 3 additions & 7 deletions app/Http/Controllers/UsersController.php
Expand Up @@ -33,8 +33,7 @@ public function __construct(
SettingRepositoryContract $settings,
TaskRepositoryContract $tasks,
LeadRepositoryContract $leads
)
{
) {
$this->users = $users;
$this->roles = $roles;
$this->departments = $departments;
Expand Down Expand Up @@ -68,7 +67,7 @@ public function anyData()
->addColumn('edit', function ($user) {
return '<a href="' . route("users.edit", $user->id) . '" class="btn btn-success"> Edit</a>';
})
->add_column('delete', function ($user) {
->add_column('delete', function ($user) {
return '<button type="button" class="btn btn-danger delete_client" data-client_id="' . $user->id . '" onClick="openModal(' . $user->id. ')" id="myBtn">Delete</button>';
})->make(true);
}
Expand Down Expand Up @@ -105,7 +104,7 @@ public function taskData($id)
->make(true);
}

/**
/**
* Json for Data tables
* @param $id
* @return mixed
Expand Down Expand Up @@ -154,9 +153,6 @@ public function clientData($id)
->format('d/m/Y') : '';
})
->make(true);



}


Expand Down
2 changes: 1 addition & 1 deletion app/Listeners/NotiftyMentionedUsers.php
Expand Up @@ -28,7 +28,7 @@ public function __construct()
*/
public function handle(NewComment $event)
{
collect($event->comment->mentionedUsers())
collect($event->comment->mentionedUsers())
->map(function ($name) {
return User::where('name', $name)->first();
})
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Activity.php
Expand Up @@ -36,7 +36,8 @@ public function user()
return $this->belongsTo(User::class, 'user_id', 'id');
}

public function source() {
public function source()
{
return $this->morphTo();
}
}
3 changes: 1 addition & 2 deletions app/Models/Client.php
Expand Up @@ -5,7 +5,6 @@

class Client extends Model
{

protected $fillable = [
'company_name',
'vat',
Expand All @@ -25,7 +24,7 @@ public function user()
return $this->belongsTo(User::class, 'user_id', 'id');
}

public function tasks()
public function tasks()
{
return $this->hasMany(Task::class, 'client_id', 'id')
->orderBy('status', 'asc')
Expand Down

0 comments on commit 2f3597b

Please sign in to comment.