Skip to content

Commit 883410b

Browse files
committed
fix install command
1 parent 33140c2 commit 883410b

File tree

7 files changed

+102
-13
lines changed

7 files changed

+102
-13
lines changed

README.md

+35-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
Wind is another package from Lara-Zeus, it's simply provide you with a contact form, with simple dashboard to read and replay to any messages you receive from your website.
66
>small tasks can be time-consuming, let us build these for you,
77
8-
98
## features:
109
- 🔥 built with [TALL stack](https://tallstack.dev/)
1110
- 🔥 using [filament](https://filamentadmin.com) as an admin panel
12-
13-
11+
- 🔥 optionally you can add categories to the contact form like 'sales','dev','report bug' etc.
12+
- 🔥 you can add logos for all categories.
13+
- 🔥 direct URL to contact on specific category.
1414

1515
## Installation
1616

@@ -20,11 +20,41 @@ You can install the package via composer:
2020
composer require lara-zeus/wind
2121
```
2222

23+
run the command:
24+
25+
```bash
26+
php artisan wind:install
27+
```
28+
29+
which will run the following commands:
30+
31+
```bash
32+
php artisan vendor:publish --tag=zeus-wind-config
33+
php artisan vendor:publish --tag=zeus-wind-migrations
34+
php artisan vendor:publish --tag=zeus-wind-views
35+
php artisan vendor:publish --tag=zeus-wind-seeder
36+
php artisan vendor:publish --tag=zeus-wind-factories
37+
php artisan vendor:publish --tag=zeus-zeus-config
38+
php artisan vendor:publish --tag=zeus-zeus-views
39+
php artisan vendor:publish --tag=zeus-zeus-assets
40+
php artisan migrate
41+
```
42+
43+
you can pass `--force` option to force publishing all files
44+
45+
```bash
46+
php artisan wind:install --force
47+
```
48+
2349
## Usage
2450

25-
visit the url `/admin` or `/contact-us`
26-
> you can configer the URL from the config file
51+
visit the url `/admin` to manage the Letters, and `/contact-us` to access the contact form.
52+
> you can configure the URL from the config file
2753
54+
if you dont have a user, or it's a fresh instalation of laravel, you can use the command to create a new user
55+
```bash
56+
php artisan make:filament-user
57+
```
2858

2959
## Changelog
3060

config/zeus-wind.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
return [
4-
'defaultCategoryId' => 1,
5-
64
'enableCategories' => true,
75

6+
'defaultCategoryId' => 1,
7+
88
'layout' => 'zeus::components.layouts.app',
99
];

database/migrations/create_category_table.php database/migrations/create_category_table.php.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
class Category extends Migration
7+
class CreateCategoryTable extends Migration
88
{
99
/**
1010
* Run the migrations.

database/migrations/create_letters_table.php database/migrations/create_letters_table.php.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Support\Facades\Schema;
66

7-
class Letters extends Migration
7+
class CreateLettersTable extends Migration
88
{
99
/**
1010
* Run the migrations.

src/Console/InstallCommand.php

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace LaraZeus\Wind\Console;
4+
5+
use Illuminate\Console\Command;
6+
7+
class InstallCommand extends Command
8+
{
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected $signature = 'wind:install {--force : Overwrite any existing files}';
15+
/**
16+
* The console command description.
17+
*
18+
* @var string
19+
*/
20+
protected $description = 'Install the Wind components and resources';
21+
22+
/**
23+
* Execute the console command.
24+
*
25+
* @return void
26+
*/
27+
public function handle()
28+
{
29+
// art vendor:publish --tag=zeus-wind-migrations
30+
// publish Wind files
31+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-wind-config', '--force' => $this->option('force') ?? false]);
32+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-wind-migrations', '--force' => $this->option('force') ?? false]);
33+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-wind-views', '--force' => $this->option('force') ?? false]);
34+
35+
$this->callSilent('vendor:publish', ['--tag' => 'wind-seeder', '--force' => $this->option('force') ?? false]);
36+
$this->callSilent('vendor:publish', ['--tag' => 'wind-factories', '--force' => $this->option('force') ?? false]);
37+
38+
// publish Zeus files
39+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-config', '--force' => $this->option('force') ?? false]);
40+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-views', '--force' => $this->option('force') ?? false]);
41+
$this->callSilent('vendor:publish', ['--tag' => 'zeus-assets', '--force' => $this->option('force') ?? false]);
42+
43+
$this->callSilent('migrate');
44+
45+
$this->output->success('Zeus Wind has been installed successfully');
46+
}
47+
}

src/Http/Livewire/Contacts.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
class Contacts extends Component
1111
{
1212
public ?string $category = null;
13-
public $name = 'sdfsdfsdf';
14-
public $email = '[email protected]';
13+
public $name = '';
14+
public $email = '';
1515
public $category_id = 1;
16-
public $title = 'sdfsdfsdf';
17-
public $message = 'sdfsdfsdf';
16+
public $title = '';
17+
public $message = '';
1818
public $sent = false;
1919

2020
protected $rules = [

src/WindServiceProvider.php

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace LaraZeus\Wind;
44

55
use Filament\PluginServiceProvider;
6+
use LaraZeus\Wind\Console\InstallCommand;
67
use LaraZeus\Wind\Filament\Resources\CategoryResource;
78
use LaraZeus\Wind\Filament\Resources\LetterResource;
89
use LaraZeus\Wind\Http\Livewire\Contacts;
@@ -25,6 +26,16 @@ public function boot()
2526
{
2627
Livewire::component('contact', Contacts::class);
2728

29+
if ($this->app->runningInConsole()) {
30+
$this->publishes([
31+
__DIR__.'/../database/seeders' => database_path('seeders'),
32+
], 'wind-seeder');
33+
34+
$this->publishes([
35+
__DIR__.'/../database/factories' => database_path('factories'),
36+
], 'wind-factories');
37+
}
38+
2839
return parent::boot();
2940
}
3041

@@ -34,6 +45,7 @@ public function configurePackage(Package $package): void
3445
$package
3546
->hasConfigFile()
3647
->hasMigrations(['create_category_table', 'create_letters_table'])
48+
->hasCommand(InstallCommand::class)
3749
->hasRoute('web');
3850
}
3951
}

0 commit comments

Comments
 (0)