mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-21 20:48:00 +01:00
Laravel 5.3 Update (#107)
* Shift core files * Shift app folder structure Laravel 5.3 no longer includes the `Events`, `Jobs`, `Listeners`, and `Policies` folders by default. Instead, they are created when you make them using `artisan`. * Shift Middleware * Shift Providers * Shift configuration * Shift Routes Laravel 5.3 now stores Routes in a top-level `routes` folder and separates them into API, console, and web files. * Shift deprecations The `Str::randomBytes` and `Str::equals` methods were deprecated in Laravel 5.2 and removed in Laravel 5.3 in favor of the native `random_bytes` and `hash_equals` PHP functions. In addition, the Collection method `lists()` was replaced with `pluck()`. * Shift Laravel dependencies * Shift cleanup * Updated composer.json * Updated providers to 5.3 style * Removed events folder and extend correct exceptions handler * Updated configuration * Shift back our method names from ending in "pluck" to "list" * Temporarily add back in old mcrypt encrypter
This commit is contained in:
parent
00f24a5c12
commit
c420d3955b
30 changed files with 646 additions and 228 deletions
|
@ -57,4 +57,13 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Register the Closure based commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Pony.fm - A community for pony fan music.
|
||||
* Copyright (C) 2015 Peter Deltchev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Poniverse\Ponyfm\Events;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
//
|
||||
}
|
|
@ -21,10 +21,8 @@
|
|||
namespace Poniverse\Ponyfm\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use GrahamCampbell\Exceptions\ExceptionHandler as ExceptionHandler;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use GrahamCampbell\Exceptions\NewExceptionHandler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
@ -34,9 +32,10 @@ class Handler extends ExceptionHandler
|
|||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
AuthorizationException::class,
|
||||
ValidationException::class,
|
||||
HttpException::class,
|
||||
\Illuminate\Auth\AuthenticationException::class,
|
||||
\Illuminate\Auth\Access\AuthorizationException::class,
|
||||
\Illuminate\Validation\ValidationException::class,
|
||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -63,4 +62,19 @@ class Handler extends ExceptionHandler
|
|||
{
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
/**
|
||||
* Convert an authentication exception into an unauthenticated response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Auth\AuthenticationException $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function unauthenticated($request, AuthenticationException $e)
|
||||
{
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
||||
} else {
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class FavouritesController extends ApiControllerBase
|
|||
return Response::json(["albums" => $albums], 200);
|
||||
}
|
||||
|
||||
public function getPlaylists()
|
||||
public function getPlaylist()
|
||||
{
|
||||
$query = Favourite
|
||||
::whereUserId(Auth::user()->id)
|
||||
|
|
|
@ -34,7 +34,7 @@ class ContentController extends Controller
|
|||
return View::make('shared.null');
|
||||
}
|
||||
|
||||
public function getPlaylists()
|
||||
public function getPlaylist()
|
||||
{
|
||||
return View::make('shared.null');
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
namespace Poniverse\Ponyfm\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
|
|
@ -39,6 +39,7 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\Poniverse\Ponyfm\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Poniverse\Ponyfm\Http\Middleware\DisabledAccountCheck::class,
|
||||
]
|
||||
|
@ -51,7 +52,8 @@ class Kernel extends HttpKernel
|
|||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \Poniverse\Ponyfm\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'auth.oauth' => \Poniverse\Ponyfm\Http\Middleware\AuthenticateOAuth::class,
|
||||
// 'can' => \Poniverse\Ponyfm\Http\Middleware\Authorize::class,
|
||||
'json-exceptions' => \Poniverse\Ponyfm\Http\Middleware\JsonExceptions::class,
|
||||
|
|
|
@ -123,7 +123,7 @@ class Search
|
|||
|
||||
$tracks = $this->transformTracks($results['responses'][0]['hits']['hits']);
|
||||
$albums = $this->transformAlbums($results['responses'][1]['hits']['hits']);
|
||||
$playlists = $this->transformPlaylists($results['responses'][2]['hits']['hits']);
|
||||
$playlists = $this->transformPlaylist($results['responses'][2]['hits']['hits']);
|
||||
$users = $this->transformUsers($results['responses'][3]['hits']['hits']);
|
||||
|
||||
return [
|
||||
|
@ -152,7 +152,7 @@ class Search
|
|||
return $albums;
|
||||
}
|
||||
|
||||
protected function transformPlaylists(array $searchHits)
|
||||
protected function transformPlaylist(array $searchHits)
|
||||
{
|
||||
$playlists = $this->transformToEloquent(Playlist::class, $searchHits);
|
||||
$playlists = $playlists->map(function (Playlist $playlist) {
|
||||
|
|
|
@ -134,7 +134,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function trackFiles()
|
||||
{
|
||||
$trackIds = $this->tracks->lists('id');
|
||||
$trackIds = $this->tracks->pluck('id');
|
||||
return TrackFile::join('tracks', 'tracks.current_version', '=', 'track_files.version')->whereIn('track_id', $trackIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function trackFiles()
|
||||
{
|
||||
$trackIds = $this->tracks->lists('id');
|
||||
$trackIds = $this->tracks->pluck('id');
|
||||
return TrackFile::join('tracks', 'tracks.current_version', '=', 'track_files.version')->whereIn('track_id', $trackIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Poniverse\Ponyfm\Providers;
|
|||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\LegacyEncrypter\McryptEncrypter;
|
||||
use PfmValidator;
|
||||
use Poniverse;
|
||||
use Validator;
|
||||
|
@ -48,6 +49,15 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
// TODO: Migrate from Mcrypt
|
||||
$this->app->singleton('encrypter', function ($app) {
|
||||
$config = $app->make('config')->get('app');
|
||||
|
||||
$key = $config['key'];
|
||||
|
||||
return new McryptEncrypter($key, $config['cipher']);
|
||||
});
|
||||
|
||||
$this->app->bind(Poniverse::class, function (Application $app) {
|
||||
return new Poniverse($app['config']->get('poniverse.client_id'), $app['config']->get('poniverse.secret'));
|
||||
});
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
namespace Poniverse\Ponyfm\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Poniverse\Ponyfm\Models\Album;
|
||||
|
@ -51,27 +52,26 @@ class AuthServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Register any application authentication / authorization services.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
|
||||
* @return void
|
||||
*/
|
||||
public function boot(GateContract $gate)
|
||||
public function boot()
|
||||
{
|
||||
$gate->define('access-admin-area', function (User $user) {
|
||||
Gate::define('access-admin-area', function (User $user) {
|
||||
return $user->hasRole('admin');
|
||||
});
|
||||
|
||||
$gate->define('create-genre', function (User $user) {
|
||||
Gate::define('create-genre', function (User $user) {
|
||||
return $user->hasRole('admin');
|
||||
});
|
||||
|
||||
$gate->define('create-show-song', function (User $user) {
|
||||
Gate::define('create-show-song', function (User $user) {
|
||||
return $user->hasRole('admin');
|
||||
});
|
||||
|
||||
$gate->define('create-user', function (User $user) {
|
||||
Gate::define('create-user', function (User $user) {
|
||||
return $user->hasRole('admin');
|
||||
});
|
||||
|
||||
$this->registerPolicies($gate);
|
||||
$this->registerPolicies();
|
||||
}
|
||||
}
|
||||
|
|
26
app/Providers/BroadcastServiceProvider.php
Executable file
26
app/Providers/BroadcastServiceProvider.php
Executable file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Poniverse\Ponyfm\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
/*
|
||||
* Authenticate the user's personal channel...
|
||||
*/
|
||||
Broadcast::channel('App.User.*', function ($user, $userId) {
|
||||
return (int) $user->id === (int) $userId;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -39,12 +39,11 @@ class EventServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Register any other events for your application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @return void
|
||||
*/
|
||||
public function boot(DispatcherContract $events)
|
||||
public function boot()
|
||||
{
|
||||
parent::boot($events);
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Poniverse\Ponyfm\Providers;
|
|||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Poniverse\Ponyfm\Models\User;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
|
@ -38,15 +39,14 @@ class RouteServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
public function boot()
|
||||
{
|
||||
parent::boot($router);
|
||||
parent::boot();
|
||||
|
||||
$router->model('userId', User::class);
|
||||
$router->bind('userSlug', function ($value) {
|
||||
Route::model('userId', User::class);
|
||||
Route::bind('userSlug', function ($value) {
|
||||
return User::where('slug', $value)->first();
|
||||
});
|
||||
}
|
||||
|
@ -54,16 +54,15 @@ class RouteServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
public function map()
|
||||
{
|
||||
$router->group([
|
||||
Route::group([
|
||||
'middleware' => 'web',
|
||||
'namespace' => $this->namespace
|
||||
], function ($router) {
|
||||
require app_path('Http/routes.php');
|
||||
require base_path('routes/web.php');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=7.0.1",
|
||||
"laravel/framework": "5.2.*",
|
||||
"laravel/framework": "5.3.*",
|
||||
"codescale/ffmpeg-php": "2.7.0",
|
||||
"intouch/laravel-newrelic": "*",
|
||||
"barryvdh/laravel-ide-helper": "^2.1",
|
||||
|
@ -23,17 +23,18 @@
|
|||
"barryvdh/laravel-debugbar": "^2.2",
|
||||
"predis/predis": "^1.0",
|
||||
"ksubileau/color-thief-php": "^1.3",
|
||||
"graham-campbell/exceptions": "^8.6",
|
||||
"minishlink/web-push": "^1.0"
|
||||
"graham-campbell/exceptions": "^9.1",
|
||||
"minishlink/web-push": "^1.0",
|
||||
"laravel/legacy-encrypter": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"mockery/mockery": "0.9.*",
|
||||
"phpunit/phpunit": "~4.1",
|
||||
"phpunit/phpunit": "~5.0",
|
||||
"phpspec/phpspec": "~2.1",
|
||||
"filp/whoops": "^2.1",
|
||||
"symfony/dom-crawler": "~3.0",
|
||||
"symfony/css-selector": "~3.0"
|
||||
"symfony/dom-crawler": "~3.1",
|
||||
"symfony/css-selector": "~3.1"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
@ -71,4 +72,4 @@
|
|||
"config": {
|
||||
"preferred-install": "dist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
601
composer.lock
generated
601
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,18 @@
|
|||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
*/
|
||||
|
||||
'name' => 'My Application',
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
|
||||
|
@ -130,6 +142,7 @@ return [
|
|||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
|
@ -145,6 +158,7 @@ return [
|
|||
*/
|
||||
Barryvdh\Debugbar\ServiceProvider::class,
|
||||
Poniverse\Ponyfm\Providers\AppServiceProvider::class,
|
||||
// Poniverse\Ponyfm\Providers\BroadcastServiceProvider::class,
|
||||
Poniverse\Ponyfm\Providers\EventServiceProvider::class,
|
||||
Poniverse\Ponyfm\Providers\RouteServiceProvider::class,
|
||||
Poniverse\Ponyfm\Providers\AuthServiceProvider::class,
|
||||
|
@ -188,6 +202,7 @@ return [
|
|||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
|
|
|
@ -89,7 +89,6 @@ return [
|
|||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'email' => 'auth.emails.password',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
],
|
||||
|
|
|
@ -11,6 +11,8 @@ return [
|
|||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'database'),
|
||||
|
@ -48,10 +50,20 @@ return [
|
|||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
|
@ -26,7 +26,6 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
//'mysql' => env('DB_CONNECTION', 'mysql'),
|
||||
'default' => env('DB_CONNECTION', 'pgsql'),
|
||||
|
||||
/*
|
||||
|
@ -123,8 +122,9 @@ return [
|
|||
'cluster' => false,
|
||||
|
||||
'default' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'host' => env('REDIS_HOST', 'localhost'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', 6379),
|
||||
'database' => 0,
|
||||
],
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ return [
|
|||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'ttr' => 60,
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
|
|
@ -15,24 +15,24 @@ return [
|
|||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => '',
|
||||
'secret' => '',
|
||||
],
|
||||
|
||||
'mandrill' => [
|
||||
'secret' => '',
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => '',
|
||||
'secret' => '',
|
||||
'key' => env('SES_KEY'),
|
||||
'secret' => env('SES_SECRET'),
|
||||
'region' => 'us-east-1',
|
||||
],
|
||||
|
||||
'sparkpost' => [
|
||||
'secret' => env('SPARKPOST_SECRET'),
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => Poniverse\Ponyfm\Models\User::class,
|
||||
'key' => '',
|
||||
'secret' => '',
|
||||
'model' => \Poniverse\Ponyfm\Models\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -135,7 +135,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'domain' => null,
|
||||
'domain' => env('SESSION_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -161,6 +161,6 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'http_only' => false,
|
||||
'http_only' => true,
|
||||
|
||||
];
|
||||
|
|
|
@ -32,7 +32,7 @@ class EnforceUniqueTracksInPlaylists extends Migration
|
|||
public function up()
|
||||
{
|
||||
DB::transaction(function(){
|
||||
$playlistIds = DB::table('playlists')->lists('id');
|
||||
$playlistIds = DB::table('playlists')->pluck('id');
|
||||
|
||||
foreach ($playlistIds as $playlistId) {
|
||||
/** @var Playlist $playlist */
|
||||
|
|
|
@ -17,7 +17,7 @@ class EnforceUniqueSlugs extends Migration
|
|||
->select(['slug', DB::raw('COUNT(*)')])
|
||||
->groupBy('slug')
|
||||
->havingRaw('COUNT(*) > 1')
|
||||
->lists('slug');
|
||||
->pluck('slug');
|
||||
|
||||
foreach ($slugs as $slug) {
|
||||
DB::transaction(function () use ($slug) {
|
||||
|
|
18
routes/api.php
Executable file
18
routes/api.php
Executable file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
})->middleware('auth:api');
|
18
routes/console.php
Executable file
18
routes/console.php
Executable file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is where you may define all of your Closure based console
|
||||
| commands. Each Closure is bound to a command instance allowing a
|
||||
| simple approach to interacting with each command's IO methods.
|
||||
|
|
||||
*/
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->describe('Display an inspiring quote');
|
Loading…
Reference in a new issue