Skip to content

Commit

Permalink
WIP@
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Apr 16, 2020
1 parent a6b3272 commit 9df4823
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
# Very short description of the package
# Blueprint Nova Addon

[![Latest Version on Packagist](https://img.shields.io/packagist/v/naoray/blueprint-nova-addon.svg?style=flat-square)](https://packagist.org/packages/naoray/blueprint-nova-addon)
[![Build Status](https://img.shields.io/travis/naoray/blueprint-nova-addon/master.svg?style=flat-square)](https://travis-ci.org/naoray/blueprint-nova-addon)
[![Quality Score](https://img.shields.io/scrutinizer/g/naoray/blueprint-nova-addon.svg?style=flat-square)](https://scrutinizer-ci.com/g/naoray/blueprint-nova-addon)
[![Total Downloads](https://img.shields.io/packagist/dt/naoray/blueprint-nova-addon.svg?style=flat-square)](https://packagist.org/packages/naoray/blueprint-nova-addon)

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
:mega: Shoutout to [Jason McCreary](https://github.com/jasonmccreary) whose [Blueprint](https://github.com/laravel-shift/blueprint) package lays the groundwork for this small addon. Thank you Jason :raised_hands:

## Installation
Installing this addon will allow you to generate your Nova resources with the `php artisan blueprint:build` command.

## Installation
You can install the package via composer:

```bash
composer require naoray/blueprint-nova-addon
composer require naoray/blueprint-nova-addon --dev
```

## Usage
> :warning: You need to have [laravel nova](nova.laravel.com/) installed in order for the resource generation to take place!
``` php
// Usage description here
## Usage
Refer to [Blueprint's Basic Usage](https://github.com/laravel-shift/blueprint#basic-usage) to get started. Afterwards you can run the `blueprint:build` command to generate Nova resources automatically. To get an idea of how easy it is you can use the example `draft.yaml` file below.

```yaml
# draft.yaml
models:
Post:
author_id: id:user
title: string:400
content: longtext
published_at: nullable timestamp
relationships:
HasMany: Comment

Comment:
post_id:i
content: longtext
published_at: nullable timestamp
```
From these simple 20 lines of YAML, Blueprint will generate all of the following Laravel components:
### Testing
``` bash
Expand Down
11 changes: 2 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"require": {
"illuminate/pipeline": "^7.0",
"illuminate/support": "^7.0",
"laravel-shift/blueprint": "^1.5",
"laravel/nova": "^3.4"
"laravel-shift/blueprint": "^1.5"
},
"require-dev": {
"orchestra/testbench": "^5.0",
Expand Down Expand Up @@ -48,11 +47,5 @@
"Naoray\\BlueprintNovaAddon\\BlueprintNovaAddonServiceProvider"
]
}
},
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
]
}
}
9 changes: 5 additions & 4 deletions src/BlueprintNovaAddonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Naoray\BlueprintNovaAddon;

use Blueprint\Blueprint;
use Illuminate\Support\ServiceProvider;

class BlueprintNovaAddonServiceProvider extends ServiceProvider
Expand All @@ -11,10 +12,10 @@ class BlueprintNovaAddonServiceProvider extends ServiceProvider
*/
public function register()
{
// $this->app->extends(Blueprint::class, function ($app) {
// $blueprint->registerGenerator(new \Blueprint\Generators\TestGenerator($app['files']));
$this->app->extend(Blueprint::class, function ($blueprint, $app) {
$blueprint->registerGenerator(new NovaGenerator($app['files']));

// return $blueprint;
// });
return $blueprint;
});
}
}

0 comments on commit 9df4823

Please sign in to comment.