Skip to content

Commit

Permalink
chore: add readme and arts
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdiunal committed Sep 10, 2024
1 parent 246a55e commit 0299e47
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 3 deletions.
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<img src="./art/banner.png" />

# Nova Editable Field

The purpose of this Laravel Nova Field is to allow easy updates to records within tables (development and testing for the Detail view are still in progress). So far, I haven't tested it with third-party components. It's very easy to use and can be seamlessly integrated with form fields and BelongsTo fields.

## Installation

```bash
composer require ferdiunal/nova-editable-field
```

## Usage

It is very easy to use, the first parameter is NovaRequest, the second one allows us to dynamically change the width of the Popover.

```php
<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\Email;
use Laravel\Nova\Fields\Gravatar;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;

class User extends Resource
{
/**
* The model the resource corresponds to.
*
* @var class-string<\App\Models\User>
*/
public static $model = \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()->hideFromIndex(),
Gravatar::make()->maxWidth(50),
Text::make('Name')
->sortable()
->maxlength(255)
->enforceMaxlength()
->rules('required', 'max:255')
->editable($request, '300px'),
Email::make('Email')
->sortable()
->rules('required', 'email', 'max:254')
->maxlength(254)
->enforceMaxlength()
->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}')
->editable($request),
];
}
}

```

## Screenshots

<img src="./art/image-1.png" />
<img src="./art/image-2.png" />
<img src="./art/image-3.png" />
<img src="./art/image-4.png" />
<img src="./art/image-5.png" />

License This package is open-sourced software licensed under the [MIT license](LICENSE).
Binary file added art/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 34 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
{
"name": "ferdiunal/nova-editable-field",
"description": "A Laravel Nova field.",
"description": "A Laravel Nova package to make fields editable.",
"authors": [
{
"name": "Ferdi Ünal",
"email": "[email protected]",
"homepage": "https://gitub.com/ferdiunal",
"role": "Developer"
}
],
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ferdiunal"
},
{
"type": "buymeacoffee",
"url": "https://buymeacoffee.com/ferdiunal"
}
],
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
],
"keywords": [
"laravel",
"nova"
"nova",
"editable",
"field",
"nova-editable-field",
"nova-editable",
"nova-field"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0"
"php": "^8.2",
"laravel/framework": "^10.0|^11.0",
"laravel/nova": "^4.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 0299e47

Please sign in to comment.