-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
960 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class DashboardController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return inertia('Admin/Dashboard'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class SettingsController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return inertia('Admin/Settings'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Models\Status; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Validation\ValidationException; | ||
|
||
class StatusController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$statuses = Status::orderBy('order')->get(); | ||
|
||
return inertia('Admin/Status', [ | ||
'statuses' => $statuses | ||
]); | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
$request->validate([ | ||
'name' => 'required|string|unique:statuses,name', | ||
'color' => 'required|string', | ||
]); | ||
|
||
Status::create([ | ||
'name' => $request->name, | ||
'color' => $request->color, | ||
'order' => Status::count() + 1, | ||
]); | ||
|
||
return redirect()->back()->with('success', 'Status created.'); | ||
} | ||
|
||
public function update(Request $request) | ||
{ | ||
$request->validate([ | ||
'statuses' => 'required|array', | ||
'statuses.*.id' => 'required|integer|exists:statuses,id', | ||
'statuses.*.name' => 'required|string', | ||
'statuses.*.color' => 'required|string', | ||
'statuses.*.in_roadmap' => 'required|boolean', | ||
'deleted' => 'nullable|array', | ||
'deleted.*' => 'required|integer|exists:statuses,id', | ||
]); | ||
|
||
$inRoadmapCount = collect($request->statuses)->filter(function ($status) { | ||
return $status['in_roadmap'] === true; | ||
})->count(); | ||
|
||
if ($inRoadmapCount > 3) { | ||
throw ValidationException::withMessages([ | ||
'statuses' => 'Only 3 statuses can be in the roadmap at a time.', | ||
]); | ||
} | ||
|
||
foreach ($request->statuses as $status) { | ||
Status::find($status['id'])->update([ | ||
'name' => $status['name'], | ||
'color' => $status['color'], | ||
'in_roadmap' => $status['in_roadmap'], | ||
]); | ||
} | ||
|
||
Status::destroy($request->deleted); | ||
|
||
return redirect()->back()->with('success', 'Statuses updated.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,18 +13,17 @@ class DatabaseSeeder extends Seeder | |
*/ | ||
public function run(): void | ||
{ | ||
// User::factory(10)->create(); | ||
\App\Models\User::factory()->create([ | ||
'name' => 'Admin User', | ||
'email' => '[email protected]', | ||
'password' => bcrypt('password'), | ||
'role' => 'admin', | ||
]); | ||
|
||
$this->call([ | ||
// StatusSeeder::class, | ||
// BoardSeeder::class, | ||
StatusSeeder::class, | ||
BoardSeeder::class, | ||
PostSeeder::class, | ||
]); | ||
|
||
|
||
// \App\Models\User::factory()->create([ | ||
// 'name' => 'Test User', | ||
// 'email' => '[email protected]', | ||
// ]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'; | ||
import { Head } from '@inertiajs/react'; | ||
import { PageProps } from '@/types'; | ||
|
||
const Dashboard = ({ auth }: PageProps) => { | ||
return ( | ||
<div className="max-w-7xl mx-auto sm:px-6 lg:px-8"> | ||
<Head title="Dashboard" /> | ||
|
||
<div className="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg"> | ||
<div className="p-6 text-gray-900 dark:text-gray-100"> | ||
You're logged in! | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Dashboard.layout = (page: React.ReactNode) => ( | ||
<AuthenticatedLayout | ||
children={page} | ||
header={ | ||
<h2 className="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight"> | ||
Dashboard | ||
</h2> | ||
} | ||
></AuthenticatedLayout> | ||
); | ||
|
||
export default Dashboard; |
Oops, something went wrong.