Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) webfox <[email protected].nz>
Copyright (c) Foxbyte Ltd <devops@foxbyte.nz>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Laravel Data Providers for Inertia.js

[![Latest Version on Packagist](https://img.shields.io/packagist/v/webfox/laravel-inertia-dataproviders.svg?style=flat-square)](https://packagist.org/packages/webfox/laravel-inertia-dataproviders)
[![Total Downloads](https://img.shields.io/packagist/dt/webfox/laravel-inertia-dataproviders.svg?style=flat-square)](https://packagist.org/packages/webfox/laravel-inertia-dataproviders)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/foxbytehq/laravel-inertia-dataproviders.svg?style=flat-square)](https://packagist.org/packages/foxbytehq/laravel-inertia-dataproviders)
[![Total Downloads](https://img.shields.io/packagist/dt/foxbytehq/laravel-inertia-dataproviders.svg?style=flat-square)](https://packagist.org/packages/foxbytehq/laravel-inertia-dataproviders)

Data providers encapsulate logic for Inertia views, keep your controllers clean and simple.

Expand All @@ -10,13 +10,13 @@ Data providers encapsulate logic for Inertia views, keep your controllers clean
Install this package via composer:

```bash
composer require webfox/laravel-inertia-dataproviders
composer require foxbytehq/laravel-inertia-dataproviders
```

Optionally publish the configuration file:

```bash
php artisan vendor:publish --provider="Webfox\InertiaDataProviders\InertiaDataProvidersServiceProvider"
php artisan vendor:publish --provider="Foxbyte\InertiaDataProviders\InertiaDataProvidersServiceProvider"
````

We assume you've already got the Inertia adapter for Laravel installed.
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace App\Http\DataProviders;

use Inertia\LazyProp;
use App\Services\InjectedDependency;
use Webfox\InertiaDataProviders\DataProvider;
use Foxbyte\InertiaDataProviders\DataProvider;

class DemoDataProvider extends DataProvider
{
Expand All @@ -123,7 +123,7 @@ namespace App\Http\DataProviders;
use Inertia\DeferProp;
use Inertia\LazyProp;
use App\Services\InjectedDependency;
use Webfox\InertiaDataProviders\DataProvider;
use Foxbyte\InertiaDataProviders\DataProvider;

class DemoDataProvider extends DataProvider
{
Expand Down Expand Up @@ -303,7 +303,7 @@ class DemoController extends Controller

## Attribute Name Formatting
The attribute name format can be configured in the configuration file by setting the `attribute_name_formatter`.
The package ships with three formatters under the namespace `\Webfox\InertiaDataProviders\AttributeNameFormatters` but you are free to create your own.
The package ships with three formatters under the namespace `\Foxbyte\InertiaDataProviders\AttributeNameFormatters` but you are free to create your own.

### AsWritten
This is the default formatter. The output attribute name will be the same as the input name.
Expand Down
19 changes: 11 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"name": "webfox/laravel-inertia-dataproviders",
"name": "foxbytehq/laravel-inertia-dataproviders",
"description": "Data providers to encapsulate logic for Inertia views",
"keywords": [
"webfox",
"foxbytehq",
"laravel",
"inertia"
],
"homepage": "https://github.com/webfox/laravel-inertia-dataproviders",
"homepage": "https://github.com/foxbytehq/laravel-inertia-dataproviders",
"license": "MIT",
"authors": [
{
"name": "Webfox Developments Ltd",
"email": "[email protected].nz",
"name": "Foxbyte Ltd",
"email": "devops@foxbyte.nz",
"role": "Developer"
}
],
"replace": {
"webfox/laravel-inertia-dataproviders": "*"
},
"suggest": {
"inertiajs/inertia-laravel": "Needed for basic inertia functionality"
},
Expand All @@ -38,12 +41,12 @@
},
"autoload": {
"psr-4": {
"Webfox\\InertiaDataProviders\\": "src"
"Foxbyte\\InertiaDataProviders\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Webfox\\InertiaDataProviders\\Tests\\": "tests"
"Foxbyte\\InertiaDataProviders\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -61,7 +64,7 @@
"extra": {
"laravel": {
"providers": [
"Webfox\\InertiaDataProviders\\InertiaDataProvidersServiceProvider"
"Foxbyte\\InertiaDataProviders\\InertiaDataProvidersServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/inertia-dataproviders.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'attribute_name_formatter' => \Webfox\InertiaDataProviders\AttributeNameFormatters\AsWritten::class,
'attribute_name_formatter' => \Foxbyte\InertiaDataProviders\AttributeNameFormatters\AsWritten::class,
];
Comment on lines +4 to 5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to the PSR-12 standard, all PHP files must end with a single blank line. This file is missing a final newline character.

    'attribute_name_formatter' => \Foxbyte\InertiaDataProviders\AttributeNameFormatters\AsWritten::class,
];

2 changes: 1 addition & 1 deletion ide.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"codeGenerations": [
{
"id": "webfox.create-inertia-data-provider",
"id": "foxbyte.create-inertia-data-provider",
"name": "Create Inertia Data Provider",
"classSuffix": "DataProvider",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
verbose="true"
>
<testsuites>
<testsuite name="Webfox Test Suite">
<testsuite name="Foxbyte Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/AttributeNameFormatters/AsWritten.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders\AttributeNameFormatters;
namespace Foxbyte\InertiaDataProviders\AttributeNameFormatters;

class AsWritten implements AttributeNameFormatter
{
Expand Down
2 changes: 1 addition & 1 deletion src/AttributeNameFormatters/AttributeNameFormatter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders\AttributeNameFormatters;
namespace Foxbyte\InertiaDataProviders\AttributeNameFormatters;

interface AttributeNameFormatter
{
Expand Down
2 changes: 1 addition & 1 deletion src/AttributeNameFormatters/CamelCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders\AttributeNameFormatters;
namespace Foxbyte\InertiaDataProviders\AttributeNameFormatters;

use Illuminate\Support\Str;

Expand Down
2 changes: 1 addition & 1 deletion src/AttributeNameFormatters/SnakeCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders\AttributeNameFormatters;
namespace Foxbyte\InertiaDataProviders\AttributeNameFormatters;

use Illuminate\Support\Str;

Expand Down
4 changes: 2 additions & 2 deletions src/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Webfox\InertiaDataProviders;
namespace Foxbyte\InertiaDataProviders;

use Closure;
use Foxbyte\InertiaDataProviders\AttributeNameFormatters\AttributeNameFormatter;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Inertia\DeferProp;
Expand All @@ -15,7 +16,6 @@
use ReflectionNamedType;
use ReflectionProperty;
use Symfony\Component\VarDumper\VarDumper;
use Webfox\InertiaDataProviders\AttributeNameFormatters\AttributeNameFormatter;

abstract class DataProvider implements Arrayable, Jsonable
{
Expand Down
2 changes: 1 addition & 1 deletion src/DataProviderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Webfox\InertiaDataProviders;
namespace Foxbyte\InertiaDataProviders;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;
Expand Down
2 changes: 1 addition & 1 deletion src/InertiaDataProviderMakeCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders;
namespace Foxbyte\InertiaDataProviders;

use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Attribute\AsCommand;
Expand Down
2 changes: 1 addition & 1 deletion src/InertiaDataProvidersServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Webfox\InertiaDataProviders;
namespace Foxbyte\InertiaDataProviders;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
Expand Down
2 changes: 1 addition & 1 deletion stubs/inertia-data-provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace {{ namespace }};

use Webfox\InertiaDataProviders\DataProvider;
use Foxbyte\InertiaDataProviders\DataProvider;

class {{ class }} extends DataProvider
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use Webfox\InertiaDataProviders\Tests\TestCase;
use Foxbyte\InertiaDataProviders\Tests\TestCase;

uses(TestCase::class)->in(__DIR__);
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Webfox\InertiaDataProviders\Tests;
namespace Foxbyte\InertiaDataProviders\Tests;

use Foxbyte\InertiaDataProviders\InertiaDataProvidersServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use Webfox\InertiaDataProviders\InertiaDataProvidersServiceProvider;

class TestCase extends Orchestra
{
Expand All @@ -13,7 +13,7 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Webfox\\InertiaDataProviders\\Database\\Factories\\'.class_basename($modelName).'Factory'
fn (string $modelName) => 'Foxbyte\\InertiaDataProviders\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
}

Expand Down