some progress

This commit is contained in:
2024-12-30 01:51:28 +02:00
parent 71701e19bf
commit 7436b95f15
53 changed files with 5610 additions and 180 deletions
@@ -0,0 +1,70 @@
<?php
namespace App\Console\Commands\ItemProcessing;
use App\Models\ItemToFetch;
use App\Service\MediaProcessing\FactoryService;
use Illuminate\Console\Command;
class FetchItemDataCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'processing:fetch-item-data {type=movie} {batch=50} {job=Details}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
private FactoryService $factoryService;
public function __construct(FactoryService $factoryService)
{
$this->factoryService = $factoryService;
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
$type = $this->argument('type');
$batch = $this->argument('batch');
$job = $this->argument('job');
$items = $this->getBatch($type, $batch, $job);
$this->processItems($items, $job);
}
private function getBatch(string $type, int $batch, string $job)
{
return ItemToFetch::has('jobs')
->with([
'jobs' => fn ($jobs) => array_search($job, $jobs->first()->remaining_jobs, true),
])
->where('type', $type)
->take($batch)
->get();
}
private function processItems(\Illuminate\Database\Eloquent\Collection $items, $job)
{
foreach ($items as $item) {
$this->processItem($item, $job);
}
}
private function processItem($item, $job)
{
$this->factoryService->process($item, $job);
}
}
@@ -0,0 +1,77 @@
<?php
namespace App\Console\Commands\TmdbFetch;
use Illuminate\Console\Command;
class FetchExportCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tmdb:fetch-export {type=movies}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch TMDB Export file.';
/**
* Execute the console command.
*/
public function handle()
{
$type = $this->argument('type');
$url = $this->prepareExportUrlBy($type);
$date = $this->getDate();
$path = storage_path('/'.$type."_".$date.".json.gz");
if (!file_exists($path)) {
$this->downloadFile($url, $path);
}
}
private function getDate(): string
{
return date('m_d_Y',strtotime("-1 days"));
}
private function prepareExportUrlBy(string $type): string
{
$date = $this->getDate();
if ($type === 'tv_series'){
return 'https://files.tmdb.org/p/exports/tv_series_ids_'.$date.'.json.gz';
}
return 'https://files.tmdb.org/p/exports/movie_ids_'.$date.'.json.gz';
}
private function downloadFile($url, $path): void
{
$newFileName = $path;
$file = fopen ($url, 'rb');
$newFile = null;
if ($file) {
$newFile = fopen ($newFileName, 'wb');
if ($newFile) {
while(!feof($file)) {
fwrite($newFile, fread($file, 1024 * 8), 1024 * 8);
}
}
}
if ($file) {
fclose($file);
}
if ($newFile) {
fclose($newFile);
}
}
}
@@ -0,0 +1,94 @@
<?php
namespace App\Console\Commands\TmdbFetch;
use App\Models\ItemToFetch;
use App\Models\ItemToFetchJobs;
use App\Models\Movie;
use App\Models\Show;
use Illuminate\Console\Command;
class FetchExportItemsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tmdb:fetch-export-items {type=movie}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch TMDB items from export file. Types: movie/show';
/**
* Execute the console command.
*/
public function handle()
{
$type = $this->argument('type');
$file = $this->getFileFor($type);
$gzOpenedFile = gzopen($file, "r");
$this->processItems($gzOpenedFile, $type);
}
private function getFileFor(string $type)
{
$path = storage_path('/'.$type."*");
$file = glob($path);
return reset($file);
}
private function processItems($gzOpenedFile, string $type)
{
while ($line = fgets($gzOpenedFile)) {
$decodedLine = json_decode($line, true);
if (null === $decodedLine) {
continue;
}
$this->processItem($decodedLine, $type);
}
}
private function processItem($decodedLine, string $type)
{
$itemToFetch = ItemToFetch::where('tmdb_id', $decodedLine['id'])->where('type', $type)->first();
if ($itemToFetch) {
return;
}
if ($type === ItemToFetch::TYPE_MOVIE) {
$movie = Movie::where('tmdb_id', $decodedLine['id'])->first();
if ($movie) {
return;
}
} else {
$show = Show::where('tmdb_id', $decodedLine['id'])->first();
if ($show) {
return;
}
}
ItemToFetch::create([
'tmdb_id' => $decodedLine['id'],
'type' => $type,
]);
$jobs = ItemToFetchJobs::JOBS;
$jobs[] = "Details";
ItemToFetchJobs::create([
'tmdb_id' => $decodedLine['id'],
'type' => $type,
'remaining_jobs' => json_encode($jobs),
]);
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->middleware('auth')->only('logout');
}
}
@@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}
@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
+6 -2
View File
@@ -2,7 +2,11 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
abstract class Controller use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{ {
// use AuthorizesRequests, ValidatesRequests;
} }
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
public const TYPE_MOVIE = 'movie';
public const TYPE_SHOW = 'show';
protected $fillable = [
'name',
'slug',
'tmdb_id',
'type',
];
public function movies() {
return $this->belongsToMany(Movie::class, 'movie_genres', 'genre_id', 'movie_id');
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ItemToFetch extends Model
{
public const TYPE_MOVIE = 'movie';
public const TYPE_TV_SERIES = 'tv_series';
protected $table = 'items_to_fetch';
protected $fillable = [
'tmdb_id',
'type',
];
public function jobs()
{
return $this->hasOne(ItemToFetchJobs::class, 'tmdb_id', 'tmdb_id');
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ItemToFetchJobs extends Model
{
public const JOB_ALTERNVATIVE_TITLES = 'AlternativeTitles';
public const JOB_CREDITS = 'Credits';
public const JOB_IMAGES = 'Images';
public const JOB_KEYWORDS = 'Keywords';
public const JOB_RELEASES = 'Releases';
public const JOB_TRANSLATIONS = 'Translations';
public const JOB_SIMILAR = 'Similar';
public const JOB_RECOMMNDATION = 'Recommendations';
public const JOB_REVIEWS = 'Reviews';
public const JOB_LISTS = 'Lists';
public const JOB_CHANGES = 'Changes';
public const JOB_VIDEOS = 'Videos';
public const JOB_WATCH_PROVIDERS = 'WatchProviders';
public const JOB_EXTERNAL_IDS = 'ExternalIds';
public const JOB_DETAILS = 'Details';
public const JOBS = [
self::JOB_ALTERNVATIVE_TITLES,
self::JOB_CREDITS,
self::JOB_IMAGES,
self::JOB_KEYWORDS,
self::JOB_RELEASES,
self::JOB_TRANSLATIONS,
self::JOB_SIMILAR,
self::JOB_RECOMMNDATION,
self::JOB_REVIEWS,
self::JOB_LISTS,
self::JOB_CHANGES,
self::JOB_VIDEOS,
self::JOB_WATCH_PROVIDERS,
self::JOB_EXTERNAL_IDS,
];
protected $fillable = [
'tmdb_id',
'item_id',
'type',
'remaining_jobs',
];
protected function casts(): array
{
return [
'remaining_jobs' => 'array',
];
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Movie extends Model
{
protected $fillable = [
'tmdb_id',
'adult',
'runtime',
'backdrop_path',
'budget',
'revenue',
'homepage',
'imdb_id',
'status',
'original_language',
'original_title',
'title',
'slug',
'overview',
'tagline',
'poster_path',
'release_date',
'vote_average',
'vote_count',
];
public function collections()
{
return $this->belongsToMany(MovieCollection::class, 'movies_in_collection', 'movie_id', 'collection_id');
}
public function genres()
{
return $this->belongsToMany(Genre::class, 'movie_genres', 'movie_id', 'genre_id');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MovieCollection extends Model
{
protected $fillable = [
'name',
'slug',
'poster_path',
'backdrop_path',
'tmdb_id',
];
public function movies() {
return $this->belongsToMany(Movie::class, 'movies_in_collection', 'collection_id', 'movie_id');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Show extends Model
{
protected $fillable = [
'adult',
'backdrop_path',
'episode_run_time',
'first_air_date',
'homepage',
'tmdb_id',
'in_production',
'languages',
'last_air_date',
'name',
'slug',
'number_of_episodes',
'number_of_seasons',
'origin_country',
'original_language',
'original_name',
'overview',
'popularity',
'poster_path',
'status',
'tagline',
'type',
'vote_average',
'vote_count',
];
}
@@ -0,0 +1,29 @@
<?php
namespace App\Service\MediaProcessing;
use App\Models\ItemToFetch;
class FactoryService
{
private MovieProcessingService $movieProcessingService;
private ShowProcessingService $showProcessingService;
public function __construct(
MovieProcessingService $movieProcessingService,
ShowProcessingService $showProcessingService
) {
$this->movieProcessingService = $movieProcessingService;
$this->showProcessingService = $showProcessingService;
}
public function process($item, string $job)
{
switch ($item->type) {
case ItemToFetch::TYPE_MOVIE:
return $this->movieProcessingService->process($item, $job);
case ItemToFetch::TYPE_TV_SERIES:
return $this->showProcessingService->process($item, $job);
}
}
}
@@ -0,0 +1,164 @@
<?php
namespace App\Service\MediaProcessing;
use App\Models\Genre;
use App\Models\ItemToFetchJobs;
use App\Models\Movie;
use App\Models\MovieCollection;
use App\Service\TMDBApi\MoviesApi;
use Illuminate\Support\Str;
class MovieProcessingService implements ProcessingInterface
{
private MoviesApi $moviesApi;
public function __construct(MoviesApi $moviesApi)
{
$this->moviesApi = $moviesApi;
}
public function process($item, $job)
{
$methodName = "get".ucfirst($job);
if (!method_exists($this, $methodName)) {
// @todo maybe raise an exception here
return;
}
$this->$methodName($item);
}
private function getDetails($item)
{
$tmdbMovie = $this->moviesApi->getMovie($item->tmdb_id);
$tmdbMovie['tmdb_id'] = $tmdbMovie['id'];
$movie = Movie::where('tmdb_id', $tmdbMovie['tmdb_id'])->first();
if($movie) {
return;
}
$tmdbMovie['slug'] = Str::slug($tmdbMovie['title']);
$movieId = Movie::create($tmdbMovie);
if (!empty($tmdbMovie['belongs_to_collection'])) {
$this->processMovieCollection($movieId->id, $tmdbMovie['belongs_to_collection']);
}
if (!empty($tmdbMovie['genres'])) {
$this->processMovieGenres($movieId->id, $tmdbMovie['genres']);
}
$this->removeElementFromRemainingJobs($tmdbMovie['id'], 'Details');
}
private function getAlternativeTitles($item)
{
$alternativeTitles = $this->moviesApi->getAlternativeTitles($item->tmdb_id);
if (empty($alternativeTitles) || !isset($alternativeTitles['titles'])) {
return;
}
$alternativeTitleModel = new MovieAlternativeTitle();
$movieModel = new Movie();
$movie = $movieModel->getForTmdbId($item->tmdb_id);
foreach ($alternativeTitles['titles'] as $alternativeTitle) {
$alternativeTitleExists = $alternativeTitleModel->where('movie_id', $movie->id)
->where('iso', $alternativeTitle['iso_3166_1'])
->first();
if (!$alternativeTitleExists) {
$alternativeTitleModel->insert([
'iso' => $alternativeTitle['iso_3166_1'],
'movie_id' => $movie->id,
'title' => $alternativeTitle['title'],
'type' => $alternativeTitle['type'],
]);
}
}
$this->removeElementFromRemainingJobs($item->tmdb_id, ItemJob::JOB_ALTERNVATIVE_TITLES);
}
private function processMovieCollection(int $movieId, $belongsToCollection)
{
$movieCollection = MovieCollection::where('tmdb_id', $belongsToCollection['id'])->first();
if (!$movieCollection) {
$movieCollection = MovieCollection::create([
'name' => $belongsToCollection['name'],
'slug' => Str::slug($belongsToCollection['name']),
'poster_path' => $belongsToCollection['poster_path'],
'backdrop_path' => $belongsToCollection['backdrop_path'],
'tmdb_id' => $belongsToCollection['id'],
]);
}
$movie = Movie::find($movieId);
if ($movie->whereHas('collections', function ($query) use ($movieCollection) {
$query->where('tmdb_id', '=', $movieCollection->tmdb_id);
})->exists()) {
echo "Movie is in the collection";
return;
} else {
echo "Movie is not in the collection";
$movie->collections()->attach($movieCollection);
}
}
private function processMovieGenres(int $movieId, array $tmdbGenres)
{
foreach ($tmdbGenres as $tmdbGenre) {
$genre = Genre::where('name', $tmdbGenre['name'])
->where('tmdb_id', $tmdbGenre['id'])
->first();
if (!$genre) {
$genre = Genre::create([
'name' => $tmdbGenre['name'],
'slug' => Str::slug($tmdbGenre['name']),
'tmdb_id' => $tmdbGenre['id'],
'type' => Genre::TYPE_MOVIE,
]);
}
$movie = Movie::find($movieId);
if ($movie->whereHas('genres', function ($query) use ($genre) {
$query->where('tmdb_id', '=', $genre->tmdb_id);
})->exists()) {
echo "Movie is in the genre";
return;
} else {
echo "Movie is not in the genre";
$movie->genres()->attach($genre);
}
}
}
private function removeElementFromRemainingJobs(int $tmdbId, string $job)
{
$itemToFetchJobs = ItemToFetchJobs::where('tmdb_id', $tmdbId)->first();
$remainingJobs = $itemToFetchJobs->remaining_jobs;
$remainingJobKey = array_search($job, $remainingJobs);
unset($remainingJobs[$remainingJobKey]);
if (empty($remainingJobs)) {
$itemToFetchJobs->delete();
}
$itemToFetchJobs->remaining_jobs = $remainingJobs;
$itemToFetchJobs->save();
}
}
@@ -0,0 +1,8 @@
<?php
namespace App\Service\MediaProcessing;
interface ProcessingInterface
{
public function process($item, $job);
}
@@ -0,0 +1,12 @@
<?php
namespace App\Service\MediaProcessing;
class ShowProcessingService implements ProcessingInterface
{
public function process($item, $job)
{
// TODO: Implement process() method.
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Service\TMDBApi;
use CodeIgniter\HTTP\CURLRequest;
use Illuminate\Support\Facades\Http;
abstract class AbstractApiService
{
const BASE_URL = 'https://api.themoviedb.org/3/';
/** @var CURLRequest */
protected $client;
public function __construct()
{
// new guzzle client
// $this->client = service('curlrequest', options: [
// 'timeout' => 10.0,
// 'connect_timeout' => 150,
// 'debug' => false,
// 'verify' => false,
// ]);
}
public function get(string $path, array $parameters = [], array $headers = []): array
{
$path = self::BASE_URL.$path.'?api_key=49a4c5ff00d832668aa505feaf197955';
$headers['Authorization'] = 'Bearer 49a4c5ff00d832668aa505feaf197955';
$headers['accept'] = 'application/json';
try {
$r = Http::withHeaders($headers)->get($path);
// $r = $this->client->request('GET', $path, [
// 'headers' => $headers
// ]);
} catch (\Throwable $e) {
var_dump($e->getMessage());
die;
}
return $this->decodeResponse(
$r
);
}
private function decodeResponse($response)
{
try {
if ($response->body()) {
return json_decode($response->body(), true, 512, JSON_THROW_ON_ERROR);
}
return [];
} catch (JsonException $e) {
throw new UnexpectedResponseException(
sprintf(
'Unable to decode response with body "%s", %s.',
(string)$response->body(),
json_last_error_msg()
),
$response->status(),
$e
);
}
}
}
+300
View File
@@ -0,0 +1,300 @@
<?php
namespace App\Service\TMDBApi;
class MoviesApi extends AbstractApiService
{
/**
* Get the basic movie information for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getMovie($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId, $parameters, $headers);
}
/**
* Get the alternative titles for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getAlternativeTitles($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/alternative_titles', $parameters, $headers);
}
/**
* Get the cast and crew information for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getCredits($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/credits', $parameters, $headers);
}
/**
* Get the images (posters and backdrops) for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getImages($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/images', $parameters, $headers);
}
/**
* Get the plot keywords for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getKeywords($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/keywords', $parameters, $headers);
}
/**
* Get the release date by country for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getReleases($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/releases', $parameters, $headers);
}
/**
* Get the trailers for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
* @deprecated TMDB changed the way of requesting trailers, see getVideos instead!
*/
public function getTrailers($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/trailers', $parameters, $headers);
}
/**
* Get the translations for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getTranslations($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/translations', $parameters, $headers);
}
/**
* Get the similar movies for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getSimilar($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/similar', $parameters, $headers);
}
/**
* Get the recommended movies for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getRecommendations($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/recommendations', $parameters, $headers);
}
/**
* Get the reviews for a particular movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getReviews($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/reviews', $parameters, $headers);
}
/**
* Get the lists that the movie belongs to.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getLists($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/lists', $parameters, $headers);
}
/**
* Get the changes for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getChanges($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/changes', $parameters, $headers);
}
/**
* Get the latest movie id.
*
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getLatest(array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/latest', $parameters, $headers);
}
/**
* Get the list of upcoming movies. This list refreshes every day.
* The maximum number of items this list will include is 100.
*
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getUpcoming(array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/upcoming', $parameters, $headers);
}
/**
* Get the list of movies playing in theatres. This list refreshes every day.
* The maximum number of items this list will include is 100.
*
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getNowPlaying(array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/now_playing', $parameters, $headers);
}
/**
* Get the list of popular movies on The Movie Database.
* This list refreshes every day.
*
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getPopular(array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/popular', $parameters, $headers);
}
/**
* Get the list of top rated movies. By default, this list will only include
* movies that have 10 or more votes. This list refreshes every day.
*
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getTopRated(array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/top_rated', $parameters, $headers);
}
/**
* Get the videos (trailers, teasers, clips, etc...) for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getVideos($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/videos', $parameters, $headers);
}
/**
* Get the watch providers (by region) for a specific movie id.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getWatchProviders($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/watch/providers', $parameters, $headers);
}
/**
* Get the external ids that we have stored for a movie.
*
* @param $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getExternalIds($movieId, array $parameters = [], array $headers = [])
{
sleep(1);
return $this->get('movie/' . $movieId . '/external_ids', $parameters, $headers);
}
}
+5 -3
View File
@@ -11,13 +11,15 @@
"require": { "require": {
"php": "^8.2", "php": "^8.2",
"laravel/framework": "^11.31", "laravel/framework": "^11.31",
"laravel/tinker": "^2.9" "laravel/tinker": "^2.9",
"laravel/ui": "^4.6",
"ext-zlib": "*"
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.23", "fakerphp/faker": "^1.23",
"laravel/pail": "^1.1", "laravel/pail": "^1.1",
"laravel/pint": "^1.13", "laravel/pint": "^1.13",
"laravel/sail": "^1.26", "laravel/sail": "^1.39",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1", "nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1" "phpunit/phpunit": "^11.0.1"
@@ -71,4 +73,4 @@
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true "prefer-stable": true
} }
Generated
+64 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "626b9e7ddd47fb7eff9aaa53cce0c9ad", "content-hash": "f70b6bfc17538a9703666cf04bbb5ccf",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@@ -1455,6 +1455,69 @@
}, },
"time": "2024-09-23T13:32:56+00:00" "time": "2024-09-23T13:32:56+00:00"
}, },
{
"name": "laravel/ui",
"version": "v4.6.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/ui.git",
"reference": "a34609b15ae0c0512a0cf47a21695a2729cb7f93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/ui/zipball/a34609b15ae0c0512a0cf47a21695a2729cb7f93",
"reference": "a34609b15ae0c0512a0cf47a21695a2729cb7f93",
"shasum": ""
},
"require": {
"illuminate/console": "^9.21|^10.0|^11.0",
"illuminate/filesystem": "^9.21|^10.0|^11.0",
"illuminate/support": "^9.21|^10.0|^11.0",
"illuminate/validation": "^9.21|^10.0|^11.0",
"php": "^8.0",
"symfony/console": "^6.0|^7.0"
},
"require-dev": {
"orchestra/testbench": "^7.35|^8.15|^9.0",
"phpunit/phpunit": "^9.3|^10.4|^11.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravel\\Ui\\UiServiceProvider"
]
},
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": {
"psr-4": {
"Laravel\\Ui\\": "src/",
"Illuminate\\Foundation\\Auth\\": "auth-backend/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel UI utilities and presets.",
"keywords": [
"laravel",
"ui"
],
"support": {
"source": "https://github.com/laravel/ui/tree/v4.6.0"
},
"time": "2024-11-21T15:06:41+00:00"
},
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.6.1", "version": "2.6.1",
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('items_to_fetch', function (Blueprint $table) {
$table->id();
$table->bigInteger('tmdb_id');
$table->enum('type', ['movie', 'tv_series']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('item_to_fetches');
}
};
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('movies', function (Blueprint $table) {
$table->id();
$table->bigInteger('tmdb_id')->unsigned()->nullable(false);
$table->unsignedTinyInteger('adult')->default(0);
$table->unsignedInteger('runtime')->default(0);
$table->string('backdrop_path', 500)->nullable();
$table->decimal('budget', 10, 2)->nullable();
$table->decimal('revenue', 10, 2)->nullable();
$table->string('homepage', 500)->nullable();
$table->string('imdb_id', 25)->nullable();
$table->string('status', 50)->nullable();
$table->string('original_language', 5)->nullable();
$table->string('original_title', 500)->nullable();
$table->string('title', 500);
$table->string('slug', 500)->unique();
$table->text('overview')->nullable();
$table->text('tagline')->nullable();
$table->string('poster_path', 500)->nullable();
$table->date('release_date')->nullable();
$table->decimal('vote_average', 10, 2)->default(0);
$table->unsignedSmallInteger('vote_count')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('movies');
}
};
@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('shows', function (Blueprint $table) {
$table->id();
$table->unsignedTinyInteger('adult')->default(0);
$table->string('backdrop_path', 500)->nullable();
$table->unsignedInteger('episode_run_time')->default(0);
$table->date('first_air_date')->nullable();
$table->string('homepage', 500)->nullable();
$table->string('tmdb_id', 50)->nullable();
$table->unsignedTinyInteger('in_production')->default(0);
$table->string('languages', 255)->nullable();
$table->date('last_air_date')->nullable();
$table->string('name', 500);
$table->string('slug', 500)->unique();
$table->unsignedInteger('number_of_episodes')->default(0);
$table->unsignedInteger('number_of_seasons')->default(0);
$table->string('origin_country', 255)->nullable();
$table->string('original_language', 255)->nullable();
$table->string('original_name', 255)->nullable();
$table->text('overview')->nullable();
$table->decimal('popularity', 10, 2)->default(0);
$table->string('poster_path', 500)->nullable();
$table->string('status', 255)->nullable();
$table->string('tagline', 255)->nullable();
$table->string('type', 255);
$table->decimal('vote_average', 10, 2)->default(0);
$table->unsignedInteger('vote_count')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('shows');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('item_to_fetch_jobs', function (Blueprint $table) {
$table->id();
$table->bigInteger('tmdb_id')->nullable(false);
$table->bigInteger('item_id')->nullable(true);
$table->string('type')->nullable(false);
$table->json('remaining_jobs')->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('item_to_fetch_jobs');
}
};
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('movie_collections', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug');
$table->string('poster_path')->nullable();
$table->string('backdrop_path')->nullable();
$table->unsignedBigInteger('tmdb_id')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('movie_collections');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('movies_in_collection', function (Blueprint $table) {
$table->id();
$table->bigInteger('movie_id')->nullable(false);
$table->bigInteger('collection_id')->nullable(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('movies_in_collection');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('genres', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug');
$table->unsignedBigInteger('tmdb_id');
$table->enum('type', ['movie', 'show']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('genres');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('movie_genres', function (Blueprint $table) {
$table->id();
$table->bigInteger('movie_id');
$table->bigInteger('genre_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('movie_genres');
}
};
+55
View File
@@ -0,0 +1,55 @@
services:
laravel.test:
build:
context: './vendor/laravel/sail/runtimes/8.4'
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: 'sail-8.4/app'
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p${DB_PASSWORD}'
retries: 3
timeout: 5s
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local
+3394
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -6,11 +6,14 @@
"dev": "vite" "dev": "vite"
}, },
"devDependencies": { "devDependencies": {
"@popperjs/core": "^2.11.6",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"axios": "^1.7.4", "axios": "^1.7.4",
"bootstrap": "^5.2.3",
"concurrently": "^9.0.1", "concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.0", "laravel-vite-plugin": "^1.0",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"sass": "^1.56.1",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.13",
"vite": "^6.0" "vite": "^6.0"
} }
+1 -2
View File
@@ -22,8 +22,7 @@
<env name="APP_MAINTENANCE_DRIVER" value="file"/> <env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/> <env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/> <env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> --> <env name="DB_DATABASE" value="testing"/>
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/> <env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/> <env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/> <env name="QUEUE_CONNECTION" value="sync"/>
+30
View File
@@ -1,4 +1,34 @@
import 'bootstrap';
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios'; import axios from 'axios';
window.axios = axios; window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });
+7
View File
@@ -0,0 +1,7 @@
// Body
$body-bg: #f8fafc;
// Typography
$font-family-sans-serif: 'Nunito', sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
+8
View File
@@ -0,0 +1,8 @@
// Fonts
@import url('https://fonts.bunny.net/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import 'bootstrap/scss/bootstrap';
+73
View File
@@ -0,0 +1,73 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Login') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,49 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Confirm Password') }}</div>
<div class="card-body">
{{ __('Please confirm your password before continuing.') }}
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Confirm Password') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form method="POST" action="{{ route('password.email') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,65 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
+77
View File
@@ -0,0 +1,77 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="row mb-3">
<label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
+28
View File
@@ -0,0 +1,28 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
<div class="card-body">
@if (session('resent'))
<div class="alert alert-success" role="alert">
{{ __('A fresh verification link has been sent to your email address.') }}
</div>
@endif
{{ __('Before proceeding, please check your email for a verification link.') }}
{{ __('If you did not receive the email') }},
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
+23
View File
@@ -0,0 +1,23 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Dashboard') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
{{ __('You are logged in!') }}
</div>
</div>
</div>
</div>
</div>
@endsection
+80
View File
@@ -0,0 +1,80 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">
<!-- Scripts -->
@vite(['resources/sass/app.scss', 'resources/js/app.js'])
</head>
<body>
<div id="app">
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav me-auto">
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ms-auto">
<!-- Authentication Links -->
@guest
@if (Route::has('login'))
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@endif
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
</li>
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
</div>
</li>
@endguest
</ul>
</div>
</div>
</nav>
<main class="py-4">
@yield('content')
</main>
</div>
</body>
</html>
File diff suppressed because one or more lines are too long
+8
View File
@@ -1,8 +1,16 @@
<?php <?php
use App\Console\Commands\TmdbFetch\FetchExportCommand;
use Illuminate\Foundation\Inspiring; use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () { Artisan::command('inspire', function () {
$this->comment(Inspiring::quote()); $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote')->hourly(); })->purpose('Display an inspiring quote')->hourly();
// fetch export every week, saturday at 8 and 9
Schedule::command(FetchExportCommand::class, ['type', 'movies'])->weeklyOn(6, '8:00');
Schedule::command(FetchExportCommand::class, ['type', 'tv_series'])->weeklyOn(6, '9:00');
//Schedule::command('emails:send Taylor --force')->daily();
+4
View File
@@ -5,3 +5,7 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () { Route::get('/', function () {
return view('welcome'); return view('welcome');
}); });
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Binary file not shown.
+4 -1
View File
@@ -4,7 +4,10 @@ import laravel from 'laravel-vite-plugin';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
laravel({ laravel({
input: ['resources/css/app.css', 'resources/js/app.js'], input: [
'resources/sass/app.scss',
'resources/js/app.js',
],
refresh: true, refresh: true,
}), }),
], ],