Skip to content

Commit

Permalink
update layout
Browse files Browse the repository at this point in the history
  • Loading branch information
exatasmente committed Jul 1, 2020
0 parents commit a2853d9
Show file tree
Hide file tree
Showing 191 changed files with 27,337 additions and 0 deletions.
41 changes: 41 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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)
{
// $schedule->command('inspire')->hourly();
}

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

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

namespace App;

class DocumentationPages
{
protected $pages = [
'Quickstart' => 'quickstart',
'The Essentials' => [
'Installation' => 'installation',
'Making Components' => 'making-components',
'Rendering Components' => 'rendering-components',
'Properties' => 'properties',
'Actions' => 'actions',
'Events' => 'events',
'Lifecycle Hooks' => 'lifecycle-hooks',
],
'Component Features' => [
'Validation' => 'input-validation',
'File Uploads' => 'file-uploads',
'Authorization' => 'authorization',
'Pagination' => 'pagination',
'Redirecting' => 'redirecting',
'Flash Messages' => 'flash-messages',
'Nesting Components' => 'nesting-components',
],
'UI Niceties' => [
'Loading States' => 'loading-states',
'Polling' => 'polling',
'Prefetching' => 'prefetching',
'Offline State' => 'offline-state',
'Dirty States' => 'dirty-states',
'Defer Loading' => 'defer-loading',
],
'JS Integrations' => [
'AlpineJS' => 'alpine-js',
'Turbolinks' => 'turbolinks',
'Laravel Echo' => 'laravel-echo',
],
'Testing' => 'testing',
'Security' => 'security',
'Troubleshooting' => 'troubleshooting',
'Package Development' => 'package-dev',
'Artisan Commands' => 'artisan-commands',
'API Reference' => 'api',
];

protected $currentUri;

public function __construct($uri)
{
$this->currentUri = $uri;
}

public function all()
{
return $this->pages;
}

public function isActive($compare)
{
return $compare === $this->currentUri;
}

public function title()
{
return $this->findTitle($this->pages, $this->currentUri);
}

protected function findTitle($navigation, $slug) {
foreach ($navigation as $title => $uri) {
if (is_array($uri)) {
$foo = $this->findTitle($uri, $slug);
if ($foo) return $foo;
}

if ($uri == $slug) return $title;
}
}

public function next()
{
$flattenedArrayOfPagesAndTheirLables = collect($this->pages)->map(function ($value, $key) {
$links = is_array($value) ? $value : [$key => $value];

return collect($links)->map(function ($path, $label) {
return ['path' => $path, 'label' => $label];
});
})
->flatten(1);

$pathsByIndex = $flattenedArrayOfPagesAndTheirLables->pluck('path');

$currentIndex = $pathsByIndex->search($this->currentUri);

$nextIndex = $currentIndex + 1;

return $flattenedArrayOfPagesAndTheirLables[$nextIndex] ?? null;
}

public function previous()
{
$flattenedArrayOfPagesAndTheirLables = collect($this->pages)->map(function ($value, $key) {
$links = is_array($value) ? $value : [$key => $value];

return collect($links)->map(function ($path, $label) {
return ['path' => $path, 'label' => $label];
});
})
->flatten(1);

$pathsByIndex = $flattenedArrayOfPagesAndTheirLables->pluck('path');

$currentIndex = $pathsByIndex->search($this->currentUri);

$previousIndex = $currentIndex - 1;

return $flattenedArrayOfPagesAndTheirLables[$previousIndex] ?? null;
}
}
55 changes: 55 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
13 changes: 13 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Http\Controllers;

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

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

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];

/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

'api' => [
'throttle:60,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'sponsor' => \App\Http\Middleware\MustBeSponsor::class,
'sponsor.guest' => \App\Http\Middleware\IsNotASponsor::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
36 changes: 36 additions & 0 deletions app/Http/Livewire/ExploreCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Http\Livewire;

use App\Screencast;
use App\UiAction;
use Illuminate\Support\Facades\Http;
use Livewire\Component;

class ExploreCode extends Component
{
public $screencast;

public function mount(Screencast $screencast)
{
$this->screencast = $screencast;
}

public function sendInvite()
{
Http::withToken(env('GITHUB_TOKEN'))
->put('https://api.github.com/repos/livewire/surge/collaborators/'.auth()->user()->github_username, ['permissions' => 'pull']);

UiAction::markInviteAsSent(auth()->user());
}

public function getHasProperty()
{

}

public function render()
{
return view('livewire.explore-code');
}
}
39 changes: 39 additions & 0 deletions app/Http/Livewire/Multiselect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Livewire;

use Livewire\Component;

class Multiselect extends Component
{
public $data;
public function mount($users){
$this->data = $users->map(function ($user) {
return ['value' => $user->id, 'name' => $user->name, 'selected'=> false];
})->toArray();
}
public function remove($index){
$this->data[$index]['selected'] = false;
}
public function getOption($index){
return $this->data;
}
public function add($index)
{
if($this->data[$index]['selected'] == true){
return;
}
$this->data[$index]['selected'] = true;
}

public function getSelectedProperty(){
return array_filter($this->data,function($option){
return $option['selected'] == true;
});
}

public function render()
{
return view('livewire.multiselect');
}
}
15 changes: 15 additions & 0 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;

class Authenticate extends Middleware
{
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
Loading

0 comments on commit a2853d9

Please sign in to comment.