-
Notifications
You must be signed in to change notification settings - Fork 44
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
13 changed files
with
454 additions
and
4 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 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,26 @@ | ||
providers: | ||
- Laravel\Nova\NovaCoreServiceProvider | ||
- Workbench\App\Providers\NovaServiceProvider | ||
|
||
migrations: true | ||
|
||
seeders: | ||
- Workbench\Database\Seeders\DatabaseSeeder | ||
|
||
workbench: | ||
start: /nova | ||
user: [email protected] | ||
build: | ||
- package-discover | ||
- asset-publish | ||
- create-sqlite-db | ||
- db:wipe | ||
- migrate:refresh | ||
assets: | ||
- nova-assets | ||
sync: [] | ||
|
||
purge: | ||
directories: | ||
- lang/* | ||
- public/vendor/* |
45 changes: 45 additions & 0 deletions
45
nova-components/ResourceTool/workbench/app/Models/User.php
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', | ||
]; | ||
} |
45 changes: 45 additions & 0 deletions
45
nova-components/ResourceTool/workbench/app/Nova/Resource.php
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); | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
nova-components/ResourceTool/workbench/app/Nova/User.php
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,106 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Nova; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Validation\Rules; | ||
use Laravel\Nova\Fields\ID; | ||
use Laravel\Nova\Fields\Password; | ||
use Laravel\Nova\Fields\Text; | ||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
use Otwell\ResourceTool\ResourceTool; | ||
|
||
class User extends Resource | ||
{ | ||
/** | ||
* The model the resource corresponds to. | ||
* | ||
* @var string | ||
*/ | ||
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 | ||
*/ | ||
public function fields(NovaRequest $request) | ||
{ | ||
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('required', Rules\Password::defaults()) | ||
->updateRules('nullable', Rules\Password::defaults()), | ||
|
||
ResourceTool::make(), | ||
]; | ||
} | ||
|
||
/** | ||
* 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 []; | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
nova-components/ResourceTool/workbench/app/Providers/NovaServiceProvider.php
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,90 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Providers; | ||
|
||
use Illuminate\Support\Facades\Gate; | ||
use Laravel\Nova\DevTool\DevTool as Nova; | ||
use Laravel\Nova\NovaApplicationServiceProvider; | ||
use Orchestra\Workbench\Workbench; | ||
|
||
class NovaServiceProvider extends NovaApplicationServiceProvider | ||
{ | ||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
parent::boot(); | ||
} | ||
|
||
/** | ||
* Register the Nova routes. | ||
* | ||
* @return void | ||
*/ | ||
protected function routes() | ||
{ | ||
Nova::routes() | ||
->withAuthenticationRoutes() | ||
->withPasswordResetRoutes() | ||
->register(); | ||
} | ||
|
||
/** | ||
* Register the Nova gate. | ||
* | ||
* This gate determines who can access Nova in non-local environments. | ||
* | ||
* @return void | ||
*/ | ||
protected function gate() | ||
{ | ||
Gate::define('viewNova', function ($user) { | ||
return true; | ||
}); | ||
} | ||
|
||
/** | ||
* Get the dashboards that should be listed in the Nova sidebar. | ||
* | ||
* @return array | ||
*/ | ||
protected function dashboards() | ||
{ | ||
return [ | ||
new \Laravel\Nova\Dashboards\Main(), | ||
]; | ||
} | ||
|
||
/** | ||
* Get the tools that should be listed in the Nova sidebar. | ||
* | ||
* @return array | ||
*/ | ||
public function tools() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Register the application's Nova resources. | ||
* | ||
* @return void | ||
*/ | ||
protected function resources() | ||
{ | ||
Nova::resourcesIn(Workbench::path('app/Nova')); | ||
} | ||
|
||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
nova-components/ResourceTool/workbench/app/Providers/WorkbenchServiceProvider.php
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,24 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class WorkbenchServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register services. | ||
*/ | ||
public function register(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Bootstrap services. | ||
*/ | ||
public function boot(): void | ||
{ | ||
// | ||
} | ||
} |
Empty file.
Oops, something went wrong.