Skip to content

Commit

Permalink
Data Languages init
Browse files Browse the repository at this point in the history
  • Loading branch information
adrolli committed Dec 19, 2024
1 parent 1aa2fb5 commit eb4d201
Show file tree
Hide file tree
Showing 19 changed files with 782 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/data-languages/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [mooxphp]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
50 changes: 50 additions & 0 deletions packages/data-languages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Environment
.env
.env.backup

# Composer
/vendor
composer.lock
auth.json

# NPM / Node
/node_modules
npm-debug.log
package-lock.json

# Laravel
/public/hot
/public/storage
/storage/*.key

# PHPUnit
.phpunit.result.cache
phpunit.xml

# Yarn
yarn-error.log

# PHPStan
/build
phpstan.neon

# Testbench
testbench.yaml
/workbench/*

# PHP CS Fixer
.php-cs-fixer.cache

# Homestead
Homestead.json
Homestead.yaml

# IDEs
/.idea
/.vscode

# MacOS
.DS_Store

# Windows
Thumbs.db
5 changes: 5 additions & 0 deletions packages/data-languages/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

We currently don't track changes in this package. Please refer to the [Moox Monorepo](https://github.com/mooxphp/moox) for the latest changes.

We'll add a changelog in the future.
21 changes: 21 additions & 0 deletions packages/data-languages/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Moox <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
227 changes: 227 additions & 0 deletions packages/data-languages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
![Moox DataLanguages](https://github.com/mooxphp/moox/raw/main/art/banner/data-languages-package.jpg)

# Moox Data Languages

This is my package data-languages

## Quick Installation

These two commmands are all you need to install the package:

```bash
composer require moox/data-languages
php artisan data-languages:install
```

Curious what the install command does? See manual installation below.

## What it does

<!--whatdoes-->

This Laravel Package Template can be used to create a package including a powerful Filament resource called Item.

![Moox Builder Item](https://github.com/mooxphp/moox/raw/main/art/screenshot/builder-item.jpg)

Name and table for the Resource can be changed while building your package.

### Using the Template

1. Go to https://github.com/mooxphp/data-languages
2. Press the `Use this template` button
3. Create a new repository based on the template
4. Clone the repository locally
5. Run `php build.php`in the repo's directory and follow the steps
- Author Name (Default: Moox Developer): Your Name
- Author Email (Default: [email protected]): [email protected]
- Package Name (Default: Blog Package): Your Package
- Package Description (Default: This is my package Blog Package)
- Package Entity (Default: Item): e.g. Post
- Tablename (Default: items): e.g. posts

After building the package, you can push the changes to GitHub and create an installable package on Packagist.org. Don't forget to adjust the README to your composer namespace.

### Config

After that the Resource is highly configurable.

#### Tabs and Translation

Moox Core features like Dynamic Tabs and Translatable Config. See the config file for more details, but as a quick example:

```php
/*
|--------------------------------------------------------------------------
| Tabs
|--------------------------------------------------------------------------
|
| Define the tabs for the Resource table. They are optional, but
| pretty awesome to filter the table by certain values.
| You may simply do a 'tabs' => [], to disable them.
|
*/

'tabs' => [
'all' => [
'label' => 'trans//core::core.all',
'icon' => 'gmdi-filter-list',
'query' => [
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'published' => [
'label' => 'trans//core::core.published',
'icon' => 'gmdi-check-circle',
'query' => [
[
'field' => 'publish_at',
'operator' => '<=',
'value' => function () {
return now();
},
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'scheduled' => [
'label' => 'trans//core::core.scheduled',
'icon' => 'gmdi-schedule',
'query' => [
[
'field' => 'publish_at',
'operator' => '>',
'value' => function () {
return now();
},
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'draft' => [
'label' => 'trans//core::core.draft',
'icon' => 'gmdi-text-snippet',
'query' => [
[
'field' => 'publish_at',
'operator' => '=',
'value' => null,
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'deleted' => [
'label' => 'trans//core::core.deleted',
'icon' => 'gmdi-delete',
'query' => [
[
'field' => 'deleted_at',
'operator' => '!=',
'value' => null,
],
],
],
],
],
```

All options for Tabs are explained in [Moox Core docs](https://github.com/mooxphp/core/blob/main/README.md#dynamic-tabs).

#### Item Types

The item also support 'item' types, means you are able to configure selectable types for your Entity. By default, we provide "Post" and "Page" as example. If you don't want to use types, just empty the array and the field and column become invisible.

```php
/*
|--------------------------------------------------------------------------
| Item Types
|--------------------------------------------------------------------------
|
| This array contains the types of items entities. You can delete
| the types you don't need and add new ones. If you don't need
| types, you can empty this array like this: 'types' => [],
|
*/

'types' => [
'post' => 'Post',
'page' => 'Page',
],
```

#### Author Model

You can configure the user model used for displaying Authors. By default it is tied to App User:

```php
/*
|--------------------------------------------------------------------------
| Author Model
|--------------------------------------------------------------------------
|
| This sets the user model that can be used as author. It should be an
| authenticatable model and support the morph relationship.
| It should have fields similar to Moox User or WpUser.
|
*/

'author_model' => \App\Models\User::class,
```

You may probably use Moox User

```php
'author_model' => \Moox\User\Models\User::class,
```

or Moox Press User instead:

```php
'author_model' => \Moox\Press\Models\WpUser::class,
```

<!--/whatdoes-->

## Manual Installation

Instead of using the install-command `php artisan data-languages:install` you are able to install this package manually step by step:

```bash
// Publish and run the migrations:
php artisan vendor:publish --tag="data-languages-migrations"
php artisan migrate

// Publish the config file with:
php artisan vendor:publish --tag="data-languages-config"
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Security Vulnerabilities

Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities.

## Credits

- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
13 changes: 13 additions & 0 deletions packages/data-languages/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

We maintain the current version of `Moox Data Languages` actively.

Do not expect security fixes for older versions.

## Reporting a Vulnerability

If you find any security-related bug, please report it to [email protected].

Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things.
Loading

0 comments on commit eb4d201

Please sign in to comment.