-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c312da4
Showing
288 changed files
with
119,661 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
APP_NAME="laravellte" | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://laravellte.test | ||
|
||
BUGSNAG_API_KEY= | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=localhost | ||
DB_DATABASE=laravellte | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
QUEUE_CONNECTION=redis | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST= | ||
MAIL_PORT= | ||
MAIL_USERNAME= | ||
MAIL_PASSWORD= | ||
MAIL_ENCRYPTION=tls | ||
|
||
MAIL_FROM_ADDRESS=[email protected] | ||
MAIL_FROM_NAME="laravellte" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: push | ||
|
||
name: Run | ||
jobs: | ||
tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Run composer install | ||
run: composer install -n --prefer-dist | ||
env: | ||
APP_ENV: testing | ||
- name: Prepare Laravel Application | ||
run: | | ||
cp .env.example .env | ||
php artisan key:generate | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: vendor | ||
key: composer-${{ hashFiles('composer.lock') }} | ||
- name: Run php cs fixer | ||
run: vendor/bin/php-cs-fixer fix --dry-run | ||
- name: Run insights | ||
run: php artisan insights --no-interaction --min-quality=90 --min-complexity=85 --min-architecture=90 --min-style=95 | ||
- name: Run tests | ||
run: ./vendor/bin/paratest --processes 2 --runner=WrapperRunner | ||
env: | ||
APP_ENV: testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.php_cs.cache | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
.env | ||
vendor/ | ||
.phpunit.result.cache | ||
npm-debug.log | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
require __DIR__.'/vendor/autoload.php'; | ||
require __DIR__.'/bootstrap/app.php'; | ||
|
||
return (new MattAllan\LaravelCodeStyle\Config()) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(app_path()) | ||
->in(config_path()) | ||
->in(database_path()) | ||
->notPath(database_path('migrations')) | ||
->in(resource_path('lang')) | ||
->in(base_path('routes')) | ||
->in(base_path('tests')) | ||
) | ||
->setRules([ | ||
'@Laravel' => true, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = []; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\User; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ProfileImageUploaded | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** @var \App\Models\User */ | ||
public $user; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param \App\Models\User $user | ||
* @return void | ||
*/ | ||
public function __construct(User $user) | ||
{ | ||
$this->user = $user; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = []; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Throwable $exception | ||
* @return void | ||
*/ | ||
public function report(Throwable $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Throwable $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Throwable $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Filters; | ||
|
||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
abstract class Filter extends Builder | ||
{ | ||
/** | ||
* Apply the filters to the builder. | ||
* | ||
* @param array $filters | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function filter(array $filters) | ||
{ | ||
foreach ($filters as $name => $value) { | ||
if (! method_exists($this, $name)) { | ||
continue; | ||
} | ||
|
||
if (is_array($value)) { | ||
$this->$name($value[0], $value[1]); | ||
} else { | ||
$this->$name($value); | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Order results by field in specific order. | ||
* | ||
* @param string $field | ||
* @param string $direction | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function orderByField($field, $direction) | ||
{ | ||
$this->orderBy($field, $direction); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Filters; | ||
|
||
class RoleFilter extends Filter | ||
{ | ||
/** | ||
* Filter by name field. | ||
* | ||
* @param mixed $term | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function search($term = null) | ||
{ | ||
$this->when($term, function ($query, $term) { | ||
$query->where('name', 'LIKE', "%$term%"); | ||
}); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Filters; | ||
|
||
class UserFilter extends Filter | ||
{ | ||
/** | ||
* Filter by email field. | ||
* | ||
* @param mixed $term | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function search($term = null) | ||
{ | ||
$this->when($term, function ($query, $term) { | ||
$query->where('email', 'LIKE', "%$term%"); | ||
}); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Filter by role. | ||
* | ||
* @param mixed $roleId | ||
* @return \Illuminate\Database\Eloquent\Builder | ||
*/ | ||
public function roleId($roleId = null) | ||
{ | ||
$this->when($roleId, function ($query, $roleId) { | ||
$query->where('role_id', $roleId); | ||
}); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Http; | ||
|
||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
|
||
trait AcceptedInvitationAuth | ||
{ | ||
/** | ||
* Authorize accepted invitation request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \App\Models\User $user | ||
* @return void | ||
* @throws \Symfony\Component\HttpKernel\Exception\HttpException | ||
*/ | ||
public function authorizeInvitation(Request $request, User $user = null) | ||
{ | ||
if (! $request->hasValidSignature()) { | ||
abort(Response::HTTP_FORBIDDEN, 'The link does not have a valid signature or it is expired.'); | ||
} | ||
|
||
if ($user === null) { | ||
abort(Response::HTTP_FORBIDDEN, 'User was not found.'); | ||
} | ||
|
||
if ($user->password !== null) { | ||
return abort(Response::HTTP_FORBIDDEN, 'The link has already been used.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\AcceptedInvitationAuth; | ||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
|
||
class AcceptedInvitationController extends Controller | ||
{ | ||
use AcceptedInvitationAuth; | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create(Request $request) | ||
{ | ||
$user = User::find($request->user); | ||
$this->authorizeInvitation($request, $user); | ||
|
||
return view('accepted-invitations.create', ['user' => $user]); | ||
} | ||
} |
Oops, something went wrong.