Skip to content

Commit

Permalink
Add Laravel Nova as admin interface (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxjj authored Oct 14, 2024
1 parent a476f4e commit a9498c9
Show file tree
Hide file tree
Showing 118 changed files with 4,032 additions and 1,034 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- run: composer install --no-interaction --prefer-dist --ignore-platform-reqs
- run: |
php --version
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_LICENSE_KEY }}"
composer install --no-interaction --prefer-dist --ignore-platform-reqs
- name: Build
run: docker compose build
Expand Down
11 changes: 11 additions & 0 deletions app/Constants/LTIGradeMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Constants;

class LTIGradeMode
{
// how the LMS should handle grades for a chime
const NO_GRADES = "no_grades";
const ONE_GRADE = "one_grade";
const MULTIPLE_GRADES = "multiple_grades";
}
12 changes: 12 additions & 0 deletions app/Constants/LTIGradeOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Constants;

class LTIGradeOptions
{
public const FULL_CREDIT_FOR_INCORRECT = 0;

public const NO_CREDIT_FOR_INCORRECT = 1;

public const HALF_CREDIT_FOR_INCORRECT = 2;
}
138 changes: 0 additions & 138 deletions app/Http/Controllers/Admin/UsersController.php

This file was deleted.

9 changes: 7 additions & 2 deletions app/LTI13Deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

namespace App;


use Illuminate\Database\Eloquent\Model;

class LTI13Deployment extends Model
{
protected $table = 'lti13_deployments';
public function issuer() {

public function issuer()
{
return $this->belongsTo(LTI13Issuer::class);
}

public function resourceLinks()
{
return $this->hasMany(LTI13ResourceLink::class, 'deployment_id');
}
}
96 changes: 96 additions & 0 deletions app/Nova/AuthenticationLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace App\Nova;

use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\DateTime;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Query\Search\SearchableMorphToRelation;
use Yadahan\AuthenticationLog\AuthenticationLog as AuthenticationLogModel;

class AuthenticationLog extends Resource
{
/**
* The model the resource corresponds to.
*/
public static $model = AuthenticationLogModel::class;

/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';

/**
* The columns that should be searched.
*
* @var array
*/
public static function searchableColumns()
{
return [
'id',
'ip_address',
new SearchableMorphToRelation('authenticatable', 'name', [User::class]),
];
}

/**
* Get the fields displayed by the resource.
*
* @return array
*/
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
BelongsTo::make('User', 'authenticatable', User::class)->sortable()->filterable(),
DateTime::make('Login At', 'login_at')->sortable()->filterable(),
Text::make('IP Address', 'ip_address')->filterable(),
Text::make('User Agent', 'user_agent'),
];
}

/**
* Get the cards available for the request.
*
* @return array
*/
public function cards(NovaRequest $request)
{
return [];
}

/**
* Get the filters available for the resource.
*
* @return array
*/
public function filters(NovaRequest $request)
{
return [];
}

/**
* Get the lenses available for the resource.
*
* @return array
*/
public function lenses(NovaRequest $request)
{
return [];
}

/**
* Get the actions available for the resource.
*
* @return array
*/
public function actions(NovaRequest $request)
{
return [];
}
}
Loading

0 comments on commit a9498c9

Please sign in to comment.