Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor into projection #3

Merged
merged 4 commits into from
Nov 23, 2021
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
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Laravel Cargo
# Laravel Quasar

[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravelcargo/laravel-cargo.svg?style=flat-square)](https://packagist.org/packages/laravelcargo/laravel-cargo)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/laravelcargo/laravel-cargo/run-tests?label=tests)](https://github.com/laravelcargo/laravel-cargo/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/laravelcargo/laravel-cargo/Check%20&%20fix%20styling?label=code%20style)](https://github.com/laravelcargo/laravel-cargo/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/laravelcargo/laravel-cargo.svg?style=flat-square)](https://packagist.org/packages/laravelcargo/laravel-cargo)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/timothepearce/laravel-cargo.svg?style=flat-square)](https://packagist.org/packages/timothepearce/laravel-quasar)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/timothepearce/laravel-cargo/run-tests?label=tests)](https://github.com/timothepearce/laravel-quasar/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/timothepearce/laravel-cargo/Check%20&%20fix%20styling?label=code%20style)](https://github.com/timothepearce/laravel-quasar/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/timothepearce/laravel-cargo.svg?style=flat-square)](https://packagist.org/packages/timothepearce/laravel-quasar)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Expand All @@ -12,35 +12,25 @@ This is where your description should go. Limit it to a paragraph or two. Consid
You can install the package via composer:

```bash
composer require laravelcargo/laravel-cargo
composer require timothepearce/laravel-quasar
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --provider="Laravelcargo\LaravelCargo\QuasarServiceProvider" --tag="laravel-cargo-migrations"
php artisan vendor:publish --provider="TimothePearce\Quasar\QuasarServiceProvider" --tag="quasar-migrations"
php artisan migrate
```

You can publish the config file with:
```bash
php artisan vendor:publish --provider="Laravelcargo\LaravelCargo\QuasarServiceProvider" --tag="laravel-cargo-config"
php artisan vendor:publish --provider="TimothePearce\Quasar\QuasarServiceProvider" --tag="quasar-config"
```

This is the contents of the published config file:

```php
return [
];
```

## Usage

```php
$laravelCargo = new Laravelcargo\LaravelCargo();
echo $laravelCargo->echoPhrase('Hello, Spatie!');
```

## Testing

```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TimothePearce\Quasar;
namespace TimothePearce\Quasar\Collections;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Carbon;
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Projection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use TimothePearce\Quasar\Collections\ProjectionCollection;
use TimothePearce\Quasar\Exceptions\MissingProjectionPeriodException;
use TimothePearce\Quasar\Exceptions\MissingProjectorNameException;
use TimothePearce\Quasar\ProjectionCollection;

class Projection extends Model
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

namespace TimothePearce\Quasar;
namespace TimothePearce\Quasar\Models\Traits;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use ReflectionException;
use TimothePearce\Quasar\Jobs\ProcessProjection;
use TimothePearce\Quasar\Models\Projection;
use TimothePearce\Quasar\Projector;

trait WithProjections
{
Expand Down
2 changes: 1 addition & 1 deletion testbench.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
providers:
- Laravelcargo\LaravelCargo\QuasarServiceProvider
- TimothePearce\Quasar\QuasarServiceProvider
2 changes: 1 addition & 1 deletion tests/Models/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use TimothePearce\Quasar\Models\Traits\WithProjections;
use TimothePearce\Quasar\Tests\Projectors\SinglePeriodProjector;
use TimothePearce\Quasar\WithProjections;

class Log extends Model
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use TimothePearce\Quasar\Models\Traits\WithProjections;
use TimothePearce\Quasar\Tests\Projectors\SinglePeriodProjector;
use TimothePearce\Quasar\WithProjections;

class Message extends Model
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ProjectionCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace TimothePearce\Quasar\Tests;

use Illuminate\Support\Carbon;
use TimothePearce\Quasar\Collections\ProjectionCollection;
use TimothePearce\Quasar\Exceptions\EmptyProjectionCollectionException;
use TimothePearce\Quasar\Exceptions\MultiplePeriodsException;
use TimothePearce\Quasar\Exceptions\MultipleProjectorsException;
use TimothePearce\Quasar\Exceptions\OverlappingFillBetweenDatesException;
use TimothePearce\Quasar\Models\Projection;
use TimothePearce\Quasar\ProjectionCollection;
use TimothePearce\Quasar\Tests\Models\Log;
use TimothePearce\Quasar\Tests\Projectors\MultiplePeriodsProjector;
use TimothePearce\Quasar\Tests\Projectors\SinglePeriodProjector;
Expand Down
2 changes: 1 addition & 1 deletion tests/ProjectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace TimothePearce\Quasar\Tests;

use Illuminate\Support\Carbon;
use TimothePearce\Quasar\Collections\ProjectionCollection;
use TimothePearce\Quasar\Exceptions\MissingProjectionPeriodException;
use TimothePearce\Quasar\Exceptions\MissingProjectorNameException;
use TimothePearce\Quasar\Models\Projection;
use TimothePearce\Quasar\ProjectionCollection;
use TimothePearce\Quasar\Tests\Models\Log;
use TimothePearce\Quasar\Tests\Projectors\MultiplePeriodsProjector;
use TimothePearce\Quasar\Tests\Projectors\SinglePeriodProjector;
Expand Down