Browse Source

use native lara notifs, add phpsandbox package

pull/26/head
Ondřej Hruška 4 years ago
parent
commit
6f908356dc
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 107
      app/Http/Controllers/SandboxController.php
  2. 29
      app/Models/Concerns/NotificationContext.php
  3. 3
      app/Models/Concerns/Reportable.php
  4. 1
      app/Models/Proposal.php
  5. 1
      app/Models/Table.php
  6. 1
      app/Models/TableComment.php
  7. 37
      app/Models/User.php
  8. 1
      composer.json
  9. 299
      composer.lock
  10. 1
      config/app.php
  11. 15
      config/php-sandbox.php
  12. 42
      database/migrations/2018_07_12_190830_create_notifications_table.php
  13. 35
      database/migrations/2018_07_14_133644_create_notifications_table.php
  14. 0
      public/vendor/php-sandbox/ace/ace.js
  15. 0
      public/vendor/php-sandbox/ace/ext-language_tools.js
  16. 0
      public/vendor/php-sandbox/ace/mode-php.js
  17. 0
      public/vendor/php-sandbox/ace/theme-monokai.js
  18. 0
      public/vendor/php-sandbox/ace/worker-php.js
  19. 0
      public/vendor/php-sandbox/jquery-1.9.1.min.js
  20. 0
      public/vendor/php-sandbox/moment.min.js
  21. 0
      public/vendor/php-sandbox/php-console.js
  22. 0
      public/vendor/php-sandbox/styles.css
  23. 52
      resources/views/debug/sandbox.blade.php
  24. 7
      routes/web.php

107
app/Http/Controllers/SandboxController.php

@ -1,107 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Response;
/**
* Development sandbox.
*
* @package FlowBox\Http\Controllers
*/
class SandboxController extends Controller
{
public function index()
{
return view('debug.sandbox', [
'defcode' => $this->getDefcode()
]);
}
private function evaluateCode($code)
{
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
ini_set('display_not_found_reason', true);
ini_set('display_exceptions', true);
ini_set('html_errors', false);
error_reporting(E_ALL | E_STRICT);
ob_start();
$memBefore = memory_get_usage(true);
$startTime = microtime(true);
// Remove the <?php mark
$code = preg_replace('{^\s*<\?(php)?\s*}i', '', $code);
/** Run code with bootstrap in separate scope */
function runCode($__source_code)
{
eval($__source_code);
}
try {
runCode($code);
} catch (\Exception $e) {
// dump & die - shows nice expandable view of the exception.
dd($e);
}
$endTime = microtime(true);
$memAfter = memory_get_peak_usage(true);
$output = ob_get_clean();
$memory = ($memAfter - $memBefore) / 1024.0 / 1024.0; // in MB
$duration = ($endTime - $startTime) * 1000; // in ms
return compact('memory', 'duration', 'output');
}
public function run(Request $request)
{
$this->validate($request, [
'code' => 'required'
]);
$out = $this->evaluateCode($request->code);
if ($request->wantsJson()) {
$resp = Response::json([
'output' => $out['output'] . "\n#end-php-console-output#",
'memory' => sprintf('%.3f', $out['memory']),
'duration' => sprintf('%.3f', $out['duration'])
], 200);
return $resp;
} else {
// Full HTML page
return view('debug.sandbox', [
'code' => $request->code,
'defcode' => $this->getDefcode(),
'output' => $out['output']
]);
}
}
private function getDefcode()
{
return <<<CODE
<?php
use MightyPork\Utils\Utils;
use MightyPork\Utils\Str;
Utils::logToStdout(false);
Utils::logQueries();
CODE;
}
}

29
app/Models/Concerns/NotificationContext.php

@ -1,29 +0,0 @@
<?php
namespace App\Models\Concerns;
use App\Models\ContentReport;
use App\Models\Notification;
use Illuminate\Database\Eloquent\Relations\MorphMany;
trait NotificationContext
{
public function bootNotificationContext()
{
static::deleting(function(NotificationContext $self) {
$self->notificationsAbout()->delete();
});
}
/**
* Notifications having this model as a context
*
* @return MorphMany
*/
public function notificationsAbout()
{
return $this->morphMany(Notification::class, 'context');
}
}

3
app/Models/Concerns/Reportable.php

@ -7,6 +7,9 @@ namespace App\Models\Concerns;
use App\Models\ContentReport;
use Illuminate\Database\Eloquent\Relations\MorphMany;
/**
* @property ContentReport $reportsOf
*/
trait Reportable
{
public function bootReportable()

1
app/Models/Proposal.php

@ -16,7 +16,6 @@ use Illuminate\Database\Eloquent\Model;
class Proposal extends Model
{
use Reportable;
use NotificationContext;
/** Authoring user */
public function author()

1
app/Models/Table.php

@ -12,7 +12,6 @@ use Illuminate\Database\Eloquent\Model;
class Table extends Model
{
use Reportable;
use NotificationContext;
protected static function boot()
{

1
app/Models/TableComment.php

@ -12,7 +12,6 @@ use Illuminate\Database\Eloquent\Model;
class TableComment extends Model
{
use Reportable;
use NotificationContext;
/** Context data table */
public function table()

37
app/Models/User.php

@ -4,16 +4,29 @@ namespace App\Models;
use AdamWathan\EloquentOAuth\OAuthIdentity;
use App\Models\Concerns\Reportable;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* A user in the application
*
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string $name - unique, for vanity URL
* @property string $email - unique, for login and social auth chaining
* @property string $password - hashed pw
* @property Proposal[]|Collection $proposals
* @property Table[]|Collection $tables
* @property OAuthIdentity[]|Collection $socialIdentities
* @property TableComment[]|Collection $tableComments
* @property Table[]|Collection $favouriteTables
* @property Table[]|Collection $followedDiscussions
* @property ContentReport[]|Collection $authoredReports
* @property Notification[]|Collection $notifications
* @property Notification[]|Collection $readNotifications
* @property Notification[]|Collection $unreadNotifications
*/
class User extends Authenticatable
{
@ -47,13 +60,11 @@ class User extends Authenticatable
foreach ($self->proposals as $proposal) {
$proposal->delete();
}
$self->notificationsCaused()->delete();
});
}
/** Owned tables */
public function dataTables()
public function tables()
{
return $this->hasMany(Table::class, 'owner_id');
}
@ -94,22 +105,6 @@ class User extends Authenticatable
return $this->hasMany(ContentReport::class, 'author_id');
}
/** Notifications for this user */
public function notifications()
{
return $this->hasMany(Notification::class);
}
/**
* Notifications caused by this user
*
* @return HasMany
*/
public function notificationsCaused()
{
return $this->hasMany(Notification::class, 'actor_id');
}
// --------- Relation Helpers ---------
public function addFavourite(Table $table)

1
composer.json

@ -16,6 +16,7 @@
"laravel/framework": "5.6.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "^1.0",
"mightypork/php-sandbox": "^1.0",
"phpoffice/phpspreadsheet": "^1.3",
"riesjart/relaquent": "^0.1"
},

299
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7c2b00ef303415cdc522f82578d90676",
"content-hash": "60a096ac38f47f94abc0e1c82f548194",
"packages": [
{
"name": "barryvdh/laravel-ide-helper",
@ -161,74 +161,6 @@
"description": "implementation of xdg base directory specification for php",
"time": "2014-10-24T07:27:01+00:00"
},
{
"name": "doctrine/annotations",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
"reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": "^7.1"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
],
"time": "2017-12-06T07:11:42+00:00"
},
{
"name": "doctrine/cache",
"version": "v1.7.1",
@ -304,35 +236,50 @@
"time": "2017-08-25T07:02:50+00:00"
},
{
"name": "doctrine/collections",
"version": "v1.5.0",
"name": "doctrine/dbal",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf"
"url": "https://github.com/doctrine/dbal.git",
"reference": "5140a64c08b4b607b9bedaae0cedd26f04a0e621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
"reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/5140a64c08b4b607b9bedaae0cedd26f04a0e621",
"reference": "5140a64c08b4b607b9bedaae0cedd26f04a0e621",
"shasum": ""
},
"require": {
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0",
"ext-pdo": "*",
"php": "^7.1"
},
"require-dev": {
"doctrine/coding-standard": "~0.1@dev",
"phpunit/phpunit": "^5.7"
"doctrine/coding-standard": "^4.0",
"jetbrains/phpstorm-stubs": "^2018.1.2",
"phpstan/phpstan": "^0.10.1",
"phpunit/phpunit": "^7.1.2",
"phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5",
"symfony/console": "^2.0.5|^3.0|^4.0",
"symfony/phpunit-bridge": "^3.4.5|^4.0.5"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "2.8.x-dev",
"dev-develop": "3.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Collections\\": "lib/"
"Doctrine\\DBAL\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -355,50 +302,46 @@
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Collections Abstraction library",
"description": "Database Abstraction Layer",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"array",
"collections",
"iterator"
"database",
"dbal",
"persistence",
"queryobject"
],
"time": "2017-07-22T10:37:32+00:00"
"time": "2018-07-13T03:16:35+00:00"
},
{
"name": "doctrine/common",
"version": "v2.8.1",
"name": "doctrine/event-manager",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common.git",
"reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66"
"url": "https://github.com/doctrine/event-manager.git",
"reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
"reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3",
"reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3",
"shasum": ""
},
"require": {
"doctrine/annotations": "1.*",
"doctrine/cache": "1.*",
"doctrine/collections": "1.*",
"doctrine/inflector": "1.*",
"doctrine/lexer": "1.*",
"php": "~7.1"
"php": "^7.1"
},
"conflict": {
"doctrine/common": "<2.9@dev"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
"doctrine/coding-standard": "^4.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8.x-dev"
"dev-master": "1.0.x-dev"
}
},
"autoload": {
@ -430,93 +373,20 @@
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common Library for Doctrine projects",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"collections",
"eventmanager",
"persistence",
"spl"
],
"time": "2017-08-31T08:43:38+00:00"
},
{
"name": "doctrine/dbal",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "11037b4352c008373561dc6fc836834eed80c3b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/11037b4352c008373561dc6fc836834eed80c3b5",
"reference": "11037b4352c008373561dc6fc836834eed80c3b5",
"shasum": ""
},
"require": {
"doctrine/common": "^2.7.1",
"ext-pdo": "*",
"php": "^7.1"
},
"require-dev": {
"doctrine/coding-standard": "^4.0",
"phpunit/phpunit": "^7.0",
"phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5",
"symfony/console": "^2.0.5||^3.0",
"symfony/phpunit-bridge": "^3.4.5|^4.0.5"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\DBAL\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "Database Abstraction Layer",
"homepage": "http://www.doctrine-project.org",
"description": "Doctrine Event Manager component",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"database",
"dbal",
"persistence",
"queryobject"
"event",
"eventdispatcher",
"eventmanager"
],
"time": "2018-04-07T18:44:18+00:00"
"time": "2018-06-11T11:59:03+00:00"
},
{
"name": "doctrine/inflector",
@ -1524,6 +1394,37 @@
],
"time": "2016-08-17T00:36:58+00:00"
},
{
"name": "mightypork/php-sandbox",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://git.ondrovo.com/packages/php-sandbox.git",
"reference": "2d0cab061148cfd8b53e38e2b9043a56270c520b"
},
"require": {
"laravel/framework": "~5.5",
"php": ">=5.6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"MightyPork\\PhpSandbox\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Ondřej Hruška",
"email": "ondra@ondrovo.com"
}
],
"description": "Web interface for testing PHP code (Laravel package)",
"time": "2018-07-14T15:20:40+00:00"
},
{
"name": "monolog/monolog",
"version": "1.23.0",
@ -2246,16 +2147,16 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.1.1",
"version": "v6.1.2",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "aa899fef280b1c1aec8d5d4ac069af7f80c89a23"
"reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/aa899fef280b1c1aec8d5d4ac069af7f80c89a23",
"reference": "aa899fef280b1c1aec8d5d4ac069af7f80c89a23",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7d760881d266d63c5e7a1155cbcf2ac656a31ca8",
"reference": "7d760881d266d63c5e7a1155cbcf2ac656a31ca8",
"shasum": ""
},
"require": {
@ -2301,7 +2202,7 @@
"mail",
"mailer"
],
"time": "2018-07-04T11:12:44+00:00"
"time": "2018-07-13T07:04:35+00:00"
},
{
"name": "symfony/class-loader",
@ -3444,16 +3345,16 @@
},
{
"name": "fzaninotto/faker",
"version": "v1.7.1",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
"reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d"
"reference": "f72816b43e74063c8b10357394b6bba8cb1c10de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d",
"reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de",
"reference": "f72816b43e74063c8b10357394b6bba8cb1c10de",
"shasum": ""
},
"require": {
@ -3461,7 +3362,7 @@
},
"require-dev": {
"ext-intl": "*",
"phpunit/phpunit": "^4.0 || ^5.0",
"phpunit/phpunit": "^4.8.35 || ^5.7",
"squizlabs/php_codesniffer": "^1.5"
},
"type": "library",
@ -3490,7 +3391,7 @@
"faker",
"fixtures"
],
"time": "2017-08-15T16:48:10+00:00"
"time": "2018-07-12T10:23:15+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -4414,16 +4315,16 @@
},
{
"name": "sebastian/comparator",
"version": "3.0.1",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "591a30922f54656695e59b1f39501aec513403da"
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/591a30922f54656695e59b1f39501aec513403da",
"reference": "591a30922f54656695e59b1f39501aec513403da",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"shasum": ""
},
"require": {
@ -4474,7 +4375,7 @@
"compare",
"equality"
],
"time": "2018-06-14T15:05:28+00:00"
"time": "2018-07-12T15:12:46+00:00"
},
{
"name": "sebastian/diff",

1
config/app.php

@ -165,6 +165,7 @@ return [
// sideload
AdamWathan\EloquentOAuthL5\EloquentOAuthServiceProvider::class,
MightyPork\PhpSandbox\PhpSandboxServiceProvider::class,
],
/*

15
config/php-sandbox.php

@ -2,4 +2,19 @@
return [
'enable' => env('ENABLE_PHP_SANDBOX', false),
'route' => 'sandbox',
'route_middleware' => ['web'],
'default_code' => <<<CODE
<?php
use MightyPork\Utils\Utils;
use MightyPork\Utils\Str;
Utils::logToStdout(false);
Utils::logQueries();
CODE
];

42
database/migrations/2018_07_12_190830_create_notifications_table.php

@ -1,42 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->boolean('seen');
$table->unsignedInteger('user_id')->index();
$table->unsignedInteger('actor_id')->index()->nullable(); // who did it
$table->string('action'); // what happened, e.g.: favourited, mentioned, forked, commented
$table->nullableMorphs('context'); // the action target or context
$table->foreign('actor_id')->references('id')->on('users')
->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}

35
database/migrations/2018_07_14_133644_create_notifications_table.php

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}

0
public/sandbox-assets/ace/ace.js → public/vendor/php-sandbox/ace/ace.js vendored

0
public/sandbox-assets/ace/ext-language_tools.js → public/vendor/php-sandbox/ace/ext-language_tools.js vendored

0
public/sandbox-assets/ace/mode-php.js → public/vendor/php-sandbox/ace/mode-php.js vendored

0
public/sandbox-assets/ace/theme-monokai.js → public/vendor/php-sandbox/ace/theme-monokai.js vendored

0
public/sandbox-assets/ace/worker-php.js → public/vendor/php-sandbox/ace/worker-php.js vendored

0
public/sandbox-assets/jquery-1.9.1.min.js → public/vendor/php-sandbox/jquery-1.9.1.min.js vendored

0
public/sandbox-assets/moment.min.js → public/vendor/php-sandbox/moment.min.js vendored

0
public/sandbox-assets/php-console.js → public/vendor/php-sandbox/php-console.js vendored

0
public/sandbox-assets/styles.css → public/vendor/php-sandbox/styles.css vendored

52
resources/views/debug/sandbox.blade.php

@ -1,52 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="_token" content="{{ csrf_token() }}">
<title>PHP debug sandbox</title>
<link rel="stylesheet" type="text/css" href="/sandbox-assets/styles.css"/>
<script src="/sandbox-assets/jquery-1.9.1.min.js"></script>
<script src="/sandbox-assets/ace/ace.js"></script>
<script src="/sandbox-assets/ace/theme-monokai.js"></script>
<script src="/sandbox-assets/ace/mode-php.js"></script>
<script src="/sandbox-assets/moment.min.js"></script>
<script src="/sandbox-assets/ace/ext-language_tools.js"></script>
<script src="/sandbox-assets/php-console.js"></script>
<script>
var defcode = @json($defcode);
$.console({
tabsize: 4
});
</script>
</head>
<body>
<div class="console-wrapper">
<div class="input-wrapper">
<form method="POST" action="" id="mainform">
<div class="input">
<textarea class="editor" id="editor" name="code">{{ $code or "&lt;?php\n" }}</textarea>
</div>
<div class="statusbar">
<select id="saves"></select>&nbsp;
<a id="btn-new">new</a>
<a id="btn-ren">ren</a>
<a id="btn-del">del</a>
&nbsp;|&nbsp;
<span class="position">Line: 1, Column: 1</span>
<span class="runtime-info"></span>
<input type="submit" name="subm" value="Run!"/>
</div>
</form>
</div>
<div class="output-wrapper">
<div class="output">{{ $output or '' }}</div>
</div>
</div>
</body>
</html>

7
routes/web.php

@ -16,13 +16,6 @@ use SocialNorm\ProviderUser;
Auth::routes();
// sandbox
if (config('php-sandbox.enable')) {
Route::get('sandbox', 'SandboxController@index')->name('sandbox');
Route::post('sandbox', 'SandboxController@run'); // ajax
}
Route::get('/about/terms', function () {
return view('terms');
});

Loading…
Cancel
Save