Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Swinkels committed May 23, 2023
0 parents commit 66f39a9
Show file tree
Hide file tree
Showing 150 changed files with 14,841 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
60 changes: 60 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

PREPR_ENDPOINT=<YOUR-ENDPOINT>

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
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=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

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

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
9 changes: 9 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
js: true
css: true
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Laravel 10 Starter

Look at the Laravel [documentation](https://docs.prepr.io/connecting-front-end-apps/laravel) to learn more.

## Add the environment file

Copy the .env.example file in this directory to .env (which will be ignored by Git) by running the following command:

```
cp .env.example .env
```

## Update the environment file

In the .env file replace <YOUR-ENDPOINT> with the Prepr endpoint from your environment with demo content.

## Setup

Make sure to install the dependencies:

```
composer install
```

### Generate App Key

```
php artisan key:generate
```

## Development Server

Start the development server on http://localhost:8000

```
php artisan serve
```

## Production

Check out the [deployment documentation](https://laravel.com/docs/10.x/deployment) for more information.
27 changes: 27 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
30 changes: 30 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Exceptions;

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

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

/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}
28 changes: 28 additions & 0 deletions app/Http/Controllers/ABTestingController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Http;

class ABTestingController extends Controller
{
/**
* Handle the incoming request.
*/
public function __invoke()
{
$response = Http::prepr([
'query' => 'get-static-page-by-slug',
'variables' => [
'slug' => 'home-page-ab-testing',
],
'headers' => [
'Prepr-Customer-Id' => request()->get('customer_id', request()->session()->getId()),
],
]);

return view('pages.a-b-testing.index', [
'page' => data_get($response->json(), 'data.Page'),
]);
}
}
53 changes: 53 additions & 0 deletions app/Http/Controllers/BlogController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class BlogController extends Controller
{
/**
* Handle the incoming request.
*/
public function index(Request $request)
{
$variables = [];

if ($request->get('category')) {
$variables = [
'where' => [
'categories' => [
'_slug_any' => $request->get('category'),
],
],
];
}

$response = Http::prepr([
'query' => 'get-articles',
'variables' => $variables,
]);

return view('pages.blog.index', [
'articles' => data_get($response->json(), 'data.Articles'),
]);
}

public function show(string $slug)
{
$response = Http::prepr([
'query' => 'get-article-by-slug',
'variables' => [
'slug' => $slug,
],
]);

if (data_get($response->json(), 'data.Article')) {
return view('pages.blog.show', [
'article' => data_get($response->json(), 'data.Article'),
]);
}
abort(404);
}
}
12 changes: 12 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}
73 changes: 73 additions & 0 deletions app/Http/Controllers/LivestreamController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class LivestreamController extends Controller
{
/**
* Handle the incoming request.
*/
public function index()
{
$responseStreamBySlug = Http::prepr([
'query' => 'get-stream-by-slug',
'variables' => [
'slug' => 'fall-bake-a-thon',
],
]);

$responseUpcomingLiveStreams = Http::prepr([
'query' => 'get-upcoming-live-streams',
'variables' => [
'where' => [
'start_day_and_time_gt' => 'today',
],
],
]);

$responseRecordedLiveStreams = Http::prepr([
'query' => 'get-recorded-live-streams',
'variables' => [
'where' => [
'start_day_and_time_lt' => 'today',
],
],
]);

return view('pages.livestream.index', [
'live' => data_get($responseStreamBySlug->json(), 'data.LiveEvent'),
'upcoming' => data_get($responseUpcomingLiveStreams->json(), 'data.LiveEvents.items'),
'recorded' => data_get($responseRecordedLiveStreams->json(), 'data.LiveEvents.items'),
]);
}

public function show(string $type, string $slug)
{
$response = Http::prepr([
'query' => 'get-stream-by-slug',
'variables' => [
'slug' => $slug,
],
]);

if (data_get($response->json(), 'data.LiveEvent')) {
if ($type === 'live') {
return view('pages.livestream.live.show', [
'liveEvent' => data_get($response->json(), 'data.LiveEvent'),
]);
} elseif ($type === 'upcoming') {
return view('pages.livestream.upcoming.show', [
'liveEvent' => data_get($response->json(), 'data.LiveEvent'),
]);
} elseif ($type === 'recorded') {
return view('pages.livestream.recorded.show', [
'liveEvent' => data_get($response->json(), 'data.LiveEvent'),
]);
}
}
abort(404);
}
}
Loading

0 comments on commit 66f39a9

Please sign in to comment.