Upgrading to Laravel 5.6

1) Changed method call from lists to pluck.
2) Use set put instead of session set.
3) Removed references to artisan optimize command.
4) Added additionl check to base controller if auth user not set redirect to login.
5) Flush the session on logout.
6) Updated Event and Route service providers to work with Laravel 5.6.
7) Added new default logging config file.
8) Bump PHP versions from 7.0.30 to 7.1.20.
9) Added missing translations.
10) Fixed some issues with the templates.
This commit is contained in:
Jeremy Quinton 2018-08-15 13:26:10 +02:00
parent 9eb5d1c062
commit 8d51cd348f
16 changed files with 112 additions and 24 deletions

View File

@ -1,4 +1,4 @@
FROM php:7.0.30-fpm FROM php:7.1.20-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libpq-dev \ libpq-dev \
libmcrypt-dev \ libmcrypt-dev \

View File

@ -1,4 +1,4 @@
FROM php:7.0.30-fpm FROM php:7.1.20-fpm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libpq-dev \ libpq-dev \
libmcrypt-dev \ libmcrypt-dev \

View File

@ -98,7 +98,7 @@ class EventAttendeesController extends MyBaseController
return view('ManageEvent.Modals.InviteAttendee', [ return view('ManageEvent.Modals.InviteAttendee', [
'event' => $event, 'event' => $event,
'tickets' => $event->tickets()->lists('title', 'id'), 'tickets' => $event->tickets()->pluck('title', 'id'),
]); ]);
} }
@ -252,7 +252,7 @@ class EventAttendeesController extends MyBaseController
return view('ManageEvent.Modals.ImportAttendee', [ return view('ManageEvent.Modals.ImportAttendee', [
'event' => $event, 'event' => $event,
'tickets' => $event->tickets()->lists('title', 'id'), 'tickets' => $event->tickets()->pluck('title', 'id'),
]); ]);
} }
@ -474,7 +474,7 @@ class EventAttendeesController extends MyBaseController
{ {
$data = [ $data = [
'event' => Event::scope()->find($event_id), 'event' => Event::scope()->find($event_id),
'tickets' => Event::scope()->find($event_id)->tickets()->lists('title', 'id')->toArray(), 'tickets' => Event::scope()->find($event_id)->tickets()->pluck('title', 'id')->toArray(),
]; ];
return view('ManageEvent.Modals.MessageAttendees', $data); return view('ManageEvent.Modals.MessageAttendees', $data);
@ -621,7 +621,7 @@ class EventAttendeesController extends MyBaseController
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'event' => $attendee->event, 'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'), 'tickets' => $attendee->event->tickets->pluck('title', 'id'),
]; ];
return view('ManageEvent.Modals.EditAttendee', $data); return view('ManageEvent.Modals.EditAttendee', $data);
@ -684,7 +684,7 @@ class EventAttendeesController extends MyBaseController
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'event' => $attendee->event, 'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'), 'tickets' => $attendee->event->tickets->pluck('title', 'id'),
]; ];
return view('ManageEvent.Modals.CancelAttendee', $data); return view('ManageEvent.Modals.CancelAttendee', $data);

View File

@ -200,7 +200,7 @@ class EventCheckoutController extends Controller
/* /*
* The 'ticket_order_{event_id}' session stores everything we need to complete the transaction. * The 'ticket_order_{event_id}' session stores everything we need to complete the transaction.
*/ */
session()->set('ticket_order_' . $event->id, [ session()->put('ticket_order_' . $event->id, [
'validation_rules' => $validation_rules, 'validation_rules' => $validation_rules,
'validation_messages' => $validation_messages, 'validation_messages' => $validation_messages,
'event_id' => $event->id, 'event_id' => $event->id,

View File

@ -24,7 +24,7 @@ class EventController extends MyBaseController
{ {
$data = [ $data = [
'modal_id' => $request->get('modal_id'), 'modal_id' => $request->get('modal_id'),
'organisers' => Organiser::scope()->lists('name', 'id'), 'organisers' => Organiser::scope()->pluck('name', 'id'),
'organiser_id' => $request->get('organiser_id') ? $request->get('organiser_id') : false, 'organiser_id' => $request->get('organiser_id') ? $request->get('organiser_id') : false,
]; ];

View File

@ -222,7 +222,6 @@ class InstallerController extends Controller
if (Timezone::count() == 0) { if (Timezone::count() == 0) {
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);
} }
Artisan::call('optimize', ['--force' => true]);
$fp = fopen(base_path() . '/installed', 'w'); $fp = fopen(base_path() . '/installed', 'w');
fwrite($fp, $version); fwrite($fp, $version);

View File

@ -29,9 +29,9 @@ class ManageAccountController extends MyBaseController
{ {
$data = [ $data = [
'account' => Account::find(Auth::user()->account_id), 'account' => Account::find(Auth::user()->account_id),
'timezones' => Timezone::lists('location', 'id'), 'timezones' => Timezone::pluck('location', 'id'),
'currencies' => Currency::lists('title', 'id'), 'currencies' => Currency::pluck('title', 'id'),
'payment_gateways' => PaymentGateway::lists('provider_name', 'id'), 'payment_gateways' => PaymentGateway::pluck('provider_name', 'id'),
'account_payment_gateways' => AccountPaymentGateway::scope()->get(), 'account_payment_gateways' => AccountPaymentGateway::scope()->get(),
'version_info' => $this->getVersionInfo(), 'version_info' => $this->getVersionInfo(),
]; ];

View File

@ -13,6 +13,11 @@ class MyBaseController extends Controller
{ {
public function __construct() public function __construct()
{ {
if (empty(Auth::user())) {
return redirect()->to('/login');
}
/* /*
* Set up JS across all views * Set up JS across all views
*/ */
@ -29,7 +34,6 @@ class MyBaseController extends Controller
'DateTimeFormat' => 'dd-MM-yyyy hh:mm', 'DateTimeFormat' => 'dd-MM-yyyy hh:mm',
'GenericErrorMessage' => trans("Controllers.whoops"), 'GenericErrorMessage' => trans("Controllers.whoops"),
]); ]);
/* /*
* Share the organizers across all views * Share the organizers across all views
*/ */

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Facades\Session;
class UserLogoutController extends Controller class UserLogoutController extends Controller
{ {
@ -21,7 +22,7 @@ class UserLogoutController extends Controller
public function doLogout() public function doLogout()
{ {
$this->auth->logout(); $this->auth->logout();
Session::flush();
return redirect()->to('/?logged_out=yup'); return redirect()->to('/?logged_out=yup');
} }
} }

View File

@ -233,7 +233,7 @@ class Event extends MyBaseModel
'Attendee Name', 'Attendee Name',
'Attendee Email', 'Attendee Email',
'Attendee Ticket' 'Attendee Ticket'
], $this->questions->lists('title')->toArray()); ], $this->questions->pluck('title')->toArray());
$attendees = $this->attendees()->has('answers')->get(); $attendees = $this->attendees()->has('answers')->get();

View File

@ -25,9 +25,9 @@ class EventServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
public function boot(DispatcherContract $events) public function boot()
{ {
parent::boot($events); parent::boot();
// //
} }

View File

@ -23,9 +23,9 @@ class RouteServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
public function boot(Router $router) public function boot()
{ {
parent::boot($router); parent::boot();
// //
} }

81
config/logging.php Normal file
View File

@ -0,0 +1,81 @@
<?php
use Monolog\Handler\StreamHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];

View File

@ -18,7 +18,7 @@ return array (
'arrived' => 'Arrived', 'arrived' => 'Arrived',
'attendee_cancelled' => 'Cancelled', 'attendee_cancelled' => 'Cancelled',
'attendee_refunded' => 'Refunded', 'attendee_refunded' => 'Refunded',
'awaiting_payment' => 'awaiting_payment', 'awaiting_payment' => 'Awaiting Payment',
'before_order' => 'Message to display to attendees before they complete their order.', 'before_order' => 'Message to display to attendees before they complete their order.',
'before_order_help' => 'This message will be displayed to attendees immediately before they finalize their order.', 'before_order_help' => 'This message will be displayed to attendees immediately before they finalize their order.',
'booking_fee' => 'Booking Fee', 'booking_fee' => 'Booking Fee',
@ -41,7 +41,7 @@ return array (
'price' => 'Price', 'price' => 'Price',
'purchase_date' => 'Purchase Date', 'purchase_date' => 'Purchase Date',
'quantity' => 'Quantity', 'quantity' => 'Quantity',
'recent_orders' => 'recent_orders', 'recent_orders' => 'Recent Orders',
'reference' => 'Reference', 'reference' => 'Reference',
'refund/cancel' => 'Refund / Cancel', 'refund/cancel' => 'Refund / Cancel',
'status' => 'Status', 'status' => 'Status',

View File

@ -10,7 +10,10 @@
@include('ManageEvent.Partials.TopNav') @include('ManageEvent.Partials.TopNav')
@stop @stop
@section('page_title', '<i class="ico-home2"></i>&nbsp;'.trans("basic.event_dashboard")) @section('page_title')
<i class="ico-home2"></i>
@lang("basic.event_dashboard")
@endsection
@section('menu') @section('menu')
@include('ManageEvent.Partials.Sidebar') @include('ManageEvent.Partials.Sidebar')

View File

@ -3,7 +3,7 @@
@section('title') @section('title')
@parent @parent
@lang("Organiser.dashboard") @lang("Organiser.dashboard")
@stop @endsection
@section('top_nav') @section('top_nav')
@include('ManageOrganiser.Partials.TopNav') @include('ManageOrganiser.Partials.TopNav')