Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alanaktion committed Apr 22, 2023
1 parent ffb602d commit a9c05e9
Show file tree
Hide file tree
Showing 71 changed files with 328 additions and 258 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@
/vendor
.env
.env.backup
.phpunit.cache
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Expand Down
2 changes: 0 additions & 2 deletions app/Actions/Fortify/CreateNewUser.php
Expand Up @@ -17,7 +17,6 @@ class CreateNewUser implements CreatesNewUsers
/**
* Create a newly registered user.
*
* @param array $input
* @return \App\Models\User
*/
public function create(array $input)
Expand All @@ -43,7 +42,6 @@ public function create(array $input)
/**
* Create a personal team for the user.
*
* @param \App\Models\User $user
* @return void
*/
protected function createTeam(User $user)
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Fortify/PasswordValidationRules.php
Expand Up @@ -13,6 +13,6 @@ trait PasswordValidationRules
*/
protected function passwordRules()
{
return ['required', 'string', new Password, 'confirmed'];
return ['required', 'string', new Password(), 'confirmed'];
}
}
1 change: 0 additions & 1 deletion app/Actions/Fortify/ResetUserPassword.php
Expand Up @@ -14,7 +14,6 @@ class ResetUserPassword implements ResetsUserPasswords
* Validate and reset the user's forgotten password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function reset($user, array $input)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Fortify/UpdateUserPassword.php
Expand Up @@ -14,7 +14,6 @@ class UpdateUserPassword implements UpdatesUserPasswords
* Validate and update the user's password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
Expand Down
2 changes: 0 additions & 2 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Expand Up @@ -13,7 +13,6 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
* Validate and update the given user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
Expand Down Expand Up @@ -43,7 +42,6 @@ public function update($user, array $input)
* Update the given verified user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
protected function updateVerifiedUser($user, array $input)
Expand Down
10 changes: 3 additions & 7 deletions app/Actions/Jetstream/AddTeamMember.php
Expand Up @@ -17,8 +17,6 @@ class AddTeamMember implements AddsTeamMembers
*
* @param mixed $user
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
public function add($user, $team, string $email, string $role = null)
Expand All @@ -32,7 +30,8 @@ public function add($user, $team, string $email, string $role = null)
AddingTeamMember::dispatch($team, $newTeamMember);

$team->users()->attach(
$newTeamMember, ['role' => $role]
$newTeamMember,
['role' => $role]
);

TeamMemberAdded::dispatch($team, $newTeamMember);
Expand All @@ -42,8 +41,6 @@ public function add($user, $team, string $email, string $role = null)
* Validate the add member operation.
*
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
protected function validate($team, string $email, ?string $role)
Expand All @@ -68,7 +65,7 @@ protected function rules()
return array_filter([
'email' => ['required', 'email', 'exists:users'],
'role' => Jetstream::hasRoles()
? ['required', 'string', new Role]
? ['required', 'string', new Role()]
: null,
]);
}
Expand All @@ -77,7 +74,6 @@ protected function rules()
* Ensure that the user is not already on the team.
*
* @param mixed $team
* @param string $email
* @return \Closure
*/
protected function ensureUserIsNotAlreadyOnTeam($team, string $email)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Jetstream/CreateTeam.php
Expand Up @@ -14,7 +14,6 @@ class CreateTeam implements CreatesTeams
* Validate and create a new team for the given user.
*
* @param mixed $user
* @param array $input
* @return mixed
*/
public function create($user, array $input)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Jetstream/DeleteUser.php
Expand Up @@ -18,7 +18,6 @@ class DeleteUser implements DeletesUsers
/**
* Create a new action instance.
*
* @param \Laravel\Jetstream\Contracts\DeletesTeams $deletesTeams
* @return void
*/
public function __construct(DeletesTeams $deletesTeams)
Expand Down
7 changes: 1 addition & 6 deletions app/Actions/Jetstream/InviteTeamMember.php
Expand Up @@ -19,8 +19,6 @@ class InviteTeamMember implements InvitesTeamMembers
*
* @param mixed $user
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
public function invite($user, $team, string $email, string $role = null)
Expand All @@ -43,8 +41,6 @@ public function invite($user, $team, string $email, string $role = null)
* Validate the invite member operation.
*
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
protected function validate($team, string $email, ?string $role)
Expand Down Expand Up @@ -72,7 +68,7 @@ protected function rules($team)
$query->where('team_id', $team->id);
})],
'role' => Jetstream::hasRoles()
? ['required', 'string', new Role]
? ['required', 'string', new Role()]
: null,
]);
}
Expand All @@ -81,7 +77,6 @@ protected function rules($team)
* Ensure that the user is not already on the team.
*
* @param mixed $team
* @param string $email
* @return \Closure
*/
protected function ensureUserIsNotAlreadyOnTeam($team, string $email)
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Jetstream/RemoveTeamMember.php
Expand Up @@ -41,7 +41,7 @@ protected function authorize($user, $team, $teamMember)
{
if (! Gate::forUser($user)->check('removeTeamMember', $team) &&
$user->id !== $teamMember->id) {
throw new AuthorizationException;
throw new AuthorizationException();
}
}

Expand Down
1 change: 0 additions & 1 deletion app/Actions/Jetstream/UpdateTeamName.php
Expand Up @@ -13,7 +13,6 @@ class UpdateTeamName implements UpdatesTeamNames
*
* @param mixed $user
* @param mixed $team
* @param array $input
* @return void
*/
public function update($user, $team, array $input)
Expand Down
1 change: 0 additions & 1 deletion app/Console/Kernel.php
Expand Up @@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Controller.php
Expand Up @@ -9,5 +9,7 @@

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
14 changes: 9 additions & 5 deletions app/Http/Controllers/RunController.php
Expand Up @@ -20,16 +20,17 @@ public function __construct()
public function index()
{
$runs = Run::with([
'user:id,name',
'testSuite' => function ($query) {
$query->withTrashed()->select('id', 'name');
},
])
'user:id,name',
'testSuite' => function ($query) {
$query->withTrashed()->select('id', 'name');
},
])
->whereHas('testSuite', function ($query) {
$query->where('team_id', Auth::user()->current_team_id);
})
->latest()
->paginate();

return Inertia::render('Runs/Index', [
'runs' => $runs,
]);
Expand All @@ -45,6 +46,7 @@ public function store(Request $request)
$run = Run::forceCreate($data + [
'user_id' => $request->user()->id,
]);

return redirect()->route('runs.show', $run);
}

Expand All @@ -60,6 +62,7 @@ public function show(Run $run)
},
'runTests',
]);

return Inertia::render('Runs/Show', [
'run' => $run,
]);
Expand Down Expand Up @@ -104,6 +107,7 @@ public function destroy(Run $run)
}

$run->delete();

return redirect()->route('dashboard')
->with('flash.banner', 'Test run canceled.');
}
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/TestController.php
Expand Up @@ -18,6 +18,7 @@ public function __construct()
public function create(TestSuite $testSuite)
{
$this->authorize('view', $testSuite);

return Inertia::render('TestSuites/Tests/Show', [
'suite' => $testSuite,
]);
Expand All @@ -28,6 +29,7 @@ public function archived(TestSuite $testSuite)
$tests = $testSuite->tests()
->onlyTrashed()
->get();

return Inertia::render('TestSuites/Tests/Archived', [
'suite' => $testSuite,
'tests' => $tests,
Expand All @@ -47,13 +49,15 @@ public function store(Request $request, TestSuite $testSuite)
$testSuite->tests()->create($data + [
'sort_order' => $maxSortOrder + 1,
]);

return redirect()->route('test-suites.show', $testSuite)
->with('flash.banner', 'Test created successfully.');
}

public function show(Test $test)
{
$test->load('testSuite');

return Inertia::render('TestSuites/Tests/Show', [
'test' => $test,
'suite' => $test->testSuite,
Expand All @@ -74,6 +78,7 @@ public function update(Request $request, Test $test)
if ($request->expectsJson()) {
return $test;
}

return redirect()->route('test-suites.show', $test->test_suite_id)
->with('flash.banner', 'Test updated successfully.');
}
Expand All @@ -82,6 +87,7 @@ public function destroy(Test $test)
{
$testSuite = $test->testSuite;
$test->delete();

return redirect()->route('test-suites.show', $testSuite)
->with('flash.banner', 'Test archived.');
}
Expand All @@ -90,6 +96,7 @@ public function restore(Test $test)
{
$this->authorize('restore', $test);
$test->restore();

return redirect()->route('test-suites.show', $test->test_suite_id)
->with('flash.banner', 'Test restored.');
}
Expand Down
4 changes: 4 additions & 0 deletions app/Http/Controllers/TestSuiteController.php
Expand Up @@ -27,6 +27,7 @@ public function index()
$archivedCount = $team->testSuites()
->onlyTrashed()
->count();

return Inertia::render('TestSuites/Index', [
'testSuites' => $testSuites,
'archivedCount' => $archivedCount,
Expand All @@ -39,6 +40,7 @@ public function archived()
->onlyTrashed()
->orderBy('name')
->get();

return Inertia::render('TestSuites/Archived', [
'testSuites' => $testSuites,
]);
Expand Down Expand Up @@ -93,6 +95,7 @@ public function show(TestSuite $testSuite)
public function destroy(TestSuite $testSuite)
{
$testSuite->delete();

return redirect()->route('test-suites.index')
->with('flash.banner', 'Test suite archived.');
}
Expand All @@ -101,6 +104,7 @@ public function restore(TestSuite $testSuite)
{
$this->authorize('restore', $testSuite);
$testSuite->restore();

return redirect()->route('test-suites.index')
->with('flash.banner', 'Test suite restored.');
}
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Middleware/HandleInertiaRequests.php
Expand Up @@ -12,6 +12,7 @@ class HandleInertiaRequests extends Middleware
* The root template that's loaded on the first page visit.
*
* @see https://inertiajs.com/server-side-setup#root-template
*
* @var string
*/
protected $rootView = 'app';
Expand All @@ -20,7 +21,7 @@ class HandleInertiaRequests extends Middleware
* Determines the current asset version.
*
* @see https://inertiajs.com/asset-versioning
* @param \Illuminate\Http\Request $request
*
* @return string|null
*/
public function version(Request $request)
Expand All @@ -32,7 +33,7 @@ public function version(Request $request)
* Defines the props that are shared by default.
*
* @see https://inertiajs.com/shared-data
* @param \Illuminate\Http\Request $request
*
* @return array<string,mixed>
*/
public function share(Request $request)
Expand Down
1 change: 0 additions & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Expand Up @@ -12,7 +12,6 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
Expand Down

0 comments on commit a9c05e9

Please sign in to comment.