adds roles
This commit is contained in:
@@ -49,6 +49,22 @@ final class AnswerResource extends Resource
|
||||
*/
|
||||
public static $with = ['session', 'question'];
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Answers';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Answer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
@@ -76,6 +92,7 @@ public function fields(NovaRequest $request): array
|
||||
->rules('nullable', 'max:255'),
|
||||
|
||||
Textarea::make('Text Value')
|
||||
->alwaysShow()
|
||||
->rules('nullable'),
|
||||
|
||||
DateTime::make('Created At')
|
||||
|
||||
@@ -42,6 +42,22 @@ final class CategoryResource extends Resource
|
||||
*/
|
||||
public static $displayInNavigation = false;
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Category';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
|
||||
@@ -56,6 +56,22 @@ final class LogResource extends Resource
|
||||
*/
|
||||
public static $with = ['user', 'session', 'category'];
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Logs';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Log';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
|
||||
@@ -44,6 +44,22 @@ final class QuestionGroupResource extends Resource
|
||||
*/
|
||||
public static $displayInNavigation = false;
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Question Groups';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Question Group';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\Boolean;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
@@ -51,6 +52,22 @@ final class QuestionResource extends Resource
|
||||
*/
|
||||
public static $group = 'Questionnaire';
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Questions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Question';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
@@ -111,6 +128,8 @@ public function fields(NovaRequest $request): array
|
||||
->exceptOnForms()
|
||||
->sortable()
|
||||
->filterable(),
|
||||
|
||||
HasMany::make('Answers', 'answers', AnswerResource::class),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
75
app/Nova/RoleResource.php
Normal file
75
app/Nova/RoleResource.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
|
||||
final class RoleResource extends Resource
|
||||
{
|
||||
public static string $model = \App\Models\Role::class;
|
||||
|
||||
public static $title = 'name';
|
||||
|
||||
public static $search = ['id', 'name'];
|
||||
|
||||
public static $displayInNavigation = false;
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Roles';
|
||||
}
|
||||
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Role';
|
||||
}
|
||||
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
Text::make('Name')
|
||||
->sortable()
|
||||
->filterable()
|
||||
->copyable()
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
DateTime::make('Created At')
|
||||
->exceptOnForms()
|
||||
->sortable(),
|
||||
|
||||
DateTime::make('Updated At')
|
||||
->exceptOnForms()
|
||||
->sortable(),
|
||||
|
||||
HasMany::make('Users', 'users', User::class),
|
||||
];
|
||||
}
|
||||
|
||||
public function cards(NovaRequest $request): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function filters(NovaRequest $request): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function lenses(NovaRequest $request): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function actions(NovaRequest $request): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,22 @@ final class ScreeningResource extends Resource
|
||||
*/
|
||||
public static $with = ['user'];
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Screenings';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Screening';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
namespace App\Nova;
|
||||
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\Code;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Textarea;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Maatwebsite\LaravelNovaExcel\Actions\DownloadExcel;
|
||||
@@ -59,6 +58,22 @@ final class SessionResource extends Resource
|
||||
*/
|
||||
public static $with = ['user', 'category', 'screening'];
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Sessions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable singular label of the resource.
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return 'Session';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
@@ -85,11 +100,16 @@ public function fields(NovaRequest $request): array
|
||||
->filterable()
|
||||
->rules('nullable'),
|
||||
|
||||
Text::make('Status')
|
||||
Select::make('Status')
|
||||
->options([
|
||||
'in_progress' => 'In Progress',
|
||||
'completed' => 'Completed',
|
||||
'abandoned' => 'Abandoned',
|
||||
])
|
||||
->displayUsingLabels()
|
||||
->sortable()
|
||||
->filterable()
|
||||
->copyable()
|
||||
->rules('required', 'max:255'),
|
||||
->readonly(),
|
||||
|
||||
Number::make('Score')
|
||||
->sortable()
|
||||
@@ -97,15 +117,16 @@ public function fields(NovaRequest $request): array
|
||||
->copyable()
|
||||
->rules('nullable', 'integer'),
|
||||
|
||||
Text::make('Result')
|
||||
Select::make('Result')
|
||||
->options([
|
||||
'go' => 'Go',
|
||||
'no_go' => 'No Go',
|
||||
'consult_leadership' => 'Consult Leadership',
|
||||
])
|
||||
->displayUsingLabels()
|
||||
->sortable()
|
||||
->filterable()
|
||||
->copyable()
|
||||
->rules('nullable', 'max:255'),
|
||||
|
||||
Code::make('Basic Info', 'basic_info')
|
||||
->json()
|
||||
->rules('nullable'),
|
||||
->readonly(),
|
||||
|
||||
Textarea::make('Additional Comments')
|
||||
->rules('nullable'),
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Auth\PasswordValidationRules;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Password;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
@@ -35,7 +36,7 @@ final class User extends Resource
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'id', 'name', 'email',
|
||||
'id', 'name', 'email', 'department', 'job_title',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,10 @@ public function fields(NovaRequest $request): array
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
BelongsTo::make('Role', 'role', RoleResource::class)
|
||||
->sortable()
|
||||
->filterable(),
|
||||
|
||||
Text::make('Name')
|
||||
->sortable()
|
||||
->rules('required', 'max:255'),
|
||||
@@ -58,6 +63,31 @@ public function fields(NovaRequest $request): array
|
||||
->creationRules('unique:users,email')
|
||||
->updateRules('unique:users,email,{{resourceId}}'),
|
||||
|
||||
Text::make('Azure ID', 'azure_id')
|
||||
->onlyOnDetail()
|
||||
->copyable(),
|
||||
|
||||
Text::make('Photo', 'photo')
|
||||
->onlyOnDetail()
|
||||
->copyable(),
|
||||
|
||||
Text::make('Job Title', 'job_title')
|
||||
->sortable()
|
||||
->filterable()
|
||||
->copyable()
|
||||
->readonly(),
|
||||
|
||||
Text::make('Department')
|
||||
->sortable()
|
||||
->filterable()
|
||||
->copyable()
|
||||
->readonly(),
|
||||
|
||||
Text::make('Phone')
|
||||
->sortable()
|
||||
->copyable()
|
||||
->readonly(),
|
||||
|
||||
Password::make('Password')
|
||||
->onlyOnForms()
|
||||
->creationRules($this->passwordRules())
|
||||
|
||||
Reference in New Issue
Block a user