-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mior Muhammad Zaki <[email protected]>
- Loading branch information
Showing
18 changed files
with
478 additions
and
50 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
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
laravel: '@testbench' | ||
|
||
providers: | ||
- Laravel\Nova\NovaServiceProvider | ||
- Laravel\Nova\NovaCoreServiceProvider | ||
- Workbench\App\Providers\NovaServiceProvider | ||
# - Workbench\App\Providers\WorkbenchServiceProvider | ||
|
||
migrations: true | ||
|
||
seeders: | ||
- Workbench\Database\Seeders\DatabaseSeeder | ||
|
||
workbench: | ||
start: /nova | ||
build: | ||
- package:discover | ||
- asset-publish | ||
- create-sqlite-db | ||
- db:wipe | ||
- migrate:refresh | ||
assets: | ||
- nova-assets | ||
sync: [] | ||
|
||
purge: | ||
directories: | ||
- lang/* | ||
- public/vendor/* |
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,45 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Models; | ||
|
||
// use Illuminate\Contracts\Auth\MustVerifyEmail; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Foundation\Auth\User as Authenticatable; | ||
use Illuminate\Notifications\Notifiable; | ||
use Laravel\Sanctum\HasApiTokens; | ||
|
||
class User extends Authenticatable | ||
{ | ||
use HasFactory, Notifiable; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array<int, string> | ||
*/ | ||
protected $fillable = [ | ||
'name', | ||
'email', | ||
'password', | ||
]; | ||
|
||
/** | ||
* The attributes that should be hidden for serialization. | ||
* | ||
* @var array<int, string> | ||
*/ | ||
protected $hidden = [ | ||
'password', | ||
'remember_token', | ||
]; | ||
|
||
/** | ||
* The attributes that should be cast. | ||
* | ||
* @var array<string, string> | ||
*/ | ||
protected $casts = [ | ||
'email_verified_at' => 'datetime', | ||
'password' => 'hashed', | ||
]; | ||
} |
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,45 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Nova; | ||
|
||
use Illuminate\Contracts\Database\Eloquent\Builder; | ||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
use Laravel\Nova\Resource as NovaResource; | ||
use Laravel\Scout\Builder as ScoutBuilder; | ||
|
||
abstract class Resource extends NovaResource | ||
{ | ||
/** | ||
* Build an "index" query for the given resource. | ||
*/ | ||
public static function indexQuery(NovaRequest $request, Builder $query): Builder | ||
{ | ||
return $query; | ||
} | ||
|
||
/** | ||
* Build a Scout search query for the given resource. | ||
*/ | ||
public static function scoutQuery(NovaRequest $request, ScoutBuilder $query): ScoutBuilder | ||
{ | ||
return $query; | ||
} | ||
|
||
/** | ||
* Build a "detail" query for the given resource. | ||
*/ | ||
public static function detailQuery(NovaRequest $request, Builder $query): Builder | ||
{ | ||
return parent::detailQuery($request, $query); | ||
} | ||
|
||
/** | ||
* Build a "relatable" query for the given resource. | ||
* | ||
* This query determines which instances of the model may be attached to other resources. | ||
*/ | ||
public static function relatableQuery(NovaRequest $request, Builder $query): Builder | ||
{ | ||
return parent::relatableQuery($request, $query); | ||
} | ||
} |
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,105 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Nova; | ||
|
||
use Illuminate\Http\Request; | ||
use Laravel\Nova\Auth\PasswordValidationRules; | ||
use Laravel\Nova\Fields\ID; | ||
use Laravel\Nova\Fields\Password; | ||
use Laravel\Nova\Fields\Text; | ||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
|
||
class User extends Resource | ||
{ | ||
use PasswordValidationRules; | ||
|
||
/** | ||
* The model the resource corresponds to. | ||
* | ||
* @var class-string<\Workbench\App\Models\User> | ||
*/ | ||
public static $model = \Workbench\App\Models\User::class; | ||
|
||
/** | ||
* The single value that should be used to represent the resource when being displayed. | ||
* | ||
* @var string | ||
*/ | ||
public static $title = 'name'; | ||
|
||
/** | ||
* The columns that should be searched. | ||
* | ||
* @var array | ||
*/ | ||
public static $search = [ | ||
'id', 'name', 'email', | ||
]; | ||
|
||
/** | ||
* Get the fields displayed by the resource. | ||
* | ||
* @return array<int, \Laravel\Nova\Fields\Field|\Laravel\Nova\Panel|\Laravel\Nova\ResourceTool|\Illuminate\Http\Resources\MergeValue> | ||
*/ | ||
public function fields(NovaRequest $request): array | ||
{ | ||
return [ | ||
ID::make()->sortable(), | ||
|
||
Text::make('Name') | ||
->sortable() | ||
->rules('required', 'max:255'), | ||
|
||
Text::make('Email') | ||
->sortable() | ||
->rules('required', 'email', 'max:254') | ||
->creationRules('unique:users,email') | ||
->updateRules('unique:users,email,{{resourceId}}'), | ||
|
||
Password::make('Password') | ||
->onlyOnForms() | ||
->creationRules($this->passwordRules()) | ||
->updateRules($this->optionalPasswordRules()), | ||
]; | ||
} | ||
|
||
/** | ||
* Get the cards available for the request. | ||
* | ||
* @return array<int, \Laravel\Nova\Card> | ||
*/ | ||
public function cards(NovaRequest $request): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Get the filters available for the resource. | ||
* | ||
* @return array<int, \Laravel\Nova\Filters\Filter> | ||
*/ | ||
public function filters(NovaRequest $request): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Get the lenses available for the resource. | ||
* | ||
* @return array<int, \Laravel\Nova\Lenses\Lens> | ||
*/ | ||
public function lenses(NovaRequest $request): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Get the actions available for the resource. | ||
* | ||
* @return array<int, \Laravel\Nova\Actions\Action> | ||
*/ | ||
public function actions(NovaRequest $request): array | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.