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

murdercode tracking #3

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ phpunit.xml
.phpunit.result.cache
composer.lock
vendor/
.dccache
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
![](.github/banner.png)

### Please do not use this package but instead use the official one.

# Laravel TMDB

[![Latest Version](http://img.shields.io/packagist/v/astrotomic/laravel-tmdb.svg?label=Release&style=for-the-badge)](https://packagist.org/packages/astrotomic/laravel-tmdb)
Expand Down Expand Up @@ -68,9 +70,11 @@ This will do one HTTP call per model and save multiple HTTP calls in the future.

```php
use Astrotomic\Tmdb\Models\MovieGenre;
use Astrotomic\Tmdb\Models\TvGenre;
use Astrotomic\Tmdb\Models\WatchProvider;

MovieGenre::all();
TvGenre::all();
WatchProvider::all();
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "astrotomic/laravel-tmdb",
"name": "murdercode/laravel-tmdb",
"description": "Interact with TMDB data in your Laravel application.",
"license": "MIT",
"authors": [
Expand Down
24 changes: 24 additions & 0 deletions database/migrations/2022_01_19_150000_create_tv_genres_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Astrotomic\Tmdb\Models\TvGenre;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(TvGenre::connection())->create(TvGenre::table(), static function (Blueprint $table): void {
$table->bigInteger('id')->unsigned()->primary();

$table->json('name');

$table->timestamps();
});
}

public function down(): void
{
Schema::connection(TvGenre::connection())->dropIfExists(TvGenre::table());
}
};
27 changes: 27 additions & 0 deletions database/migrations/2022_01_19_153000_create_networks_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use Astrotomic\Tmdb\Models\Network;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(Network::connection())->create(Network::table(), static function (Blueprint $table): void {
$table->bigInteger('id')->unsigned()->primary();
$table->string('headquarters')->nullable();
$table->json('homepage')->nullable();
$table->json('logo_path')->nullable();
$table->json('languages')->nullable();
$table->json('name')->nullable();
$table->string('origin_country')->nullable();
$table->timestamps();
});
}

public function down(): void
{
Schema::connection(Network::connection())->dropIfExists(Network::table());
}
};
45 changes: 45 additions & 0 deletions database/migrations/2022_01_19_160000_create_tvs_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use Astrotomic\Tmdb\Models\Tv;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(Tv::connection())->create(Tv::table(), static function (Blueprint $table): void {
$table->bigInteger('id')->unsigned()->primary();
$table->string('backdrop_path')->nullable();
$table->json('episode_run_time')->nullable();
$table->date('first_air_date')->nullable();
$table->json('homepage')->nullable();
$table->boolean('in_production')->nullable();
$table->json('languages')->nullable();
$table->date('last_air_date')->nullable();
$table->json('name')->nullable();
$table->integer('number_of_episodes')->nullable();
$table->integer('number_of_seasons')->nullable();
$table->json('origin_country')->nullable();
$table->string('original_language', 2)->nullable();
$table->string('original_name')->nullable();
$table->json('overview')->nullable();
$table->decimal('popularity')->unsigned()->nullable();
$table->json('poster_path')->nullable();
$table->json('production_companies')->nullable();
$table->json('production_countries')->nullable();
$table->json('spoken_languages')->nullable();
$table->string('status')->nullable();
$table->json('tagline')->nullable();
$table->string('type')->nullable();
$table->decimal('vote_average')->nullable();
$table->integer('vote_count')->default(0);
$table->timestamps();
});
}

public function down(): void
{
Schema::connection(Tv::connection())->dropIfExists(Tv::table());
}
};
24 changes: 24 additions & 0 deletions database/migrations/2022_01_19_180000_create_tv_tv_gerne.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Astrotomic\Tmdb\Models\Tv;
use Astrotomic\Tmdb\Models\TvGenre;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(Tv::connection())->create('tv_tv_genre', static function (Blueprint $table): void {
$table->foreignId('tv_id')->constrained(Tv::table());
$table->foreignId('tv_genre_id')->constrained(TvGenre::table());

$table->unique(['tv_id', 'tv_genre_id']);
});
}

public function down(): void
{
Schema::connection(Tv::connection())->dropIfExists('tv_tv_genre');
}
};
24 changes: 24 additions & 0 deletions database/migrations/2022_01_20_121500_create_network_tv_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Astrotomic\Tmdb\Models\Network;
use Astrotomic\Tmdb\Models\Tv;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(Tv::connection())->create('network_tv', static function (Blueprint $table): void {
$table->foreignId('tv_id')->constrained(Tv::table());
$table->foreignId('network_id')->constrained(Network::table());

$table->unique(['tv_id', 'network_id']);
});
}

public function down(): void
{
Schema::connection(Tv::connection())->dropIfExists('network_tv');
}
};
29 changes: 29 additions & 0 deletions database/migrations/2022_01_20_130000_create_tv_seasons_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use Astrotomic\Tmdb\Models\Tv;
use Astrotomic\Tmdb\Models\TvSeason;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::connection(TvSeason::connection())->create(TvSeason::table(), static function (Blueprint $table): void {
$table->bigInteger('id')->unsigned()->primary();
$table->date('air_date')->nullable();
$table->json('name')->nullable();
$table->json('overview')->nullable();
$table->json('poster_path')->nullable();
$table->integer('season_number')->nullable();
$table->foreignId('tv_id')->nullable()->constrained(Tv::table());

$table->timestamps();
});
}

public function down(): void
{
Schema::connection(TvSeason::connection())->dropIfExists(TvSeason::table());
}
};
33 changes: 33 additions & 0 deletions database/migrations/2022_01_21_110000_create_tv_episodes_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Astrotomic\Tmdb\Models\TvEpisode;
use Astrotomic\Tmdb\Models\TvSeason;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
{
public function up(): void
{
Schema::connection(TvEpisode::connection())->create(TvEpisode::table(), static function (Blueprint $table): void {
$table->bigInteger('id')->unsigned()->primary();
$table->date('air_date')->nullable();
$table->json('name')->nullable();
$table->json('overview')->nullable();
$table->string('production_code')->nullable();
$table->integer('season_number')->nullable();
$table->string('still_path')->nullable();
$table->decimal('vote_average')->nullable();
$table->integer('vote_count')->default(0);
$table->foreignId('tv_season_id')->nullable()->constrained(TvSeason::table());

$table->timestamps();
});
}

public function down(): void
{
Schema::connection(TvEpisode::connection())->dropIfExists(TvEpisode::table());
}
};
18 changes: 18 additions & 0 deletions src/Eloquent/Builders/NetworkBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Builders;

use Astrotomic\Tmdb\Models\Network;
use Illuminate\Database\Eloquent\Collection;

/**
* @method Network newModelInstance(array $attributes = [])
* @method Network|Collection|null find(int|int[]|Arrayable $id, array $columns = ['*'])
* @method Collection findMany(int[]|Arrayable $ids, array $columns = ['*'])
* @method Network|Collection findOrFail(int|int[]|Arrayable $id, array $columns = ['*'])
*/
class NetworkBuilder extends Builder
{
/** @var \Astrotomic\Tmdb\Models\Network */
protected $model;
}
19 changes: 19 additions & 0 deletions src/Eloquent/Builders/TvBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Builders;

use Astrotomic\Tmdb\Models\Tv;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Collection;

/**
* @method Tv newModelInstance(array $attributes = [])
* @method Tv|Collection|null find(int|int[]|Arrayable $id, array $columns = ['*'])
* @method Collection findMany(int[]|Arrayable $ids, array $columns = ['*'])
* @method Tv|Collection findOrFail(int|int[]|Arrayable $id, array $columns = ['*'])
*/
class TvBuilder extends Builder
{
/** @var \Astrotomic\Tmdb\Models\Tv */
protected $model;
}
19 changes: 19 additions & 0 deletions src/Eloquent/Builders/TvEpisodeBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Builders;

use Astrotomic\Tmdb\Models\TvEpisode;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Collection;

/**
* @method TvEpisode newModelInstance(array $attributes = [])
* @method TvEpisode|Collection|null find(int|int[]|Arrayable $id, array $columns = ['*'])
* @method Collection findMany(int[]|Arrayable $ids, array $columns = ['*'])
* @method TvEpisode|Collection findOrFail(int|int[]|Arrayable $id, array $columns = ['*'])
*/
class TvEpisodeBuilder extends Builder
{
/** @var \Astrotomic\Tmdb\Models\Movie */
protected $model;
}
19 changes: 19 additions & 0 deletions src/Eloquent/Builders/TvGenreBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Builders;

use Astrotomic\Tmdb\Models\TvGenre;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Collection;

/**
* @method TvGenre newModelInstance(array $attributes = [])
* @method TvGenre|Collection|null find(int|int[]|Arrayable $id, array $columns = ['*'])
* @method Collection findMany(int[]|Arrayable $ids, array $columns = ['*'])
* @method TvGenre|Collection findOrFail(int|int[]|Arrayable $id, array $columns = ['*'])
*/
class TvGenreBuilder extends Builder
{
/** @var \Astrotomic\Tmdb\Models\TvGenre */
protected $model;
}
19 changes: 19 additions & 0 deletions src/Eloquent/Builders/TvSeasonBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Builders;

use Astrotomic\Tmdb\Models\TvSeason;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Collection;

/**
* @method TvSeason newModelInstance(array $attributes = [])
* @method TvSeason|Collection|null find(int|int[]|Arrayable $id, array $columns = ['*'])
* @method Collection findMany(int[]|Arrayable $ids, array $columns = ['*'])
* @method TvSeason|Collection findOrFail(int|int[]|Arrayable $id, array $columns = ['*'])
*/
class TvSeasonBuilder extends Builder
{
/** @var \Astrotomic\Tmdb\Models\Tv */
protected $model;
}
17 changes: 17 additions & 0 deletions src/Eloquent/Relations/HasManyTvEpisodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Relations;

use Astrotomic\Tmdb\Requests\Tv\Details;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasMany;

class HasManyTvEpisodes extends HasMany
{
public function all(array $columns = ['*']): Collection
{
$ids = Details::request($this->getParentKey())->send()->json('parts.*.id');

return $this->query->findMany($ids, $columns);
}
}
17 changes: 17 additions & 0 deletions src/Eloquent/Relations/HasManyTvSeasons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Astrotomic\Tmdb\Eloquent\Relations;

use Astrotomic\Tmdb\Requests\Tv\Details;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasMany;

class HasManyTvSeasons extends HasMany
{
public function all(array $columns = ['*']): Collection
{
$ids = Details::request($this->getParentKey())->send()->json('parts.*.id');

return $this->query->findMany($ids, $columns);
}
}
1 change: 1 addition & 0 deletions src/Enums/CreditType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protected static function values(): array
return [
'CAST' => 'cast',
'CREW' => 'crew',
'GUEST_STARS' => 'guest_stars',
];
}
}
Loading