Skip to content

Commit

Permalink
chore(lint): pint
Browse files Browse the repository at this point in the history
  • Loading branch information
WailanTirajoh committed Sep 24, 2024
1 parent 6361759 commit cd67ac1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
5 changes: 1 addition & 4 deletions app/Http/Controllers/ActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Spatie\Activitylog\Models\Activity;

class ActivityController extends Controller
Expand All @@ -14,13 +13,11 @@ public function index()

return view('activity_log.index', compact('activities'));
}

public function all()
{
$activities = Activity::all();

return view('activity_log.all', compact('activities'));
}

}


3 changes: 2 additions & 1 deletion app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class AuthController extends Controller
public function postLogin(PostLoginRequest $request)
{
if (Auth::attempt($request->only('email', 'password'))) {
activity() ->causedBy(auth()->user())->log('User logged into the portal'); // Log activity message
activity()->causedBy(auth()->user())->log('User logged into the portal'); // Log activity message

return redirect('dashboard')->with('success', 'Welcome '.auth()->user()->name);
}

Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public function create()

public function store(StoreUserRequest $request)
{
activity()->causedBy(auth()->user())->log('User ' . $request->name . ' created');
activity()->causedBy(auth()->user())->log('User '.$request->name.' created');
$user = $this->userRepository->store($request);

return redirect()->route('user.index')->with('success', 'User ' . $user->name . ' created');
return redirect()->route('user.index')->with('success', 'User '.$user->name.' created');
}

public function show(User $user)
{
activity()->causedBy(auth()->user())->log('User ' . $user->name . ' viewed');
activity()->causedBy(auth()->user())->log('User '.$user->name.' viewed');
if ($user->role === 'Customer') {
$customer = Customer::where('user_id', $user->id)->first();

Expand All @@ -64,7 +64,7 @@ public function edit(User $user)

public function update(User $user, UpdateCustomerRequest $request)
{
activity()->causedBy(auth()->user())->log('User ' . $user->name . ' updated');
activity()->causedBy(auth()->user())->log('User '.$user->name.' updated');
$user->update($request->all());

if ($user->isCustomer()) {
Expand All @@ -73,18 +73,18 @@ public function update(User $user, UpdateCustomerRequest $request)
]);
}

return redirect()->route('user.index')->with('success', 'User ' . $user->name . ' udpated!');
return redirect()->route('user.index')->with('success', 'User '.$user->name.' udpated!');
}

public function destroy(User $user)
{
activity()->causedBy(auth()->user())->log('User ' . $user->name . ' updated');
activity()->causedBy(auth()->user())->log('User '.$user->name.' updated');
try {
$user->delete();

return redirect()->route('user.index')->with('success', 'User ' . $user->name . ' deleted!');
return redirect()->route('user.index')->with('success', 'User '.$user->name.' deleted!');
} catch (\Exception $e) {
return redirect()->route('user.index')->with('failed', 'Customer ' . $user->name . ' cannot be deleted! Error Code:' . $e->errorInfo[1]);
return redirect()->route('user.index')->with('failed', 'Customer '.$user->name.' cannot be deleted! Error Code:'.$e->errorInfo[1]);
}
}
}
5 changes: 3 additions & 2 deletions app/Http/Requests/StoreCustomerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function authorize()
*/
public function rules()
{
if($this->isMethod('put')){

if ($this->isMethod('put')) {
return [
'name' => 'required',
'address' => 'required|max:255',
Expand All @@ -34,6 +34,7 @@ public function rules()
'avatar' => 'mimes:png,jpg',
];
}

return [
'name' => 'required',
'address' => 'required|max:255',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateActivityLogTable extends Migration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddEventColumnToActivityLogTable extends Migration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddBatchUuidColumnToActivityLogTable extends Migration
{
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use App\Events\NewReservationEvent;
use App\Events\RefreshDashboardEvent;
use App\Http\Controllers\ActivityController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\ChartController;
use App\Http\Controllers\CustomerController;
Expand All @@ -19,7 +20,6 @@
use App\Http\Controllers\UserController;
use App\Models\User;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ActivityController;

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit cd67ac1

Please sign in to comment.