Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
29 changes: 21 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,46 @@ APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=https://lotrapi.test

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_DATABASE=lotrapi
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
Expand Down
11 changes: 8 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
/node_modules
/public/css
/public/hot
/public/js
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.vagrant
.env
.env.backup
.phpunit.result.cache
.phpstorm.meta.php
_ide_helper.php
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
/.idea
/.vscode
14 changes: 14 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

8 changes: 8 additions & 0 deletions app/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
class Book extends Model
{
protected $hidden = ['created_at', 'updated_at', 'pivot'];
protected $appends = array('url');

public function characters()
{
return $this->belongsToMany('App\Character', 'book_character');
}

public function getUrlAttribute()
{
$id = $this->id;
return env('APP_URL') . '/api/v1/books/' . $id;
}
}
22 changes: 17 additions & 5 deletions app/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class Character extends Model
{
protected $hidden = ['created_at', 'updated_at'];

protected $appends = array('url');

public function getRealmAttribute($value) {
return env('APP_URL') .'/api/v1/realms/' . $value;
}
Expand All @@ -17,16 +19,16 @@ public function getSpeciesAttribute($value) {
}

public function getRaceAttribute($value) {
return env('APP_URL') .'/api/v1/race/' . $value;
return env('APP_URL') .'/api/v1/races/' . $value;
}

public function getGroupAttribute($value) {
return env('APP_URL') .'/api/v1/group/' . $value;
return env('APP_URL') .'/api/v1/groups/' . $value;
}

public function realm()
{
return $this->belongsTo('App\Realm', 'realm', 'id');
return $this->belongsTo('App\Realm', 'realm', 'id')->select('id');
}

public function languages()
Expand All @@ -36,11 +38,21 @@ public function languages()

public function books()
{
return $this->belongsToMany('App\Book', 'book_character');
return $this->belongsToMany('App\Book', 'book_character')->select('books.id');
}

public function films()
{
return $this->belongsToMany('App\Film', 'character_film');
return $this->belongsToMany('App\Film', 'character_film')->select('films.id');
}

public function species()
{
return $this->belongsTo('App\Species', 'species', 'id')->select('id');
}

public function getUrlAttribute() {
$id = $this->id;
return env('APP_URL') .'/api/v1/characters/' . $id;
}
}
17 changes: 17 additions & 0 deletions app/CharacterGroup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class CharacterGroup extends Model
{
protected $hidden = ['created_at', 'updated_at'];
protected $appends = array('url');

public function getUrlAttribute()
{
$id = $this->id;
return env('APP_URL') . '/api/v1/groups/' . $id;
}
}
10 changes: 0 additions & 10 deletions app/Character_Group.php

This file was deleted.

9 changes: 8 additions & 1 deletion app/City.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@

class City extends Model
{
//
protected $hidden = ['created_at','updated_at'];

protected $appends = array('url');

public function getUrlAttribute() {
$id = $this->id;
return env('APP_URL') .'/api/v1/cities/' . $id;
}
}
39 changes: 19 additions & 20 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,49 @@

namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];

/**
* A list of the exception types that are not reported.
*
* @var array
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Report or log an exception.
* Register the exception handling callbacks for the application.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function register()
{
return parent::render($request, $exception);
$this->reportable(function (Throwable $e) {
//
});
}
}
7 changes: 7 additions & 0 deletions app/Film.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
class Film extends Model
{
protected $hidden = ['created_at', 'updated_at', 'pivot'];

protected $appends = array('url');

public function getUrlAttribute() {
$id = $this->id;
return env('APP_URL') .'/api/v1/films/' . $id;
}
}
Loading