From b3f33a38e88b98bcd812d48abaa8172fa03bfbe4 Mon Sep 17 00:00:00 2001 From: Attendize Date: Fri, 4 Mar 2016 19:18:10 -0500 Subject: [PATCH] Applied fixes from StyleCI --- app/Attendize/Utils.php | 22 +- app/Attendize/handlers/QueueHandler.php | 65 ++- app/Attendize/mailers/AttendeeMailer.php | 19 +- app/Attendize/mailers/Mailer.php | 9 +- app/Attendize/mailers/OrderMailer.php | 45 +- app/Attendize/mailers/UserMailer.php | 5 +- app/Commands/Command.php | 9 +- app/Commands/MessageAttendeesCommand.php | 27 +- app/Commands/OrderTicketsCommand.php | 36 +- app/Console/Commands/Install.php | 99 ++-- app/Console/Kernel.php | 44 +- app/Events/Event.php | 9 +- app/Exceptions/Handler.php | 47 +- app/Helpers/helpers.php | 30 +- app/Helpers/macros.php | 40 +- app/Http/Controllers/Auth/AuthController.php | 58 +- .../Controllers/Auth/PasswordController.php | 60 +-- app/Http/Controllers/Controller.php | 13 +- .../Controllers/EventAttendeesController.php | 303 +++++------ .../Controllers/EventCheckInController.php | 60 ++- .../Controllers/EventCheckoutController.php | 275 +++++----- app/Http/Controllers/EventController.php | 180 +++---- .../Controllers/EventCustomizeController.php | 129 ++--- .../Controllers/EventDashboardController.php | 65 +-- .../Controllers/EventOrdersController.php | 144 +++-- .../Controllers/EventPromoteController.php | 17 +- .../EventTicketQuestionsController.php | 52 +- .../Controllers/EventTicketsController.php | 167 +++--- app/Http/Controllers/EventViewController.php | 75 ++- .../EventViewEmbeddedController.php | 23 +- app/Http/Controllers/ImageController.php | 12 +- app/Http/Controllers/InstallerController.php | 105 ++-- .../Controllers/ManageAccountController.php | 151 +++--- app/Http/Controllers/MyBaseController.php | 31 +- app/Http/Controllers/OrganiserController.php | 111 ++-- .../OrganiserCustomizeController.php | 62 +-- .../OrganiserDashboardController.php | 24 +- .../Controllers/OrganiserEventsController.php | 32 +- .../Controllers/OrganiserViewController.php | 30 +- app/Http/Controllers/RemindersController.php | 58 +- app/Http/Controllers/UserController.php | 57 +- app/Http/Controllers/UserLoginController.php | 46 +- app/Http/Controllers/UserLogoutController.php | 19 +- app/Http/Controllers/UserSignupController.php | 134 +++-- app/Http/Kernel.php | 61 +-- app/Http/Middleware/Authenticate.php | 83 ++- app/Http/Middleware/CheckInstalled.php | 16 +- app/Http/Middleware/FirstRunMiddleware.php | 28 +- app/Http/Middleware/GeneralChecks.php | 14 +- .../Middleware/RedirectIfAuthenticated.php | 72 +-- app/Http/Middleware/VerifyCsrfToken.php | 39 +- app/Http/Requests/Request.php | 11 +- app/Http/routes.php | 509 ++++++++---------- app/Models/Account.php | 39 +- app/Models/Activity.php | 10 +- app/Models/Affiliate.php | 16 +- app/Models/Attendee.php | 70 +-- app/Models/Currency.php | 24 +- app/Models/DateFormat.php | 11 +- app/Models/DateTimeFormat.php | 14 +- app/Models/DiscountCode.php | 9 +- app/Models/Event.php | 151 +++--- app/Models/EventImage.php | 11 +- app/Models/EventStats.php | 70 +-- app/Models/Message.php | 31 +- app/Models/MyBaseModel.php | 49 +- app/Models/Order.php | 80 +-- app/Models/OrderItem.php | 12 +- app/Models/OrderStatus.php | 11 +- app/Models/Organiser.php | 69 +-- app/Models/PaymentGateway.php | 9 +- app/Models/Question.php | 21 +- app/Models/QuestionType.php | 10 +- app/Models/ReservedTickets.php | 12 +- app/Models/Ticket.php | 140 +++-- app/Models/TicketStatus.php | 9 +- app/Models/Timezone.php | 11 +- app/Models/User.php | 45 +- app/Providers/AppServiceProvider.php | 20 +- app/Providers/BusServiceProvider.php | 57 +- app/Providers/ConfigServiceProvider.php | 39 +- app/Providers/EventServiceProvider.php | 52 +- app/Providers/HelpersServiceProvider.php | 46 +- app/Providers/RouteServiceProvider.php | 76 +-- app/Services/Registrar.php | 69 +-- bootstrap/app.php | 14 +- bootstrap/autoload.php | 5 +- config/Wkhtml2pdf.php | 12 +- config/app.php | 92 ++-- config/attendize.php | 16 +- config/auth.php | 108 ++-- config/barcode.php | 2 +- config/cache.php | 122 ++--- config/compile.php | 60 +-- config/database.php | 204 +++---- config/debugbar.php | 58 +- config/excel.php | 234 ++++---- config/filesystems.php | 110 ++-- config/image.php | 6 +- config/mail.php | 202 +++---- config/queue.php | 26 +- config/services.php | 54 +- config/session.php | 250 ++++----- config/view.php | 48 +- .../2014_03_26_180116_create_users_table.php | 101 ++-- ...014_04_08_232044_setup_countries_table.php | 77 ++- ...12_100000_create_password_resets_table.php | 52 +- ...2014_11_07_132018_add_affiliates_table.php | 14 +- ..._11_17_011806_create_failed_jobs_table.php | 56 +- database/seeds/ConstantsSeeder.php | 481 ++++++++--------- database/seeds/CountriesSeeder.php | 39 +- database/seeds/DatabaseSeeder.php | 11 +- public/index.php | 5 +- resources/lang/en/pagination.php | 24 +- resources/lang/en/passwords.php | 30 +- resources/lang/en/validation.php | 192 +++---- server.php | 11 +- tests/ExampleTest.php | 22 +- tests/TestCase.php | 29 +- 119 files changed, 3910 insertions(+), 3982 deletions(-) diff --git a/app/Attendize/Utils.php b/app/Attendize/Utils.php index 88a00217..3afd724e 100644 --- a/app/Attendize/Utils.php +++ b/app/Attendize/Utils.php @@ -1,9 +1,9 @@ -is_registered; @@ -30,7 +30,8 @@ class Utils * * @return bool */ - public static function isAttendize() { + public static function isAttendize() + { return self::isAttendizeCloud() || self::isAttendizeDev(); } @@ -56,11 +57,11 @@ class Utils public static function isDownForMaintenance() { - return file_exists(storage_path() . '/framework/down'); + return file_exists(storage_path().'/framework/down'); } - - public static function file_upload_max_size() { + public static function file_upload_max_size() + { static $max_size = -1; if ($max_size < 0) { @@ -74,18 +75,19 @@ class Utils $max_size = $upload_max; } } + return $max_size; } - public static function parse_size($size) { + public static function parse_size($size) + { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size. $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size. if ($unit) { // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by. return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); - } - else { + } else { return round($size); } } -} \ No newline at end of file +} diff --git a/app/Attendize/handlers/QueueHandler.php b/app/Attendize/handlers/QueueHandler.php index 40b6619d..aa09fe86 100644 --- a/app/Attendize/handlers/QueueHandler.php +++ b/app/Attendize/handlers/QueueHandler.php @@ -1,60 +1,62 @@ -orderMailer = $orderMailer; } - - - public function handleOrder($job, $data) { + + public function handleOrder($job, $data) + { echo "Starting Job {$job->getJobId()}\n"; - + $order = Order::findOrfail($data['order_id']); - + /* * Steps : * 1 Notify event organiser * 2 Order Confirmation email to buyer * 3 Generate / Send Tickets */ - + $data = [ - 'order' => $order, - 'event' => $order->event, - 'tickets' => $order->event->tickets, - 'attendees' => $order->attendees + 'order' => $order, + 'event' => $order->event, + 'tickets' => $order->event->tickets, + 'attendees' => $order->attendees, ]; $pdf_file = storage_path().'/'.$order->order_reference; - exit($pdf_file); - - + exit($pdf_file); + PDF::setOutputMode('F'); // force to file - PDF::html('Public.ViewEvent.Partials.PDFTicket', $data, $pdf_file); - - + PDF::html('Public.ViewEvent.Partials.PDFTicket', $data, $pdf_file); + //1 $this->orderMailer->sendOrderNotification($order); //2 $this->orderMailer->sendOrderConfirmation($order); //3 - + $this->orderMailer->sendTickets($order); - + $job->delete(); } - public function messageAttendees($job, $data) { - - echo "Starting Job {$job->getJobId()}\n"; + public function messageAttendees($job, $data) + { + echo "Starting Job {$job->getJobId()}\n"; $message_object = Message::find($data['message_id']); $event = $message_object->event; @@ -67,25 +69,22 @@ class QueueHandler { } $data = [ - 'event' => $event, + 'event' => $event, 'message_content' => $message_object->message, - 'subject' => $message_object->subject + 'subject' => $message_object->subject, ]; - Mail::send('Emails.messageAttendees', $data, function($message) use ($toFields, $event, $message_object) { + Mail::send('Emails.messageAttendees', $data, function ($message) use ($toFields, $event, $message_object) { $message->to($toFields) ->from(config('attendize.outgoing_email_noreply'), $event->organiser->name) ->replyTo($event->organiser->email, $event->organiser->name) ->subject($message_object->subject); }); - - $message_object->is_sent = 1; $message_object->save(); //$message->sent $job->delete(); } - } diff --git a/app/Attendize/mailers/AttendeeMailer.php b/app/Attendize/mailers/AttendeeMailer.php index 3cf354dc..d0673ca4 100644 --- a/app/Attendize/mailers/AttendeeMailer.php +++ b/app/Attendize/mailers/AttendeeMailer.php @@ -2,15 +2,15 @@ namespace App\Attendize\mailers; -use Mail; use App\Models\Attendee; use App\Models\Message; use Carbon\Carbon; +use Mail; -class AttendeeMailer extends Mailer { - - public function sendMessageToAttendees(Message $message_object) { - +class AttendeeMailer extends Mailer +{ + public function sendMessageToAttendees(Message $message_object) + { $event = $message_object->event; $attendees = ($message_object->recipients == 0) @@ -23,26 +23,23 @@ class AttendeeMailer extends Mailer { } $data = [ - 'event' => $event, + 'event' => $event, 'message_content' => $message_object->message, - 'subject' => $message_object->subject + 'subject' => $message_object->subject, ]; /* * Mandril lets us send the email to multiple people at once. */ - Mail::send('Emails.messageAttendees', $data, function($message) use ($toFields, $event, $message_object) { + Mail::send('Emails.messageAttendees', $data, function ($message) use ($toFields, $event, $message_object) { $message->to($toFields) ->from(config('attendize.outgoing_email_noreply'), $event->organiser->name) ->replyTo($event->organiser->email, $event->organiser->name) ->subject($message_object->subject); }); - - $message_object->is_sent = 1; $message_object->sent_at = Carbon::now(); $message_object->save(); } - } diff --git a/app/Attendize/mailers/Mailer.php b/app/Attendize/mailers/Mailer.php index cc6b9b91..96985f0e 100644 --- a/app/Attendize/mailers/Mailer.php +++ b/app/Attendize/mailers/Mailer.php @@ -1,11 +1,12 @@ -subject($subject); }); } -} \ No newline at end of file +} diff --git a/app/Attendize/mailers/OrderMailer.php b/app/Attendize/mailers/OrderMailer.php index c7db957b..f8f9a9be 100644 --- a/app/Attendize/mailers/OrderMailer.php +++ b/app/Attendize/mailers/OrderMailer.php @@ -1,35 +1,36 @@ -sendTo($order->account->email, config('attendize.outgoing_email'), config('attendize.outgoing_email_name'), 'New order received on the event '. $order->event->title .' ['. $order->order_reference .']', 'Emails.OrderNotification', [ - 'order' => $order +class OrderMailer extends Mailer +{ + public function sendOrderNotification(Order $order) + { + $this->sendTo($order->account->email, config('attendize.outgoing_email'), config('attendize.outgoing_email_name'), 'New order received on the event '.$order->event->title.' ['.$order->order_reference.']', 'Emails.OrderNotification', [ + 'order' => $order, ]); } - - public function sendOrderConfirmation(Order $order) { - + + public function sendOrderConfirmation(Order $order) + { $ticket_pdf = public_path($order->ticket_pdf_path); - - if(!file_exists($ticket_pdf)){ - $ticket_pdf = FALSE; + + if (!file_exists($ticket_pdf)) { + $ticket_pdf = false; } - - $this->sendTo($order->email, config('attendize.outgoing_email'), $order->event->organiser->name, 'Your tickets & order confirmation for the event '. $order->event->title .' ['. $order->order_reference .']', 'Emails.OrderConfirmation', [ - 'order' => $order, - 'email_logo' => $order->event->organiser->full_logo_path + + $this->sendTo($order->email, config('attendize.outgoing_email'), $order->event->organiser->name, 'Your tickets & order confirmation for the event '.$order->event->title.' ['.$order->order_reference.']', 'Emails.OrderConfirmation', [ + 'order' => $order, + 'email_logo' => $order->event->organiser->full_logo_path, ], $ticket_pdf); } - - public function sendTickets(Order $order) { -// $this->sendTo($order->account->email, config('attendize.outgoing_email'), config('attendize.outgoing_email_name'), 'New order received on the event '. $order->event->title .' ['. $order->order_reference .']', 'Emails.OrderNotification', [ + + public function sendTickets(Order $order) + { + // $this->sendTo($order->account->email, config('attendize.outgoing_email'), config('attendize.outgoing_email_name'), 'New order received on the event '. $order->event->title .' ['. $order->order_reference .']', 'Emails.OrderNotification', [ // 'order' => $order // ]); } - - } diff --git a/app/Attendize/mailers/UserMailer.php b/app/Attendize/mailers/UserMailer.php index fda21c85..a3d5306d 100644 --- a/app/Attendize/mailers/UserMailer.php +++ b/app/Attendize/mailers/UserMailer.php @@ -5,10 +5,11 @@ */ /** - * Description of UserMailer + * Description of UserMailer. * * @author Dave */ -class UserMailer { +class UserMailer +{ //put your code here } diff --git a/app/Commands/Command.php b/app/Commands/Command.php index 018bc219..c9b0a33a 100644 --- a/app/Commands/Command.php +++ b/app/Commands/Command.php @@ -1,7 +1,8 @@ -attendeeMessage = $attendeeMessage; } - function handle(AttendeeMailer $mailer) { - Log::info(date('d m y H:i') . " - Starting Job {$this->job->getJobId()} ".__CLASS__); - + public function handle(AttendeeMailer $mailer) + { + Log::info(date('d m y H:i')." - Starting Job {$this->job->getJobId()} ".__CLASS__); + $mailer->sendMessageToAttendees($this->attendeeMessage); - Log::info( date('d m y H:i') . " - Finished Job {$this->job->getJobId()} ".__CLASS__); + Log::info(date('d m y H:i')." - Finished Job {$this->job->getJobId()} ".__CLASS__); $this->delete(); } - } diff --git a/app/Commands/OrderTicketsCommand.php b/app/Commands/OrderTicketsCommand.php index fdb495eb..2a710006 100644 --- a/app/Commands/OrderTicketsCommand.php +++ b/app/Commands/OrderTicketsCommand.php @@ -2,16 +2,15 @@ namespace App\Commands; -use Log; -use App\Commands\Command; -use Illuminate\Queue\SerializesModels; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Contracts\Queue\ShouldBeQueued; use App\Attendize\mailers\OrderMailer; use Illuminate\Contracts\Bus\SelfHandling; +use Illuminate\Contracts\Queue\ShouldBeQueued; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; +use Log; -class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandling { - +class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandling +{ use InteractsWithQueue, SerializesModels; @@ -20,10 +19,12 @@ class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandlin /** * OrderTicketsCommand constructor. + * * @param \App\Models\Order $ticketOrder - * @param bool|TRUE $sendOrderConfirmation + * @param bool|true $sendOrderConfirmation */ - public function __construct(\App\Models\Order $ticketOrder, $sendOrderConfirmation = TRUE) { + public function __construct(\App\Models\Order $ticketOrder, $sendOrderConfirmation = true) + { $this->ticketOrder = $ticketOrder; $this->sendOrderConfirmation = $sendOrderConfirmation; } @@ -31,24 +32,23 @@ class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandlin /** * @param OrderMailer $mailer */ - function handle(OrderMailer $mailer) { - - Log::info(date('d m y H:i') . " - Starting Job {$this->job->getJobId()} ".__CLASS__); + public function handle(OrderMailer $mailer) + { + Log::info(date('d m y H:i')." - Starting Job {$this->job->getJobId()} ".__CLASS__); //1 - Notify event organiser - if($this->sendOrderConfirmation) { - $mailer->sendOrderNotification($this->ticketOrder); + if ($this->sendOrderConfirmation) { + $mailer->sendOrderNotification($this->ticketOrder); } - + //2 - Generate PDF Tickets $this->ticketOrder->generatePdfTickets(); - + //3 - Send Tickets / Order confirmation $mailer->sendOrderConfirmation($this->ticketOrder); - Log::info(date('d m y H:i') . " - Finished Job {$this->job->getJobId()} ".__CLASS__); + Log::info(date('d m y H:i')." - Finished Job {$this->job->getJobId()} ".__CLASS__); $this->delete(); } - } diff --git a/app/Console/Commands/Install.php b/app/Console/Commands/Install.php index 9d9da60f..c4019c1d 100644 --- a/app/Console/Commands/Install.php +++ b/app/Console/Commands/Install.php @@ -1,4 +1,6 @@ -error('Unable to connect to database.'); - $this->error('Please fill valid database credentials into .env and rerun this command.'); + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $version = file_get_contents(base_path('VERSION')); + try { + DB::connection(); + } catch (\Exception $e) { + $this->error('Unable to connect to database.'); + $this->error('Please fill valid database credentials into .env and rerun this command.'); - return; - } + return; + } - $this->comment('Attempting to install Attendize v'.$version); + $this->comment('Attempting to install Attendize v'.$version); - if (!env('APP_KEY')) { - $this->info('Generating app key'); - Artisan::call('key:generate'); - } else { - $this->comment('App key exists -- skipping'); - } + if (!env('APP_KEY')) { + $this->info('Generating app key'); + Artisan::call('key:generate'); + } else { + $this->comment('App key exists -- skipping'); + } + $this->info('Migrating database'); + Artisan::call('migrate', ['--force' => true]); - $this->info('Migrating database'); - Artisan::call('migrate', ['--force' => true]); + if (!Timezone::count()) { + $this->info('Seeding DB data'); + Artisan::call('db:seed', ['--force' => true]); + } else { + $this->comment('Data already seeded -- skipping'); + } - if (!Timezone::count()) { - $this->info('Seeding DB data'); - Artisan::call('db:seed', ['--force' => true]); - } else { - $this->comment('Data already seeded -- skipping'); - } + file_put_contents(base_path('installed'), $version); - file_put_contents(base_path('installed'), $version); - - $this->comment('Success! You can now run Attendize'); - $this->comment('Navigate to /signup to create your account.'); - } -} \ No newline at end of file + $this->comment('Success! You can now run Attendize'); + $this->comment('Navigate to /signup to create your account.'); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 62f86413..006e498d 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,27 +1,29 @@ -isHttpException($e)) { return $this->renderHttpException($e); } - if (config('app.debug')) { return $this->renderExceptionWithWhoops($e); } @@ -52,22 +56,23 @@ class Handler extends ExceptionHandler { /** * Render an exception using Whoops. - * - * @param \Exception $e + * + * @param \Exception $e + * * @return \Illuminate\Http\Response */ - protected function renderExceptionWithWhoops(Exception $e) { - $whoops = new \Whoops\Run; - - if(Request::ajax()) { - $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler); + protected function renderExceptionWithWhoops(Exception $e) + { + $whoops = new \Whoops\Run(); + + if (Request::ajax()) { + $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler()); } else { - $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); + $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); } - + return new \Illuminate\Http\Response( $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() ); } - } diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index febaf2ec..819919c0 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -1,33 +1,33 @@ getAuthPassword()); }); @@ -10,36 +9,35 @@ Validator::extend('passcheck', function ($attribute, $value, $parameters) * Some macros and blade extensions */ -Form::macro('rawLabel', function($name, $value = null, $options = array()) { +Form::macro('rawLabel', function ($name, $value = null, $options = []) { $label = Form::label($name, '%s', $options); return sprintf($label, $value); }); -Form::macro('labelWithHelp', function($name, $value = null, $options = array(), $help_text) { +Form::macro('labelWithHelp', function ($name, $value, $options, $help_text) { $label = Form::label($name, '%s', $options); return sprintf($label, $value) .'' - . '' - . ''; + .'' + .''; }); +Form::macro('customCheckbox', function ($name, $value, $checked = false, $label = false, $options = []) { -Form::macro('customCheckbox', function($name, $value, $checked=FALSE, $label = FALSE, $options= []) { - // $checkbox = Form::checkbox($name, $value = null, $checked, $options); // $label = Form::rawLabel(); -// -// $out = '
-// -// +// +// $out = '
+// +// //
'; -// +// // return $out; }); -Form::macro('styledFile', function($name, $multiple = FALSE) { +Form::macro('styledFile', function ($name, $multiple = false) { $out = '
@@ -55,17 +53,17 @@ Form::macro('styledFile', function($name, $multiple = FALSE) {
'; - + return $out; }); -HTML::macro('sortable_link', function($title, $active_sort, $sort_by, $sort_order, $url_params = [], $class = '', $extra = '') { +HTML::macro('sortable_link', function ($title, $active_sort, $sort_by, $sort_order, $url_params = [], $class = '', $extra = '') { $sort_order = $sort_order == 'asc' ? 'desc' : 'asc'; $url_params = http_build_query([ - 'sort_by' => $sort_by, - 'sort_order' => $sort_order + 'sort_by' => $sort_by, + 'sort_order' => $sort_order, ] + $url_params); $html = ""; @@ -79,10 +77,6 @@ HTML::macro('sortable_link', function($title, $active_sort, $sort_by, $sort_orde return $html; }); - - -Blade::directive('money', function($expression) { +Blade::directive('money', function ($expression) { return ""; }); - - diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 4ad5c58a..5cee6132 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -1,38 +1,40 @@ -auth = $auth; - $this->registrar = $registrar; - - $this->middleware('guest', ['except' => 'getLogout']); - } + /** + * Create a new authentication controller instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Registrar $registrar + * + * @return void + */ + public function __construct(Guard $auth, Registrar $registrar) + { + $this->auth = $auth; + $this->registrar = $registrar; + $this->middleware('guest', ['except' => 'getLogout']); + } } diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 9fe481fc..62f76e4f 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -1,38 +1,38 @@ -auth = $auth; - $this->passwords = $passwords; - - $this->middleware('guest'); - } + /** + * Create a new password controller instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\PasswordBroker $passwords + * + * @return void + */ + public function __construct() + { + $this->auth = $auth; + $this->passwords = $passwords; + $this->middleware('guest'); + } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 27b3f452..c8102642 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,11 +1,12 @@ -find($event_id); //$event = Event::scope()->join('orders', 'orders.event_id', '=', 'attendees.id')->find($event_id); if ($searchQuery) { - $attendees = $event->attendees() ->withoutCancelled() ->join('orders', 'orders.id', '=', 'attendees.order_id') - ->where(function($query) use ($searchQuery) { - $query->where('orders.order_reference', 'like', $searchQuery . '%') - ->orWhere('attendees.first_name', 'like', $searchQuery . '%') - ->orWhere('attendees.email', 'like', $searchQuery . '%') - ->orWhere('attendees.last_name', 'like', $searchQuery . '%'); + ->where(function ($query) use ($searchQuery) { + $query->where('orders.order_reference', 'like', $searchQuery.'%') + ->orWhere('attendees.first_name', 'like', $searchQuery.'%') + ->orWhere('attendees.email', 'like', $searchQuery.'%') + ->orWhere('attendees.last_name', 'like', $searchQuery.'%'); }) - ->orderBy(($sort_by == 'order_reference' ? 'orders.' : 'attendees.') . $sort_by, $sort_order) + ->orderBy(($sort_by == 'order_reference' ? 'orders.' : 'attendees.').$sort_by, $sort_order) ->select('attendees.*', 'orders.order_reference') ->paginate(); } else { $attendees = $event->attendees() ->join('orders', 'orders.id', '=', 'attendees.order_id') ->withoutCancelled() - ->orderBy(($sort_by == 'order_reference' ? 'orders.' : 'attendees.') . $sort_by, $sort_order) + ->orderBy(($sort_by == 'order_reference' ? 'orders.' : 'attendees.').$sort_by, $sort_order) ->select('attendees.*', 'orders.order_reference') ->paginate(); } $data = [ - 'attendees' => $attendees, - 'event' => $event, - 'sort_by' => $sort_by, + 'attendees' => $attendees, + 'event' => $event, + 'sort_by' => $sort_by, 'sort_order' => $sort_order, - 'q' => $searchQuery ? $searchQuery : '' + 'q' => $searchQuery ? $searchQuery : '', ]; - - return View::make('ManageEvent.Attendees', $data); } - public function showCreateAttendee($event_id) { - + public function showCreateAttendee($event_id) + { $event = Event::scope()->find($event_id); /* * If there are no tickets then we can't create an attendee * @todo This is a bit hackish */ - if($event->tickets->count() === 0) { + if ($event->tickets->count() === 0) { return ''; } - return View::make('ManageEvent.Modals.CreateAttendee', array( + return View::make('ManageEvent.Modals.CreateAttendee', [ 'modal_id' => \Input::get('modal_id'), - 'event' => $event, - 'tickets' => $event->tickets()->lists('title', 'id') - )); + 'event' => $event, + 'tickets' => $event->tickets()->lists('title', 'id'), + ]); } - public function postCreateAttendee($event_id) { - + public function postCreateAttendee($event_id) + { $rules = [ - 'first_name' => 'required', - 'ticket_id' => 'required|exists:tickets,id,account_id,' . \Auth::user()->account_id, + 'first_name' => 'required', + 'ticket_id' => 'required|exists:tickets,id,account_id,'.\Auth::user()->account_id, 'ticket_price' => 'numeric|required', - 'email' => 'email|required', + 'email' => 'email|required', ]; $messages = [ - 'ticket_id.exists' => 'The ticket you have selected does not exist', - 'ticket_id.required' => 'The ticket field is required. ' + 'ticket_id.exists' => 'The ticket you have selected does not exist', + 'ticket_id.required' => 'The ticket field is required. ', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $ticket_id = Input::get('ticket_id'); @@ -121,11 +115,10 @@ class EventAttendeesController extends MyBaseController { $attendee_email = Input::get('email'); $email_attendee = Input::get('email_ticket'); - /* * Create the order */ - $order = new Order; + $order = new Order(); $order->first_name = $attendee_first_name; $order->last_name = $attendee_last_name; $order->email = $attendee_email; @@ -143,30 +136,27 @@ class EventAttendeesController extends MyBaseController { $ticket->increment('sales_volume', $ticket_price); $ticket->event->increment('sales_volume', $ticket_price); - /* * Insert order item */ - $orderItem = new OrderItem; + $orderItem = new OrderItem(); $orderItem->title = $ticket->title; $orderItem->quantity = 1; $orderItem->order_id = $order->id; $orderItem->unit_price = $ticket_price; $orderItem->save(); - /* * Update the event stats */ - $event_stats = new EventStats; + $event_stats = new EventStats(); $event_stats->updateTicketsSoldCount($event_id, 1); $event_stats->updateTicketRevenue($ticket_id, $ticket_price); - /* * Create the attendee */ - $attendee = new Attendee; + $attendee = new Attendee(); $attendee->first_name = $attendee_first_name; $attendee->last_name = $attendee_last_name; $attendee->email = $attendee_email; @@ -174,7 +164,7 @@ class EventAttendeesController extends MyBaseController { $attendee->order_id = $order->id; $attendee->ticket_id = $ticket_id; $attendee->account_id = Auth::user()->account_id; - $attendee->reference = $order->order_reference . '-1'; + $attendee->reference = $order->order_reference.'-1'; $attendee->save(); if ($email_attendee == '1') { @@ -183,63 +173,63 @@ class EventAttendeesController extends MyBaseController { Session::flash('message', 'Attendee Successfully Created'); - return Response::json(array( - 'status' => 'success', - 'id' => $attendee->id, - 'redirectUrl' => route('showEventAttendees', array( - 'event_id' => $event_id - )) - )); + return Response::json([ + 'status' => 'success', + 'id' => $attendee->id, + 'redirectUrl' => route('showEventAttendees', [ + 'event_id' => $event_id, + ]), + ]); } - public function showPrintAttendees($event_id) { - + public function showPrintAttendees($event_id) + { $data['event'] = Event::scope()->find($event_id); $data['attendees'] = $data['event']->attendees()->withoutCancelled()->orderBy('first_name')->get(); return View::make('ManageEvent.PrintAttendees', $data); } - public function showMessageAttendee($attendee_id) { - + public function showMessageAttendee($attendee_id) + { $attendee = Attendee::scope()->findOrFail($attendee_id); $data = [ 'attendee' => $attendee, - 'event' => $attendee->event, + 'event' => $attendee->event, 'modal_id' => Input::get('modal_id'), ]; return View::make('ManageEvent.Modals.MessageAttendee', $data); } - public function postMessageAttendee($attendee_id) { - + public function postMessageAttendee($attendee_id) + { $rules = [ 'subject' => 'required', - 'message' => 'required' + 'message' => 'required', ]; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $attendee = Attendee::scope()->findOrFail($attendee_id); $data = [ - 'attendee' => $attendee, + 'attendee' => $attendee, 'message_content' => Input::get('message'), - 'subject' => Input::get('subject'), - 'event' => $attendee->event, - 'email_logo' => $attendee->event->organiser->full_logo_path + 'subject' => Input::get('subject'), + 'event' => $attendee->event, + 'email_logo' => $attendee->event->organiser->full_logo_path, ]; - Mail::send('Emails.messageAttendees', $data, function($message) use ($attendee, $data) { + Mail::send('Emails.messageAttendees', $data, function ($message) use ($attendee, $data) { $message->to($attendee->email, $attendee->full_name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->replyTo($attendee->event->organiser->email, $attendee->event->organiser->name) @@ -248,50 +238,46 @@ class EventAttendeesController extends MyBaseController { /* Could bcc in the above? */ if (Input::get('send_copy') == '1') { - Mail::send('Emails.messageAttendees', $data, function($message) use ($attendee, $data) { + Mail::send('Emails.messageAttendees', $data, function ($message) use ($attendee, $data) { $message->to($attendee->event->organiser->email, $attendee->event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->replyTo($attendee->event->organiser->email, $attendee->event->organiser->name) - ->subject($data['subject'] . '[ORGANISER COPY]'); + ->subject($data['subject'].'[ORGANISER COPY]'); }); } - - - - - return Response::json(array( - 'status' => 'success', - 'message' => 'Message Successfully Sent' - )); + return Response::json([ + 'status' => 'success', + 'message' => 'Message Successfully Sent', + ]); } - public function showMessageAttendees($event_id) { - + public function showMessageAttendees($event_id) + { $data = [ - 'event' => Event::scope()->find($event_id), + 'event' => Event::scope()->find($event_id), 'modal_id' => Input::get('modal_id'), - 'tickets' => Event::scope()->find($event_id)->tickets()->lists('title', 'id')->toArray() + 'tickets' => Event::scope()->find($event_id)->tickets()->lists('title', 'id')->toArray(), ]; return View::make('ManageEvent.Modals.MessageAttendees', $data); } - public function postMessageAttendees($event_id) { - + public function postMessageAttendees($event_id) + { $rules = [ - 'subject' => 'required', - 'message' => 'required', - 'recipients' => 'required' + 'subject' => 'required', + 'message' => 'required', + 'recipients' => 'required', ]; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $message = Message::createNew(); @@ -305,15 +291,15 @@ class EventAttendeesController extends MyBaseController { * Add to the queue */ - return Response::json(array( - 'status' => 'success', - 'message' => 'Message Successfully Sent' - )); + return Response::json([ + 'status' => 'success', + 'message' => 'Message Successfully Sent', + ]); } - public function showExportAttendees($event_id, $export_as = 'xls') { - - Excel::create('attendees-as-of-' . date('d-m-Y-g.i.a'), function($excel) use ($event_id) { + public function showExportAttendees($event_id, $export_as = 'xls') + { + Excel::create('attendees-as-of-'.date('d-m-Y-g.i.a'), function ($excel) use ($event_id) { $excel->setTitle('Attendees List'); @@ -321,7 +307,7 @@ class EventAttendeesController extends MyBaseController { $excel->setCreator(config('attendize.app_name')) ->setCompany(config('attendize.app_name')); - $excel->sheet('attendees_sheet_1', function($sheet) use ($event_id) { + $excel->sheet('attendees_sheet_1', function ($sheet) use ($event_id) { DB::connection()->setFetchMode(\PDO::FETCH_ASSOC); $data = DB::table('attendees') @@ -335,58 +321,54 @@ class EventAttendeesController extends MyBaseController { 'attendees.first_name', 'attendees.last_name', 'attendees.email', 'attendees.reference', 'orders.order_reference', 'tickets.title', 'orders.created_at', DB::raw("(CASE WHEN attendees.has_arrived = 1 THEN 'YES' ELSE 'NO' END) AS `attendees.has_arrived`"), 'attendees.arrival_time')->get(); //DB::raw("(CASE WHEN UNIX_TIMESTAMP(`attendees.arrival_time`) = 0 THEN '---' ELSE 'd' END) AS `attendees.arrival_time`")) - - - $sheet->fromArray($data); - $sheet->row(1, array( - 'First Name', 'Last Name', 'Email', 'Ticket Reference', 'Order Reference', 'Ticket Type', 'Purchase Date', 'Has Arrived', 'Arrival Time' - )); + $sheet->row(1, [ + 'First Name', 'Last Name', 'Email', 'Ticket Reference', 'Order Reference', 'Ticket Type', 'Purchase Date', 'Has Arrived', 'Arrival Time', + ]); // Set gray background on first row - $sheet->row(1, function($row) { + $sheet->row(1, function ($row) { $row->setBackground('#f5f5f5'); }); }); })->export($export_as); } - public function showEditAttendee($event_id, $attendee_id) { - - + public function showEditAttendee($event_id, $attendee_id) + { $attendee = Attendee::scope()->findOrFail($attendee_id); $data = [ 'attendee' => $attendee, - 'event' => $attendee->event, - 'tickets' => $attendee->event->tickets->lists('title', 'id'), + 'event' => $attendee->event, + 'tickets' => $attendee->event->tickets->lists('title', 'id'), 'modal_id' => Input::get('modal_id'), ]; return View::make('ManageEvent.Modals.EditAttendee', $data); } - public function postEditAttendee($event_id, $attendee_id) { - + public function postEditAttendee($event_id, $attendee_id) + { $rules = [ 'first_name' => 'required', - 'ticket_id' => 'required|exists:tickets,id,account_id,' . Auth::user()->account_id, - 'email' => 'required|email' + 'ticket_id' => 'required|exists:tickets,id,account_id,'.Auth::user()->account_id, + 'email' => 'required|email', ]; $messages = [ - 'ticket_id.exists' => 'The ticket you have selected does not exist', - 'ticket_id.required' => 'The ticket field is required. ' + 'ticket_id.exists' => 'The ticket you have selected does not exist', + 'ticket_id.required' => 'The ticket field is required. ', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $attendee = Attendee::scope()->findOrFail($attendee_id); @@ -397,28 +379,30 @@ class EventAttendeesController extends MyBaseController { $attendee->ticket_id = Input::get('ticket_id'); $attendee->save(); - return Response::json(array( - 'status' => 'success', - 'id' => $attendee->id, - 'message' => 'Refreshing...', - 'redirectUrl' => '' - )); + return Response::json([ + 'status' => 'success', + 'id' => $attendee->id, + 'message' => 'Refreshing...', + 'redirectUrl' => '', + ]); } - public function showCancelAttendee($event_id, $attendee_id) { + public function showCancelAttendee($event_id, $attendee_id) + { $attendee = Attendee::scope()->findOrFail($attendee_id); $data = [ 'attendee' => $attendee, - 'event' => $attendee->event, - 'tickets' => $attendee->event->tickets->lists('title', 'id'), + 'event' => $attendee->event, + 'tickets' => $attendee->event->tickets->lists('title', 'id'), 'modal_id' => Input::get('modal_id'), ]; return View::make('ManageEvent.Modals.CancelAttendee', $data); } - public function postCancelAttendee($event_id, $attendee_id) { + public function postCancelAttendee($event_id, $attendee_id) + { $attendee = Attendee::scope()->findOrFail($attendee_id); $attendee->ticket->decrement('quantity_sold'); @@ -426,12 +410,12 @@ class EventAttendeesController extends MyBaseController { $attendee->save(); $data = [ - 'attendee' => $attendee, - 'email_logo' => $attendee->organiser->full_logo_path + 'attendee' => $attendee, + 'email_logo' => $attendee->organiser->full_logo_path, ]; - + if (Input::get('notify_attendee') == '1') { - Mail::send('Emails.notifyCancelledAttendee', $data, function($message) use ($attendee) { + Mail::send('Emails.notifyCancelledAttendee', $data, function ($message) use ($attendee) { $message->to($attendee->email, $attendee->full_name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->replyTo($attendee->event->organiser->email, $attendee->event->organiser->name) @@ -441,12 +425,11 @@ class EventAttendeesController extends MyBaseController { \Session::flash('message', 'Successfully Cancelled Attenddee'); - return Response::json(array( - 'status' => 'success', - 'id' => $attendee->id, - 'message' => 'Refreshing...', - 'redirectUrl' => '' - )); + return Response::json([ + 'status' => 'success', + 'id' => $attendee->id, + 'message' => 'Refreshing...', + 'redirectUrl' => '', + ]); } - } diff --git a/app/Http/Controllers/EventCheckInController.php b/app/Http/Controllers/EventCheckInController.php index 848b2cc4..764c7b34 100644 --- a/app/Http/Controllers/EventCheckInController.php +++ b/app/Http/Controllers/EventCheckInController.php @@ -1,40 +1,45 @@ -findOrFail($event_id); $data['attendees'] = $data['event']->attendees; + return View::make('ManageEvent.CheckIn', $data); } - public function postCheckInSearch($event_id) { - + public function postCheckInSearch($event_id) + { $searchQuery = Input::get('q'); $attendees = Attendee::scope()->withoutCancelled() ->join('tickets', 'tickets.id', '=', 'attendees.ticket_id') - ->where(function($query) use ($event_id) { + ->where(function ($query) use ($event_id) { $query->where('attendees.event_id', '=', $event_id); - })->where(function($query) use ($searchQuery) { - $query->orWhere('attendees.first_name', 'like', $searchQuery . '%') - ->orWhere(DB::raw("CONCAT_WS(' ', first_name, last_name)"), 'like', $searchQuery . '%') + })->where(function ($query) use ($searchQuery) { + $query->orWhere('attendees.first_name', 'like', $searchQuery.'%') + ->orWhere(DB::raw("CONCAT_WS(' ', first_name, last_name)"), 'like', $searchQuery.'%') //->orWhere('attendees.email', 'like', $searchQuery . '%') - ->orWhere('attendees.reference', 'like', $searchQuery . '%') - ->orWhere('attendees.last_name', 'like', $searchQuery . '%'); + ->orWhere('attendees.reference', 'like', $searchQuery.'%') + ->orWhere('attendees.last_name', 'like', $searchQuery.'%'); }) ->select([ 'attendees.id', @@ -44,7 +49,7 @@ class EventCheckInController extends MyBaseController { 'attendees.reference', 'attendees.arrival_time', 'attendees.has_arrived', - 'tickets.title as ticket' + 'tickets.title as ticket', ]) ->orderBy('attendees.first_name', 'ASC') ->get(); @@ -52,10 +57,10 @@ class EventCheckInController extends MyBaseController { return Response::json($attendees); } - public function postCheckInAttendee() { - + public function postCheckInAttendee() + { $attendee_id = Input::get('attendee_id'); - $checking = Input::get('checking'); + $checking = Input::get('checking'); $attendee = Attendee::scope()->find($attendee_id); @@ -64,10 +69,10 @@ class EventCheckInController extends MyBaseController { */ if ((($checking == 'in') && ($attendee->has_arrived == 1)) || (($checking == 'out') && ($attendee->has_arrived == 0))) { return Response::json([ - 'status' => 'error', - 'message' => 'Warning: This Attendee Has Already Been Checked ' . (($checking == 'in') ? 'In (at '.$attendee->arrival_time->format('H:i A, F j').')' : 'Out').'!', + 'status' => 'error', + 'message' => 'Warning: This Attendee Has Already Been Checked '.(($checking == 'in') ? 'In (at '.$attendee->arrival_time->format('H:i A, F j').')' : 'Out').'!', 'checked' => $checking, - 'id' => $attendee->id + 'id' => $attendee->id, ]); } @@ -76,11 +81,10 @@ class EventCheckInController extends MyBaseController { $attendee->save(); return Response::json([ - 'status' => 'success', + 'status' => 'success', 'checked' => $checking, - 'message' => 'Attendee Successfully Checked ' . (($checking == 'in') ? 'In' : 'Out'), - 'id' => $attendee->id + 'message' => 'Attendee Successfully Checked '.(($checking == 'in') ? 'In' : 'Out'), + 'id' => $attendee->id, ]); } - } diff --git a/app/Http/Controllers/EventCheckoutController.php b/app/Http/Controllers/EventCheckoutController.php index 90693d4e..9d16fce9 100644 --- a/app/Http/Controllers/EventCheckoutController.php +++ b/app/Http/Controllers/EventCheckoutController.php @@ -1,37 +1,36 @@ -delete(); /* - * Go though the selected tickets and check if they're available + * Go though the selected tickets and check if they're available * , tot up the price and reserve them to prevent over selling. */ @@ -73,9 +72,7 @@ class EventCheckoutController extends Controller $quantity_available_validation_rules = []; foreach ($ticket_ids as $ticket_id) { - - $current_ticket_quantity = (int)Input::get('ticket_' . $ticket_id); - + $current_ticket_quantity = (int) Input::get('ticket_'.$ticket_id); if ($current_ticket_quantity < 1) { continue; @@ -92,21 +89,19 @@ class EventCheckoutController extends Controller */ $max_per_person = min($ticket_quantity_remaining, $ticket->max_per_person); - $quantity_available_validation_rules['ticket_' . $ticket_id] = ['numeric', 'min:' . $ticket->min_per_person, 'max:' . $max_per_person]; - + $quantity_available_validation_rules['ticket_'.$ticket_id] = ['numeric', 'min:'.$ticket->min_per_person, 'max:'.$max_per_person]; $quantity_available_validation_messages = [ - 'ticket_' . $ticket_id . '.max' => 'The maximum number of tickets you can register is ' . $ticket_quantity_remaining, - 'ticket_' . $ticket_id . '.min' => 'You must select at least ' . $ticket->min_per_person . ' tickets.' + 'ticket_'.$ticket_id.'.max' => 'The maximum number of tickets you can register is '.$ticket_quantity_remaining, + 'ticket_'.$ticket_id.'.min' => 'You must select at least '.$ticket->min_per_person.' tickets.', ]; - - $validator = Validator::make(['ticket_' . $ticket_id => (int)Input::get('ticket_' . $ticket_id)], $quantity_available_validation_rules, $quantity_available_validation_messages); + $validator = Validator::make(['ticket_'.$ticket_id => (int) Input::get('ticket_'.$ticket_id)], $quantity_available_validation_rules, $quantity_available_validation_messages); if ($validator->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validator->messages()->toArray() + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), ]); } @@ -115,18 +110,18 @@ class EventCheckoutController extends Controller $organiser_booking_fee = $organiser_booking_fee + ($current_ticket_quantity * $ticket->organiser_booking_fee); $tickets[] = [ - 'ticket' => $ticket, - 'qty' => $current_ticket_quantity, - 'price' => ($current_ticket_quantity * $ticket->price), - 'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee), + 'ticket' => $ticket, + 'qty' => $current_ticket_quantity, + 'price' => ($current_ticket_quantity * $ticket->price), + 'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee), 'organiser_booking_fee' => ($current_ticket_quantity * $ticket->organiser_booking_fee), - 'full_price' => $ticket->price + $ticket->total_booking_fee + 'full_price' => $ticket->price + $ticket->total_booking_fee, ]; /* * Reserve the tickets in the DB */ - $reservedTickets = new ReservedTickets; + $reservedTickets = new ReservedTickets(); $reservedTickets->ticket_id = $ticket_id; $reservedTickets->event_id = $event_id; $reservedTickets->quantity_reserved = $current_ticket_quantity; @@ -139,68 +134,67 @@ class EventCheckoutController extends Controller /* * Create our validation rules here */ - $validation_rules['ticket_holder_first_name.' . $i . '.' . $ticket_id] = ['required']; - $validation_rules['ticket_holder_last_name.' . $i . '.' . $ticket_id] = ['required']; - $validation_rules['ticket_holder_email.' . $i . '.' . $ticket_id] = ['required', 'email']; + $validation_rules['ticket_holder_first_name.'.$i.'.'.$ticket_id] = ['required']; + $validation_rules['ticket_holder_last_name.'.$i.'.'.$ticket_id] = ['required']; + $validation_rules['ticket_holder_email.'.$i.'.'.$ticket_id] = ['required', 'email']; - $validation_messages['ticket_holder_first_name.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s first name is required'; - $validation_messages['ticket_holder_last_name.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s last name is required'; - $validation_messages['ticket_holder_email.' . $i . '.' . $ticket_id . '.required'] = 'Ticket holder ' . ($i + 1) . '\'s email is required'; - $validation_messages['ticket_holder_email.' . $i . '.' . $ticket_id . '.email'] = 'Ticket holder ' . ($i + 1) . '\'s email appears to be invalid'; + $validation_messages['ticket_holder_first_name.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s first name is required'; + $validation_messages['ticket_holder_last_name.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s last name is required'; + $validation_messages['ticket_holder_email.'.$i.'.'.$ticket_id.'.required'] = 'Ticket holder '.($i + 1).'\'s email is required'; + $validation_messages['ticket_holder_email.'.$i.'.'.$ticket_id.'.email'] = 'Ticket holder '.($i + 1).'\'s email appears to be invalid'; } } } if (empty($tickets)) { - return Response::json(array( - 'status' => 'error', - 'message' => 'No tickets selected.' - )); + return Response::json([ + 'status' => 'error', + 'message' => 'No tickets selected.', + ]); } /* * @todo - Store this in something other than a session? */ - Session::set('ticket_order_' . $event->id, [ - 'validation_rules' => $validation_rules, - 'validation_messages' => $validation_messages, - 'event_id' => $event->id, - 'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */ - 'total_ticket_quantity' => $total_ticket_quantity, - 'order_started' => time(), - 'expires' => $order_expires_time, - 'reserved_tickets_id' => $reservedTickets->id, - 'order_total' => $order_total, - 'booking_fee' => $booking_fee, - 'organiser_booking_fee' => $organiser_booking_fee, - 'total_booking_fee' => $booking_fee + $organiser_booking_fee, - 'order_requires_payment' => (ceil($order_total) == 0) ? FALSE : TRUE, - 'account_id' => $event->account->id, - 'affiliate_referral' => Cookie::get('affiliate_' . $event_id) + Session::set('ticket_order_'.$event->id, [ + 'validation_rules' => $validation_rules, + 'validation_messages' => $validation_messages, + 'event_id' => $event->id, + 'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */ + 'total_ticket_quantity' => $total_ticket_quantity, + 'order_started' => time(), + 'expires' => $order_expires_time, + 'reserved_tickets_id' => $reservedTickets->id, + 'order_total' => $order_total, + 'booking_fee' => $booking_fee, + 'organiser_booking_fee' => $organiser_booking_fee, + 'total_booking_fee' => $booking_fee + $organiser_booking_fee, + 'order_requires_payment' => (ceil($order_total) == 0) ? false : true, + 'account_id' => $event->account->id, + 'affiliate_referral' => Cookie::get('affiliate_'.$event_id), ]); if (Request::ajax()) { - return Response::json(array( - 'status' => 'success', + return Response::json([ + 'status' => 'success', 'redirectUrl' => route('showEventCheckout', [ - 'event_id' => $event_id, - 'is_embedded' => $this->is_embedded - ]) . '#order_form' - )); + 'event_id' => $event_id, + 'is_embedded' => $this->is_embedded, + ]).'#order_form', + ]); } /* * TODO: We should just show an enable JS message here instead */ return Redirect::to(route('showEventCheckout', [ - 'event_id' => $event_id - ]) . '#order_form'); + 'event_id' => $event_id, + ]).'#order_form'); } public function showEventCheckout($event_id) { - - $order_session = Session::get('ticket_order_' . $event_id); + $order_session = Session::get('ticket_order_'.$event_id); if (!$order_session || $order_session['expires'] < Carbon::now()) { return Redirect::route('showEventPage', ['event_id' => $event_id]); @@ -210,82 +204,79 @@ class EventCheckoutController extends Controller //dd($secondsToExpire); $data = $order_session + [ - 'event' => Event::findorFail($order_session['event_id']), + 'event' => Event::findorFail($order_session['event_id']), 'secondsToExpire' => $secondsToExpire, - 'is_embedded' => $this->is_embedded + 'is_embedded' => $this->is_embedded, ]; if ($this->is_embedded) { return View::make('Public.ViewEvent.Embedded.EventPageCheckout', $data); } + return View::make('Public.ViewEvent.EventPageCheckout', $data); } public function postCreateOrder($event_id) { - - $mirror_buyer_info = (Input::get('mirror_buyer_info') == 'on') ? TRUE : FALSE; + $mirror_buyer_info = (Input::get('mirror_buyer_info') == 'on') ? true : false; $event = Event::findOrFail($event_id); - $order = new Order; + $order = new Order(); - $ticket_order = Session::get('ticket_order_' . $event_id); + $ticket_order = Session::get('ticket_order_'.$event_id); $attendee_increment = 1; $validation_rules = $ticket_order['validation_rules']; $validation_messages = $ticket_order['validation_messages']; - if (!$mirror_buyer_info && $event->ask_for_all_attendees_info) { $order->rules = $order->rules + $validation_rules; $order->messages = $order->messages + $validation_messages; } if (!$order->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $order->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $order->errors(), + ]); } - /** + /* * Begin payment attempt before creating the attendees etc. * */ if ($ticket_order['order_requires_payment']) { - try { - - $stripe_error = FALSE; + $stripe_error = false; Stripe::setApiKey($event->account->stripe_api_key); $token = Input::get('stripeToken'); - $customer = Stripe_Customer::create(array( - 'email' => Input::get('order_email'), - 'card' => $token, - 'description' => 'Customer: ' . Input::get('order_email') - )); + $customer = Stripe_Customer::create([ + 'email' => Input::get('order_email'), + 'card' => $token, + 'description' => 'Customer: '.Input::get('order_email'), + ]); if (Utils::isAttendize()) { - $charge = Stripe_Charge::create(array( - 'customer' => $customer->id, - 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, - 'currency' => $event->currency->code, - 'description' => Input::get('order_email'), + $charge = Stripe_Charge::create([ + 'customer' => $customer->id, + 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, + 'currency' => $event->currency->code, + 'description' => Input::get('order_email'), 'application_fee' => $ticket_order['booking_fee'] * 100, - 'description' => 'Order for customer: ' . Input::get('order_email') - )); + 'description' => 'Order for customer: '.Input::get('order_email'), + ]); } else { - $charge = Stripe_Charge::create(array( - 'customer' => $customer->id, - 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, - 'currency' => $event->currency->code, + $charge = Stripe_Charge::create([ + 'customer' => $customer->id, + 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, + 'currency' => $event->currency->code, 'description' => Input::get('order_email'), - 'description' => 'Order for customer: ' . Input::get('order_email') - )); + 'description' => 'Order for customer: '.Input::get('order_email'), + ]); } $order->transaction_id = $charge->id; @@ -313,10 +304,10 @@ class EventCheckoutController extends Controller } if ($stripe_error) { - return Response::json(array( - 'status' => 'error', - 'message' => $stripe_error - )); + return Response::json([ + 'status' => 'error', + 'message' => $stripe_error, + ]); } } @@ -351,11 +342,11 @@ class EventCheckoutController extends Controller } /* - * Update the event stats + * Update the event stats */ $event_stats = EventStats::firstOrNew([ 'event_id' => $event_id, - 'date' => DB::raw('CURDATE()') + 'date' => DB::raw('CURDATE()'), ]); $event_stats->increment('tickets_sold', $ticket_order['total_ticket_quantity']); @@ -384,7 +375,7 @@ class EventCheckoutController extends Controller /* * Insert order items (for use in generating invoices) */ - $orderItem = new OrderItem; + $orderItem = new OrderItem(); $orderItem->title = $attendee_details['ticket']['title']; $orderItem->quantity = $attendee_details['qty']; $orderItem->order_id = $order->id; @@ -396,7 +387,7 @@ class EventCheckoutController extends Controller * Create the attendees */ for ($i = 0; $i < $attendee_details['qty']; $i++) { - $attendee = new Attendee; + $attendee = new Attendee(); $attendee->first_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->first_name : Input::get("ticket_holder_first_name.$i.{$attendee_details['ticket']['id']}")) : $order->first_name; $attendee->last_name = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->last_name : Input::get("ticket_holder_last_name.$i.{$attendee_details['ticket']['id']}")) : $order->last_name; $attendee->email = $event->ask_for_all_attendees_info ? ($mirror_buyer_info ? $order->email : Input::get("ticket_holder_email.$i.{$attendee_details['ticket']['id']}")) : $order->email; @@ -404,14 +395,13 @@ class EventCheckoutController extends Controller $attendee->order_id = $order->id; $attendee->ticket_id = $attendee_details['ticket']['id']; $attendee->account_id = $event->account->id; - $attendee->reference = $order->order_reference . '-' . ($attendee_increment); + $attendee->reference = $order->order_reference.'-'.($attendee_increment); $attendee->save(); /* * Queue an email to send to each attendee */ - /* Keep track of total number of attendees */ $attendee_increment++; } @@ -428,32 +418,32 @@ class EventCheckoutController extends Controller ReservedTickets::where('session_id', '=', Session::getId())->delete(); /* - * Kill the session + * Kill the session */ - Session::forget('ticket_order_' . $event->id); + Session::forget('ticket_order_'.$event->id); /* * Queue the PDF creation jobs */ - return Response::json(array( - 'status' => 'success', + return Response::json([ + 'status' => 'success', 'redirectUrl' => route('showOrderDetails', [ - 'is_embedded' => $this->is_embedded, - 'order_reference' => $order->order_reference - ]) - )); + 'is_embedded' => $this->is_embedded, + 'order_reference' => $order->order_reference, + ]), + ]); } /** - * Show the order details page + * Show the order details page. * * @param string $order_reference + * * @return view */ public function showOrderDetails($order_reference) { - $order = Order::where('order_reference', '=', $order_reference)->first(); if (!$order) { @@ -461,26 +451,26 @@ class EventCheckoutController extends Controller } $data = [ - 'order' => $order, - 'event' => $order->event, - 'tickets' => $order->event->tickets, - 'is_embedded' => $this->is_embedded + 'order' => $order, + 'event' => $order->event, + 'tickets' => $order->event->tickets, + 'is_embedded' => $this->is_embedded, ]; if ($this->is_embedded) { return View::make('Public.ViewEvent.Embedded.EventPageViewOrder', $data); } + return View::make('Public.ViewEvent.EventPageViewOrder', $data); } /** - * Output order tickets + * Output order tickets. * * @param string $order_reference */ public function showOrderTickets($order_reference) { - $order = Order::where('order_reference', '=', $order_reference)->first(); if (!$order) { @@ -488,10 +478,10 @@ class EventCheckoutController extends Controller } $data = [ - 'order' => $order, - 'event' => $order->event, - 'tickets' => $order->event->tickets, - 'attendees' => $order->attendees + 'order' => $order, + 'event' => $order->event, + 'tickets' => $order->event->tickets, + 'attendees' => $order->attendees, ]; if (Input::get('download') == '1') { @@ -500,5 +490,4 @@ class EventCheckoutController extends Controller return View::make('Public.ViewEvent.Partials.PDFTicket', $data); } - } diff --git a/app/Http/Controllers/EventController.php b/app/Http/Controllers/EventController.php index d66761ba..0e2f52e5 100644 --- a/app/Http/Controllers/EventController.php +++ b/app/Http/Controllers/EventController.php @@ -1,43 +1,45 @@ - Input::get('modal_id'), - 'organisers' => Organiser::scope()->lists('name', 'id'), - 'organiser_id' => Input::get('organiser_id') ? Input::get('organiser_id') : false + 'modal_id' => Input::get('modal_id'), + 'organisers' => Organiser::scope()->lists('name', 'id'), + 'organiser_id' => Input::get('organiser_id') ? Input::get('organiser_id') : false, ]; return View::make('ManageOrganiser.Modals.CreateEvent', $data); } - public function postCreateEvent() { - + public function postCreateEvent() + { $event = Event::createNew(); if (!$event->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $event->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $event->errors(), + ]); } $event->title = Input::get('title'); $event->description = strip_tags(Input::get('description')); - $event->start_date = Input::get('start_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_date')) : NULL; + $event->start_date = Input::get('start_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_date')) : null; /* * Venue location info (Usually autofilled from google maps) @@ -69,32 +71,29 @@ class EventController extends MyBaseController { $event->location_is_manual = 1; } + $event->end_date = Input::get('end_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_date')) : null; - $event->end_date = Input::get('end_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_date')) : NULL; - $event->currency_id = Auth::user()->account->currency_id; //$event->timezone_id = Auth::user()->account->timezone_id; - if (Input::get('organiser_name')) { + $organiser = Organiser::createNew(false, false, true); - $organiser = Organiser::createNew(FALSE, FALSE, TRUE); - - $rules = array( - 'organiser_name' => array('required'), - 'organiser_email' => array('required', 'email'), - ); - $messages = array( - 'organiser_name.required' => 'You must give a name for the event organiser.' - ); + $rules = [ + 'organiser_name' => ['required'], + 'organiser_email' => ['required', 'email'], + ]; + $messages = [ + 'organiser_name.required' => 'You must give a name for the event organiser.', + ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $organiser->name = Input::get('organiser_name'); @@ -106,17 +105,16 @@ class EventController extends MyBaseController { $event->organiser_id = $organiser->id; } elseif (Input::get('organiser_id')) { $event->organiser_id = Input::get('organiser_id'); - } else { /* Somethings gone horribly wrong */} + } else { /* Somethings gone horribly wrong */ + } $event->save(); if (Input::hasFile('event_image')) { + $path = public_path().'/'.config('attendize.event_images_path'); + $filename = 'event_image-'.md5(time().$event->id).'.'.strtolower(Input::file('event_image')->getClientOriginalExtension()); - $path = public_path() . '/' . config('attendize.event_images_path'); - $filename = 'event_image-' . md5(time() . $event->id) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension()); - - $file_full_path = $path . '/' . $filename; - + $file_full_path = $path.'/'.$filename; Input::file('event_image')->move($path, $filename); @@ -128,43 +126,41 @@ class EventController extends MyBaseController { }); $img->save($file_full_path); - + /* Upload to s3 */ \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); - $eventImage = EventImage::createNew(); - $eventImage->image_path = config('attendize.event_images_path') . '/' . $filename; + $eventImage->image_path = config('attendize.event_images_path').'/'.$filename; $eventImage->event_id = $event->id; $eventImage->save(); } - return Response::json(array( - 'status' => 'success', - 'id' => $event->id, - 'redirectUrl' => route('showEventTickets', array( - 'event_id' => $event->id, - 'first_run' => 'yup' - )) - )); + return Response::json([ + 'status' => 'success', + 'id' => $event->id, + 'redirectUrl' => route('showEventTickets', [ + 'event_id' => $event->id, + 'first_run' => 'yup', + ]), + ]); } - public function postEditEvent($event_id) { - + public function postEditEvent($event_id) + { $event = Event::scope()->findOrFail($event_id); if (!$event->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $event->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $event->errors(), + ]); } $event->is_live = Input::get('is_live'); $event->title = Input::get('title'); $event->description = strip_tags(Input::get('description')); - $event->start_date = Input::get('start_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_date')) : NULL; - + $event->start_date = Input::get('start_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_date')) : null; /* * If the google place ID is the same as before then don't update the venue @@ -205,9 +201,7 @@ class EventController extends MyBaseController { } } - - $event->end_date = Input::get('end_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_date')) : NULL; - + $event->end_date = Input::get('end_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_date')) : null; if (Input::get('remove_current_image') == '1') { EventImage::where('event_id', '=', $event->id)->delete(); @@ -216,12 +210,10 @@ class EventController extends MyBaseController { $event->save(); if (Input::hasFile('event_image')) { + $path = public_path().'/'.config('attendize.event_images_path'); + $filename = 'event_image-'.md5(time().$event->id).'.'.strtolower(Input::file('event_image')->getClientOriginalExtension()); - $path = public_path() . '/' . config('attendize.event_images_path'); - $filename = 'event_image-' . md5(time() . $event->id) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension()); - - $file_full_path = $path . '/' . $filename; - + $file_full_path = $path.'/'.$filename; Input::file('event_image')->move($path, $filename); @@ -233,57 +225,51 @@ class EventController extends MyBaseController { }); $img->save($file_full_path); - + \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); EventImage::where('event_id', '=', $event->id)->delete(); $eventImage = EventImage::createNew(); - $eventImage->image_path = config('attendize.event_images_path') . '/' . $filename; + $eventImage->image_path = config('attendize.event_images_path').'/'.$filename; $eventImage->event_id = $event->id; $eventImage->save(); } - return Response::json(array( - 'status' => 'success', - 'id' => $event->id, - 'message' => 'Event Successfully Updated', - 'redirectUrl' => '' - )); + return Response::json([ + 'status' => 'success', + 'id' => $event->id, + 'message' => 'Event Successfully Updated', + 'redirectUrl' => '', + ]); } - public function postUploadEventImage() { - + public function postUploadEventImage() + { if (Input::hasFile('event_image')) { - $the_file = \File::get(Input::file('event_image')->getRealPath()); - $file_name = 'event_details_image-' . md5(microtime()) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension()); - - $relative_path_to_file = config('attendize.event_images_path') . '/' . $file_name; + $file_name = 'event_details_image-'.md5(microtime()).'.'.strtolower(Input::file('event_image')->getClientOriginalExtension()); + + $relative_path_to_file = config('attendize.event_images_path').'/'.$file_name; $full_path_to_file = public_path().'/'.$relative_path_to_file; - + $img = Image::make($the_file); $img->resize(1000, null, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); }); - + $img->save($full_path_to_file); - if(\Storage::put($file_name, $the_file)) { + if (\Storage::put($file_name, $the_file)) { return Response::json([ - 'link' => '/'.$relative_path_to_file + 'link' => '/'.$relative_path_to_file, ]); } - + return Response::json([ - 'error' => 'There was a problem uploading your image.' + 'error' => 'There was a problem uploading your image.', ]); - } - - - } - } diff --git a/app/Http/Controllers/EventCustomizeController.php b/app/Http/Controllers/EventCustomizeController.php index c621cb37..247d16a6 100644 --- a/app/Http/Controllers/EventCustomizeController.php +++ b/app/Http/Controllers/EventCustomizeController.php @@ -1,24 +1,33 @@ -getEventViewData($event_id, [ - 'available_bg_images' => $this->getAvailableBackgroundImages(), + 'available_bg_images' => $this->getAvailableBackgroundImages(), 'available_bg_images_thumbs' => $this->getAvailableBackgroundImagesThumbs(), - 'tab' => $tab + 'tab' => $tab, ]); + return View::make('ManageEvent.Customize', $data); } - public function getAvailableBackgroundImages() { - + public function getAvailableBackgroundImages() + { $images = []; - $files = File::files(public_path() . '/' . config('attendize.event_bg_images')); + $files = File::files(public_path().'/'.config('attendize.event_bg_images')); foreach ($files as $image) { $images[] = str_replace(public_path(), '', $image); @@ -26,12 +35,12 @@ class EventCustomizeController extends MyBaseController { return $images; } - - public function getAvailableBackgroundImagesThumbs() { + public function getAvailableBackgroundImagesThumbs() + { $images = []; - $files = File::files(public_path() . '/' . config('attendize.event_bg_images').'/thumbs'); + $files = File::files(public_path().'/'.config('attendize.event_bg_images').'/thumbs'); foreach ($files as $image) { $images[] = str_replace(public_path(), '', $image); @@ -39,17 +48,18 @@ class EventCustomizeController extends MyBaseController { return $images; } - - public function postEditEventSocial($event_id) { + + public function postEditEventSocial($event_id) + { $event = Event::scope()->findOrFail($event_id); $rules = [ - 'social_share_text' => ['max:3000'], - 'social_show_facebook' => ['boolean'], - 'social_show_twitter' => ['boolean'], - 'social_show_linkedin' => ['boolean'], - 'social_show_email' => ['boolean'], - 'social_show_googleplus' => ['boolean'] + 'social_share_text' => ['max:3000'], + 'social_show_facebook' => ['boolean'], + 'social_show_twitter' => ['boolean'], + 'social_show_linkedin' => ['boolean'], + 'social_show_email' => ['boolean'], + 'social_show_googleplus' => ['boolean'], ]; $messages = [ 'social_share_text.max' => 'Please keep the shate text under 3000 characters.', @@ -58,10 +68,10 @@ class EventCustomizeController extends MyBaseController { $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $event->social_share_text = Input::get('social_share_text'); @@ -73,31 +83,32 @@ class EventCustomizeController extends MyBaseController { $event->save(); return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Social Settings Succesfully Upated', ]); } - - public function postEditEventFees($event_id) { + + public function postEditEventFees($event_id) + { $event = Event::scope()->findOrFail($event_id); $rules = [ 'organiser_fee_percentage' => ['numeric', 'between:0,100'], - 'organiser_fee_fixed' => ['numeric', 'between:0,100'] + 'organiser_fee_fixed' => ['numeric', 'between:0,100'], ]; $messages = [ 'organiser_fee_percentage.numeric' => 'Please enter a value between 0 and 100', - 'organiser_fee_fixed.numeric' => 'Please check the format. It shoud be in the format 0.00.', - 'organiser_fee_fixed.between' => 'Please enter a value between 0 and 100.' + 'organiser_fee_fixed.numeric' => 'Please check the format. It shoud be in the format 0.00.', + 'organiser_fee_fixed.between' => 'Please enter a value between 0 and 100.', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $event->organiser_fee_percentage = Input::get('organiser_fee_percentage'); @@ -105,12 +116,13 @@ class EventCustomizeController extends MyBaseController { $event->save(); return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Order Page Succesfully Upated', ]); } - public function postEditEventOrderPage($event_id) { + public function postEditEventOrderPage($event_id) + { $event = Event::scope()->findOrFail($event_id); // Just plain text so no validation needed (hopefully) @@ -120,10 +132,10 @@ class EventCustomizeController extends MyBaseController { $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $event->pre_order_display_message = trim(Input::get('pre_order_display_message')); @@ -132,33 +144,32 @@ class EventCustomizeController extends MyBaseController { $event->save(); return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Order Page Succesfully Upated', ]); } - - public function postEditEventDesign($event_id) { + public function postEditEventDesign($event_id) + { $event = Event::scope()->findOrFail($event_id); $rules = [ - 'bg_image_path' => ['mimes:jpeg,jpg,png', 'max:4000'] + 'bg_image_path' => ['mimes:jpeg,jpg,png', 'max:4000'], ]; $messages = [ 'bg_image_path.mimes' => 'Please ensure you are uploading an image (JPG, PNG, JPEG)', - 'bg_image_path.max' => 'Pleae ensure the image is not larger than 2.5MB' + 'bg_image_path.max' => 'Pleae ensure the image is not larger than 2.5MB', ]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } - if (Input::get('bg_image_path_custom') && Input::get('bg_type') == 'image') { $event->bg_image_path = Input::get('bg_image_path_custom'); $event->bg_type = 'image'; @@ -173,12 +184,10 @@ class EventCustomizeController extends MyBaseController { * Not in use for now. */ if (Input::hasFile('bg_image_path') && Input::get('bg_type') == 'custom_image') { + $path = public_path().'/'.config('attendize.event_images_path'); + $filename = 'event_bg-'.md5($event->id).'.'.strtolower(Input::file('bg_image_path')->getClientOriginalExtension()); - $path = public_path() . '/' . config('attendize.event_images_path'); - $filename = 'event_bg-'. md5($event->id) . '.' . strtolower(Input::file('bg_image_path')->getClientOriginalExtension()); - - $file_full_path = $path . '/' . $filename; - + $file_full_path = $path.'/'.$filename; Input::file('bg_image_path')->move($path, $filename); @@ -191,8 +200,7 @@ class EventCustomizeController extends MyBaseController { $img->save($file_full_path, 75); - - $event->bg_image_path = config('attendize.event_images_path') . '/' . $filename; + $event->bg_image_path = config('attendize.event_images_path').'/'.$filename; $event->bg_type = 'custom_image'; \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); @@ -201,10 +209,9 @@ class EventCustomizeController extends MyBaseController { $event->save(); return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Event Page Succesfully Upated', - 'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);' + 'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);', ]); } - } diff --git a/app/Http/Controllers/EventDashboardController.php b/app/Http/Controllers/EventDashboardController.php index d11c77af..cc2d3921 100644 --- a/app/Http/Controllers/EventDashboardController.php +++ b/app/Http/Controllers/EventDashboardController.php @@ -1,20 +1,24 @@ -findOrFail($event_id); - $num_days= 20; - - /** + $num_days = 20; + + /* * This is a fairly hackish way to get the data for the dashboard charts. I'm sure someone * with better SQL skill could do it in one simple query. * @@ -25,7 +29,7 @@ class EventDashboardController extends MyBaseController { ->where('date', '>', Carbon::now()->subDays($num_days)->format('Y-m-d')) ->get() ->toArray(); - + $startDate = new DateTime("-$num_days days"); $dateItter = new DatePeriod( $startDate, new DateInterval('P1D'), $num_days @@ -36,7 +40,7 @@ class EventDashboardController extends MyBaseController { /* * I have no idea what I was doing here, but it seems to work; */ - $result = array(); + $result = []; $i = 0; foreach ($dateItter as $date) { $views = 0; @@ -52,23 +56,22 @@ class EventDashboardController extends MyBaseController { $organiser_fees_volume = $item['organiser_fees_volume']; $unique_views = $item['unique_views']; $tickets_sold = $item['tickets_sold']; - } $i++; } - $result[] = array( - "date" => $date->format('Y-m-d'), - "views" => $views, + $result[] = [ + 'date' => $date->format('Y-m-d'), + 'views' => $views, 'unique_views' => $unique_views, 'sales_volume' => $sales_volume + $organiser_fees_volume, - 'tickets_sold' => $tickets_sold - ); + 'tickets_sold' => $tickets_sold, + ]; } $data = [ - 'event' => $event, - 'chartData' => json_encode($result) + 'event' => $event, + 'chartData' => json_encode($result), ]; return View::make('ManageEvent.Dashboard', $data); @@ -76,33 +79,31 @@ class EventDashboardController extends MyBaseController { /** * @param $chartData - * @param bool|FALSE $from_date - * @param bool|FALSE $toDate + * @param bool|false $from_date + * @param bool|false $toDate + * * @return string */ - public function generateChartJson($chartData, $from_date = FALSE, $toDate = FALSE) { - + public function generateChartJson($chartData, $from_date = false, $toDate = false) + { $data = []; $startdate = '2014-10-1'; - $enddate = '2014-11-7'; + $enddate = '2014-11-7'; $timestamp = strtotime($startdate); while ($startdate <= $enddate) { - $startdate = date('Y-m-d', $timestamp); $data[] = [ - 'date' => $startdate, + 'date' => $startdate, 'tickets_sold' => rand(0, 7), - 'views' => rand(0, 5), - 'unique_views' => rand(0, 5) + 'views' => rand(0, 5), + 'unique_views' => rand(0, 5), ]; - $timestamp = strtotime('+1 days', strtotime($startdate)); } return json_encode($data); } - } diff --git a/app/Http/Controllers/EventOrdersController.php b/app/Http/Controllers/EventOrdersController.php index 042c522a..16f8ca86 100644 --- a/app/Http/Controllers/EventOrdersController.php +++ b/app/Http/Controllers/EventOrdersController.php @@ -2,28 +2,25 @@ namespace App\Http\Controllers; -use DB, - Response, - Input, - View, - Exception, - Validator, - Log, - Mail; -use Excel; -use Bugsnag; -use Stripe, - Stripe_Charge; +use App\Models\Attendee; use App\Models\Event; use App\Models\Order; -use App\Models\Attendee; +use DB; +use Excel; +use Exception; +use Input; +use Log; +use Mail; +use Response; +use Stripe; +use Stripe_Charge; +use Validator; +use View; class EventOrdersController extends MyBaseController { - public function showOrders($event_id = '') { - $allowed_sorts = ['first_name', 'email', 'order_reference', 'order_status_id', 'created_at']; $searchQuery = Input::get('q'); @@ -44,10 +41,10 @@ class EventOrdersController extends MyBaseController $orders = $event->orders() ->where(function ($query) use ($searchQuery) { - $query->where('order_reference', 'like', $searchQuery . '%') - ->orWhere('first_name', 'like', $searchQuery . '%') - ->orWhere('email', 'like', $searchQuery . '%') - ->orWhere('last_name', 'like', $searchQuery . '%'); + $query->where('order_reference', 'like', $searchQuery.'%') + ->orWhere('first_name', 'like', $searchQuery.'%') + ->orWhere('email', 'like', $searchQuery.'%') + ->orWhere('last_name', 'like', $searchQuery.'%'); }) ->orderBy($sort_by, $sort_order) ->paginate(); @@ -56,11 +53,11 @@ class EventOrdersController extends MyBaseController } $data = [ - 'orders' => $orders, - 'event' => $event, - 'sort_by' => $sort_by, + 'orders' => $orders, + 'event' => $event, + 'sort_by' => $sort_by, 'sort_order' => $sort_order, - 'q' => $searchQuery ? $searchQuery : '' + 'q' => $searchQuery ? $searchQuery : '', ]; return View::make('ManageEvent.Orders', $data); @@ -68,9 +65,8 @@ class EventOrdersController extends MyBaseController public function manageOrder($order_id) { - $data = [ - 'order' => Order::scope()->find($order_id), + 'order' => Order::scope()->find($order_id), 'modal_id' => Input::get('modal_id'), ]; @@ -82,10 +78,10 @@ class EventOrdersController extends MyBaseController $order = Order::scope()->find($order_id); $data = [ - 'order' => $order, - 'event' => $order->event(), + 'order' => $order, + 'event' => $order->event(), 'attendees' => $order->attendees()->withoutCancelled()->get(), - 'modal_id' => Input::get('modal_id') + 'modal_id' => Input::get('modal_id'), ]; return View::make('ManageEvent.Modals.CancelOrder', $data); @@ -93,13 +89,13 @@ class EventOrdersController extends MyBaseController /** * @param $order_id + * * @return mixed */ public function postCancelOrder($order_id) { - $rules = [ - 'refund_amount' => ['numeric'] + 'refund_amount' => ['numeric'], ]; $messages = [ 'refund_amount.integer' => 'Refund amount must only contain numbers.', @@ -108,22 +104,20 @@ class EventOrdersController extends MyBaseController $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $order = Order::scope()->findOrFail($order_id); - $refund_order = (Input::get('refund_order') === 'on') ? TRUE : FALSE; + $refund_order = (Input::get('refund_order') === 'on') ? true : false; $refund_type = Input::get('refund_type'); $refund_amount = Input::get('refund_amount'); $attendees = Input::get('attendees'); - $error_message = FALSE; - + $error_message = false; if ($refund_order) { - if (!$order->transaction_id) { $error_message = 'Sorry, this order cannot be refunded.'; } @@ -133,20 +127,18 @@ class EventOrdersController extends MyBaseController } elseif ($order->organiser_amount == 0) { $error_message = 'Nothing to refund'; } elseif ($refund_amount > ($order->organiser_amount - $order->amount_refunded)) { - $error_message = 'The maximum amount you can refund is ' . (money($order->organiser_amount - $order->amount_refunded, $order->event->currency->code)); + $error_message = 'The maximum amount you can refund is '.(money($order->organiser_amount - $order->amount_refunded, $order->event->currency->code)); } if (!$error_message) { try { - Stripe::setApiKey($order->account->stripe_api_key); $charge = Stripe_Charge::retrieve($order->transaction_id); - if ($refund_type === 'full') { /* Full refund */ $refund_amount = $order->organiser_amount - $order->amount_refunded; $refund = $charge->refund([ - 'refund_application_fee' => floatval($order->booking_fee) > 0 ? true : false + 'refund_application_fee' => floatval($order->booking_fee) > 0 ? true : false, ]); /* Update the event sales volume*/ @@ -155,14 +147,11 @@ class EventOrdersController extends MyBaseController $order->is_refunded = 1; $order->amount_refunded = $order->organiser_amount; $order->order_status_id = config('attendize.order_refunded'); - - - } else { /* Partial refund */ $refund = $charge->refund([ - 'amount' => $refund_amount * 100, - 'refund_application_fee' => floatval($order->booking_fee) > 0 ? true : false + 'amount' => $refund_amount * 100, + 'refund_application_fee' => floatval($order->booking_fee) > 0 ? true : false, ]); /* Update the event sales volume*/ @@ -179,8 +168,6 @@ class EventOrdersController extends MyBaseController } $order->amount_refunded = round($refund->amount_refunded / 100, 2); $order->save(); - - } catch (\Stripe_InvalidRequestError $e) { Log::error($e); $error_message = 'There has been a problem processing your refund. Please check your information and try again.'; @@ -201,8 +188,8 @@ class EventOrdersController extends MyBaseController if ($error_message) { return Response::json([ - 'status' => 'success', - 'message' => $error_message + 'status' => 'success', + 'message' => $error_message, ]); } } @@ -219,11 +206,11 @@ class EventOrdersController extends MyBaseController } \Session::flash('message', - (!$refund_amount && !$attendees) ? 'Nothing To Do' : "Successfully " . ($refund_order ? " Refunded Order" : " ") . ($attendees && $refund_order ? ' & ' : '') . ($attendees ? "Cancelled Attendee(s)" : "")); + (!$refund_amount && !$attendees) ? 'Nothing To Do' : 'Successfully '.($refund_order ? ' Refunded Order' : ' ').($attendees && $refund_order ? ' & ' : '').($attendees ? 'Cancelled Attendee(s)' : '')); return Response::json([ - 'status' => 'success', - 'redirectUrl' => '' + 'status' => 'success', + 'redirectUrl' => '', ]); } @@ -233,12 +220,11 @@ class EventOrdersController extends MyBaseController */ public function showExportOrders($event_id, $export_as = 'xls') { - $event = Event::scope()->findOrFail($event_id); - Excel::create('orders-as-of-' . date('d-m-Y-g.i.a'), function ($excel) use ($event) { + Excel::create('orders-as-of-'.date('d-m-Y-g.i.a'), function ($excel) use ($event) { - $excel->setTitle('Orders For Event: ' . $event->title); + $excel->setTitle('Orders For Event: '.$event->title); // Chain the setters $excel->setCreator(config('attendize.app_name')) @@ -259,15 +245,15 @@ class EventOrdersController extends MyBaseController \DB::raw("(CASE WHEN orders.is_refunded = 1 THEN 'YES' ELSE 'NO' END) AS `orders.is_refunded`"), \DB::raw("(CASE WHEN orders.is_partially_refunded = 1 THEN 'YES' ELSE 'NO' END) AS `orders.is_partially_refunded`"), 'orders.amount_refunded', - 'orders.created_at' + 'orders.created_at', ])->get(); //DB::raw("(CASE WHEN UNIX_TIMESTAMP(`attendees.arrival_time`) = 0 THEN '---' ELSE 'd' END) AS `attendees.arrival_time`")) $sheet->fromArray($data); - $sheet->row(1, array( - 'First Name', 'Last Name', 'Email', 'Order Reference', 'Amount', 'Fully Refunded', 'Partially Refunded', 'Amount Refunded', 'Order Date' - )); + $sheet->row(1, [ + 'First Name', 'Last Name', 'Email', 'Order Reference', 'Amount', 'Fully Refunded', 'Partially Refunded', 'Amount Refunded', 'Order Date', + ]); // Set gray background on first row $sheet->row(1, function ($row) { @@ -279,12 +265,11 @@ class EventOrdersController extends MyBaseController public function showMessageOrder($order_id) { - $order = Order::scope()->findOrFail($order_id); $data = [ - 'order' => $order, - 'event' => $order->event, + 'order' => $order, + 'event' => $order->event, 'modal_id' => Input::get('modal_id'), ]; @@ -293,29 +278,28 @@ class EventOrdersController extends MyBaseController public function postMessageOrder($order_id) { - $rules = [ 'subject' => 'required|max:250', - 'message' => 'required|max:5000' + 'message' => 'required|max:5000', ]; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $order = Attendee::scope()->findOrFail($order_id); $data = [ - 'order' => $order, + 'order' => $order, 'message_content' => Input::get('message'), - 'subject' => Input::get('subject'), - 'event' => $order->event, - 'email_logo' => $order->event->organiser->full_logo_path + 'subject' => Input::get('subject'), + 'event' => $order->event, + 'email_logo' => $order->event->organiser->full_logo_path, ]; Mail::send('Emails.messageOrder', $data, function ($message) use ($order, $data) { @@ -331,15 +315,13 @@ class EventOrdersController extends MyBaseController $message->to($order->event->organiser->email) ->from(config('attendize.outgoing_email_noreply'), $order->event->organiser->name) ->replyTo($order->event->organiser->email, $order->event->organiser->name) - ->subject($data['subject'] . ' [Organiser copy]'); + ->subject($data['subject'].' [Organiser copy]'); }); } - - return Response::json(array( - 'status' => 'success', - 'message' => 'Message Successfully Sent' - )); + return Response::json([ + 'status' => 'success', + 'message' => 'Message Successfully Sent', + ]); } - } diff --git a/app/Http/Controllers/EventPromoteController.php b/app/Http/Controllers/EventPromoteController.php index 5524c41a..f8ed8736 100644 --- a/app/Http/Controllers/EventPromoteController.php +++ b/app/Http/Controllers/EventPromoteController.php @@ -1,14 +1,15 @@ - Event::scope()->find($event_id) + 'event' => Event::scope()->find($event_id), ]; - + return View::make('ManageEvent.Promote', $data); } - } diff --git a/app/Http/Controllers/EventTicketQuestionsController.php b/app/Http/Controllers/EventTicketQuestionsController.php index 6c1a16d7..d2348a37 100644 --- a/app/Http/Controllers/EventTicketQuestionsController.php +++ b/app/Http/Controllers/EventTicketQuestionsController.php @@ -1,49 +1,43 @@ - Event::scope()->findOrFail($event_id), - 'modal_id' => Input::get('modal_id'), - 'question_types' => QuestionType::all() + 'event' => Event::scope()->findOrFail($event_id), + 'modal_id' => Input::get('modal_id'), + 'question_types' => QuestionType::all(), ]; - + return View::make('ManageEvent.Modals.ViewQuestions', $data); } - - - public function postCreateQuestion($event_id) { - + + public function postCreateQuestion($event_id) + { $event = Event::findOrFail($event_id); - - $question = Question::createNew(FALSE, FALSE, TRUE); + + $question = Question::createNew(false, false, true); $question->title = Input::get('title'); $question->instructions = Input::get('instructions'); $question->options = Input::get('options'); $question->is_required = Input::get('title'); $question->question_type_id = Input::get('question_type_id'); $question->save(); - - - + $ticket_ids = Input::get('tickets'); - - foreach($ticket_ids as $ticket_id) { + + foreach ($ticket_ids as $ticket_id) { Ticket::scope()->find($ticket_id)->questions()->attach($question->id); } - + $event->questions()->attach($question->id); - - + return Response::json([ - 'status' => 'success', - 'message' => 'Successfully Created Question' + 'status' => 'success', + 'message' => 'Successfully Created Question', ]); } - - - } diff --git a/app/Http/Controllers/EventTicketsController.php b/app/Http/Controllers/EventTicketsController.php index b44fcd10..d814fe34 100644 --- a/app/Http/Controllers/EventTicketsController.php +++ b/app/Http/Controllers/EventTicketsController.php @@ -1,76 +1,79 @@ -findOrFail($event_id); - $tickets = $searchQuery - ? $event->tickets()->where('title', 'like', '%' . $searchQuery . '%')->orderBy($sort_by, 'desc')->paginate(10) + $tickets = $searchQuery + ? $event->tickets()->where('title', 'like', '%'.$searchQuery.'%')->orderBy($sort_by, 'desc')->paginate(10) : $event->tickets()->orderBy($sort_by, 'desc')->paginate(10); - $data = [ - 'event' => $event, + 'event' => $event, 'tickets' => $tickets, 'sort_by' => $sort_by, - 'q' => $searchQuery ? $searchQuery : '' + 'q' => $searchQuery ? $searchQuery : '', ]; return View::make('ManageEvent.Tickets', $data); } - public function showEditTicket($event_id, $ticket_id) { - + public function showEditTicket($event_id, $ticket_id) + { $data = [ - 'event' => Event::scope()->find($event_id), - 'ticket' => Ticket::scope()->find($ticket_id), + 'event' => Event::scope()->find($event_id), + 'ticket' => Ticket::scope()->find($ticket_id), 'modal_id' => Input::get('modal_id'), ]; return View::make('ManageEvent.Modals.EditTicket', $data); } - public function showCreateTicket($event_id) { - return View::make('ManageEvent.Modals.CreateTicket', array( + public function showCreateTicket($event_id) + { + return View::make('ManageEvent.Modals.CreateTicket', [ 'modal_id' => Input::get('modal_id'), - 'event' => Event::find($event_id) - )); + 'event' => Event::find($event_id), + ]); } - public function postCreateTicket($event_id) { - + public function postCreateTicket($event_id) + { $ticket = Ticket::createNew(); if (!$ticket->validate(Input::all())) { - - return Response::json(array( - 'status' => 'error', - 'messages' => $ticket->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $ticket->errors(), + ]); } $ticket->event_id = $event_id; $ticket->title = Input::get('title'); - $ticket->quantity_available = !Input::get('quantity_available') ? NULL : Input::get('quantity_available'); - $ticket->start_sale_date = Input::get('start_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_sale_date')) : NULL; - $ticket->end_sale_date = Input::get('end_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_sale_date')) : NULL; + $ticket->quantity_available = !Input::get('quantity_available') ? null : Input::get('quantity_available'); + $ticket->start_sale_date = Input::get('start_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_sale_date')) : null; + $ticket->end_sale_date = Input::get('end_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_sale_date')) : null; $ticket->price = Input::get('price'); $ticket->min_per_person = Input::get('min_per_person'); $ticket->max_per_person = Input::get('max_per_person'); @@ -79,118 +82,114 @@ class EventTicketsController extends MyBaseController { \Session::flash('message', 'Successfully Created Ticket'); - return Response::json(array( - 'status' => 'success', - 'id' => $ticket->id, - 'message' => 'Refreshing...', - 'redirectUrl' => route('showEventTickets', array( - 'event_id' => $event_id - )) - )); + return Response::json([ + 'status' => 'success', + 'id' => $ticket->id, + 'message' => 'Refreshing...', + 'redirectUrl' => route('showEventTickets', [ + 'event_id' => $event_id, + ]), + ]); } - - public function postPauseTicket() { + + public function postPauseTicket() + { $ticket_id = Input::get('ticket_id'); $ticket = Ticket::scope()->find($ticket_id); - + $ticket->is_paused = ($ticket->is_paused == 1) ? 0 : 1; - + if ($ticket->save()) { return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Ticket Successfully Updated', - 'id' => $ticket->id + 'id' => $ticket->id, ]); } Log::error('Ticket Failed to pause/resume', [ - 'ticket' => $ticket + 'ticket' => $ticket, ]); return Response::json([ - 'status' => 'error', - 'id' => $ticket->id, - 'message' => 'Whoops!, looks like something went wrong. Please try again.' + 'status' => 'error', + 'id' => $ticket->id, + 'message' => 'Whoops!, looks like something went wrong. Please try again.', ]); - } - - public function postDeleteTicket() { + public function postDeleteTicket() + { $ticket_id = Input::get('ticket_id'); $ticket = Ticket::scope()->find($ticket_id); if ($ticket->quantity_sold > 0) { return Response::json([ - 'status' => 'error', + 'status' => 'error', 'message' => 'Sorry, you can\'t delete this ticket as some have already been sold', - 'id' => $ticket->id + 'id' => $ticket->id, ]); } if ($ticket->delete()) { return Response::json([ - 'status' => 'success', + 'status' => 'success', 'message' => 'Ticket Successfully Deleted', - 'id' => $ticket->id + 'id' => $ticket->id, ]); } Log::error('Ticket Failed to delete', [ - 'ticket' => $ticket + 'ticket' => $ticket, ]); return Response::json([ - 'status' => 'error', - 'id' => $ticket->id, - 'message' => 'Whoops!, looks like something went wrong. Please try again.' + 'status' => 'error', + 'id' => $ticket->id, + 'message' => 'Whoops!, looks like something went wrong. Please try again.', ]); } - public function postEditTicket($event_id, $ticket_id) { - + public function postEditTicket($event_id, $ticket_id) + { $ticket = Ticket::findOrFail($ticket_id); /* * Override some vaidation rules */ - $validation_rules['quantity_available'] = ['integer','min:'.($ticket->quantity_sold + $ticket->quantity_reserved)]; + $validation_rules['quantity_available'] = ['integer', 'min:'.($ticket->quantity_sold + $ticket->quantity_reserved)]; $validation_messages['quantity_available.min'] = 'Quantity available can\'t be less the amount sold or reserved.'; - + $ticket->rules = $validation_rules + $ticket->rules; $ticket->messages = $validation_messages + $ticket->messages; - - - if (!$ticket->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $ticket->errors() - )); + if (!$ticket->validate(Input::all())) { + return Response::json([ + 'status' => 'error', + 'messages' => $ticket->errors(), + ]); } $ticket->title = Input::get('title'); - $ticket->quantity_available = !Input::get('quantity_available') ? NULL : Input::get('quantity_available'); + $ticket->quantity_available = !Input::get('quantity_available') ? null : Input::get('quantity_available'); $ticket->price = Input::get('price'); - $ticket->start_sale_date = Input::get('start_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_sale_date')) : NULL; - $ticket->end_sale_date = Input::get('end_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_sale_date')) : NULL; + $ticket->start_sale_date = Input::get('start_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_sale_date')) : null; + $ticket->end_sale_date = Input::get('end_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('end_sale_date')) : null; $ticket->description = Input::get('description'); $ticket->min_per_person = Input::get('min_per_person'); $ticket->max_per_person = Input::get('max_per_person'); - $ticket->save(); - return Response::json(array( - 'status' => 'success', - 'id' => $ticket->id, - 'message' => 'Refreshing...', - 'redirectUrl' => route('showEventTickets', array( - 'event_id' => $event_id - )) - )); + return Response::json([ + 'status' => 'success', + 'id' => $ticket->id, + 'message' => 'Refreshing...', + 'redirectUrl' => route('showEventTickets', [ + 'event_id' => $event_id, + ]), + ]); } - } diff --git a/app/Http/Controllers/EventViewController.php b/app/Http/Controllers/EventViewController.php index 2f616066..05f7b49a 100644 --- a/app/Http/Controllers/EventViewController.php +++ b/app/Http/Controllers/EventViewController.php @@ -1,35 +1,38 @@ -is_live) { + if (!Auth::check() && !$event->is_live) { return View::make('Public.ViewEvent.EventNotLivePage'); } $data = [ - 'event' => $event, - 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), - 'is_embedded' => 0 + 'event' => $event, + 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), + 'is_embedded' => 0, ]; /* * Don't record stats if we're previewing the event page from the backend or if we own the event. */ if (!$preview || !Auth::check()) { - - $event_stats = new EventStats; + $event_stats = new EventStats(); $event_stats->updateViewCount($event_id); } @@ -37,13 +40,12 @@ class EventViewController extends Controller * See if there is an affiliate referral in the URL */ if ($affiliate_ref = \Input::get('ref')) { - $affiliate_ref = preg_replace("/\W|_/", '', $affiliate_ref); if ($affiliate_ref) { $affiliate = Affiliate::firstOrNew([ - 'name' => Input::get('ref'), - 'event_id' => $event_id, + 'name' => Input::get('ref'), + 'event_id' => $event_id, 'account_id' => $event->account_id, ]); @@ -51,7 +53,7 @@ class EventViewController extends Controller $affiliate->save(); - Cookie::queue('affiliate_' . $event_id, $affiliate_ref, 60 * 24 * 60); + Cookie::queue('affiliate_'.$event_id, $affiliate_ref, 60 * 24 * 60); } } @@ -60,50 +62,45 @@ class EventViewController extends Controller public function showEventHomePreview($event_id) { - return showEventHome($event_id, TRUE); + return showEventHome($event_id, true); } - public function postContactOrganiser($event_id) { - $rules = [ - 'name' => 'required', - 'email' => ['required', 'email'], - 'message' => ['required'] + 'name' => 'required', + 'email' => ['required', 'email'], + 'message' => ['required'], ]; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - return Response::json(array( - 'status' => 'error', - 'messages' => $validator->messages()->toArray() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $validator->messages()->toArray(), + ]); } $event = Event::findOrFail($event_id); $data = [ - 'sender_name' => Input::get('name'), - 'sender_email' => Input::get('email'), + 'sender_name' => Input::get('name'), + 'sender_email' => Input::get('email'), 'message_content' => strip_tags(Input::get('message')), - 'event' => $event + 'event' => $event, ]; Mail::send('Emails.messageOrganiser', $data, function ($message) use ($event, $data) { $message->to($event->organiser->email, $event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $data['sender_name']) ->replyTo($data['sender_email'], $data['sender_name']) - ->subject('Message Regarding: ' . $event->title); + ->subject('Message Regarding: '.$event->title); }); - return Response::json(array( - 'status' => 'success', - 'message' => 'Message Successfully Sent' - )); - - + return Response::json([ + 'status' => 'success', + 'message' => 'Message Successfully Sent', + ]); } } - diff --git a/app/Http/Controllers/EventViewEmbeddedController.php b/app/Http/Controllers/EventViewEmbeddedController.php index 1ad6146c..e92d5618 100644 --- a/app/Http/Controllers/EventViewEmbeddedController.php +++ b/app/Http/Controllers/EventViewEmbeddedController.php @@ -1,23 +1,22 @@ - $event, - 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), - 'is_embedded' => '1' + 'event' => $event, + 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), + 'is_embedded' => '1', ]; return View::make('Public.ViewEvent.Embedded.EventPage', $data); } - } diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 050a1300..3d4a9b4b 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -1,10 +1,11 @@ -resize(320, 240); @@ -13,5 +14,4 @@ class ImageController extends Controller { $img->save('public/bar.jpg'); } - } diff --git a/app/Http/Controllers/InstallerController.php b/app/Http/Controllers/InstallerController.php index ad320541..312eed1e 100644 --- a/app/Http/Controllers/InstallerController.php +++ b/app/Http/Controllers/InstallerController.php @@ -1,25 +1,23 @@ - 'success', + 'status' => 'success', 'message' => 'Success, Your connection works!', - 'test' => 1 + 'test' => 1, ]); } return Response::json([ - 'status' => 'error', + 'status' => 'error', 'message' => 'Unable to connect! Please check your settings', - 'test' => 1 + 'test' => 1, ]); } - - $config = "APP_ENV=production\n" . - "APP_DEBUG=false\n" . - "APP_URL={$app_url}\n" . - "APP_KEY={$app_key}\n\n" . - "DB_TYPE=mysql\n" . - "DB_HOST={$database['host']}\n" . - "DB_DATABASE={$database['name']}\n" . - "DB_USERNAME={$database['username']}\n" . - "DB_PASSWORD={$database['password']}\n\n" . - "MAIL_DRIVER={$mail['driver']}\n" . - "MAIL_PORT={$mail['port']}\n" . - "MAIL_ENCRYPTION={$mail['encryption']}\n" . - "MAIL_HOST={$mail['host']}\n" . - "MAIL_USERNAME={$mail['username']}\n" . - "MAIL_FROM_NAME={$mail['from_name']}\n" . - "MAIL_FROM_ADDRESS={$mail['from_address']}\n" . + $config = "APP_ENV=production\n". + "APP_DEBUG=false\n". + "APP_URL={$app_url}\n". + "APP_KEY={$app_key}\n\n". + "DB_TYPE=mysql\n". + "DB_HOST={$database['host']}\n". + "DB_DATABASE={$database['name']}\n". + "DB_USERNAME={$database['username']}\n". + "DB_PASSWORD={$database['password']}\n\n". + "MAIL_DRIVER={$mail['driver']}\n". + "MAIL_PORT={$mail['port']}\n". + "MAIL_ENCRYPTION={$mail['encryption']}\n". + "MAIL_HOST={$mail['host']}\n". + "MAIL_USERNAME={$mail['username']}\n". + "MAIL_FROM_NAME={$mail['from_name']}\n". + "MAIL_FROM_ADDRESS={$mail['from_address']}\n". "MAIL_PASSWORD={$mail['password']}\n\n"; - $fp = fopen(base_path()."/.env", 'w'); + $fp = fopen(base_path().'/.env', 'w'); fwrite($fp, $config); fclose($fp); Config::set('database.default', $database['type']); - Config::set("database.connections.mysql.host", $database['host']); - Config::set("database.connections.mysql.database", $database['name']); - Config::set("database.connections.mysql.username", $database['username']); - Config::set("database.connections.mysql.password", $database['password']); + Config::set('database.connections.mysql.host', $database['host']); + Config::set('database.connections.mysql.database', $database['name']); + Config::set('database.connections.mysql.username', $database['username']); + Config::set('database.connections.mysql.password', $database['password']); DB::reconnect(); - Artisan::call('migrate', array('--force' => true)); + Artisan::call('migrate', ['--force' => true]); if (Timezone::count() == 0) { - Artisan::call('db:seed', array('--force' => true)); + Artisan::call('db:seed', ['--force' => true]); } - Artisan::call('optimize', array('--force' => true)); + Artisan::call('optimize', ['--force' => true]); - $fp = fopen(base_path()."/installed", 'w'); + $fp = fopen(base_path().'/installed', 'w'); fwrite($fp, $version); fclose($fp); - return Redirect::route('showSignup',['first_run' => 'yup']); + return Redirect::route('showSignup', ['first_run' => 'yup']); } - private function testDatabase($database) { Config::set('database.default', $database['type']); - Config::set("database.connections.mysql.host", $database['host']); - Config::set("database.connections.mysql.database", $database['name']); - Config::set("database.connections.mysql.username", $database['username']); - Config::set("database.connections.mysql.password", $database['password']); + Config::set('database.connections.mysql.host', $database['host']); + Config::set('database.connections.mysql.database', $database['name']); + Config::set('database.connections.mysql.username', $database['username']); + Config::set('database.connections.mysql.password', $database['password']); try { DB::reconnect(); @@ -144,8 +138,7 @@ class InstallerController extends Controller } catch (Exception $e) { return $e->getMessage(); } + return $success; } - - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/ManageAccountController.php b/app/Http/Controllers/ManageAccountController.php index ef66a1e6..26c79e6a 100644 --- a/app/Http/Controllers/ManageAccountController.php +++ b/app/Http/Controllers/ManageAccountController.php @@ -2,35 +2,34 @@ namespace App\Http\Controllers; -use Input, - Response, - View, - Auth; -use HttpClient; use App\Models\Account; -use App\Models\Timezone; use App\Models\Currency; +use App\Models\Timezone; use App\Models\User; +use Auth; +use HttpClient; +use Input; +use Response; +use View; - -class ManageAccountController extends MyBaseController { - - public function showEditAccount() { - +class ManageAccountController extends MyBaseController +{ + public function showEditAccount() + { $data = [ - 'modal_id' => Input::get('modal_id'), - 'account' => Account::find(Auth::user()->account_id), - 'timezones' => Timezone::lists('location', 'id'), - 'currencies' => Currency::lists('title', 'id') + 'modal_id' => Input::get('modal_id'), + 'account' => Account::find(Auth::user()->account_id), + 'timezones' => Timezone::lists('location', 'id'), + 'currencies' => Currency::lists('title', 'id'), ]; return View::make('ManageAccount.Modals.EditAccount', $data); } - public function showStripeReturn() { + public function showStripeReturn() + { + $error_message = 'There was an error connecting your Stripe account. Please try again.'; - $error_message = "There was an error connecting your Stripe account. Please try again."; - if (Input::get('error') || !Input::get('code')) { //BugSnag::notifyError('Error Connecting to Stripe', Input::get('error')); \Session::flash('message', $error_message); @@ -39,26 +38,26 @@ class ManageAccountController extends MyBaseController { } $request = [ - 'url' => 'https://connect.stripe.com/oauth/token', + 'url' => 'https://connect.stripe.com/oauth/token', 'params' => [ 'client_secret' => STRIPE_SECRET_KEY, //sk_test_iXk2Ky0DlhIcTcKMvsDa8iKI', - 'code' => Input::get('code'), - 'grant_type' => 'authorization_code' - ] + 'code' => Input::get('code'), + 'grant_type' => 'authorization_code', + ], ]; $response = HttpClient::post($request); $content = $response->json(); - - if(isset($content->error) || !isset($content->access_token)) { + + if (isset($content->error) || !isset($content->access_token)) { //BugSnag::notifyError('Error Connecting to Stripe', Input::get('error')); \Session::flash('message', $error_message); return redirect()->route('showEventsDashboard'); } - + $account = Account::find(\Auth::user()->account_id); $account->stripe_access_token = $content->access_token; $account->stripe_refresh_token = $content->refresh_token; @@ -66,19 +65,20 @@ class ManageAccountController extends MyBaseController { $account->stripe_data_raw = json_encode($content); $account->save(); - \Session::flash('message', "You have successfully connected your Stripe account."); + \Session::flash('message', 'You have successfully connected your Stripe account.'); + return redirect()->route('showEventsDashboard'); } - public function postEditAccount() { + public function postEditAccount() + { $account = Account::find(Auth::user()->account_id); if (!$account->validate(Input::all())) { - - return Response::json(array( - 'status' => 'error', - 'messages' => $account->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $account->errors(), + ]); } $account->first_name = Input::get('first_name'); @@ -88,14 +88,15 @@ class ManageAccountController extends MyBaseController { $account->currency_id = Input::get('currency_id'); $account->save(); - return Response::json(array( - 'status' => 'success', - 'id' => $account->id, - 'message' => 'Account Successfully Updated' - )); + return Response::json([ + 'status' => 'success', + 'id' => $account->id, + 'message' => 'Account Successfully Updated', + ]); } - public function postEditAccountPayment() { + public function postEditAccountPayment() + { $account = Account::find(Auth::user()->account_id); $account->stripe_publishable_key = Input::get('stripe_publishable_key'); @@ -103,58 +104,56 @@ class ManageAccountController extends MyBaseController { $account->save(); - return Response::json(array( - 'status' => 'success', - 'id' => $account->id, - 'message' => 'Payment Information Successfully Updated' - )); - + return Response::json([ + 'status' => 'success', + 'id' => $account->id, + 'message' => 'Payment Information Successfully Updated', + ]); } - public function postInviteUser() { - $rules = array( - 'email' => array('required', 'email', 'unique:users,email,NULL,id,account_id,'.Auth::user()->account_id), - ); - - $messages = array( - 'email.email' => 'Please enter a valid E-mail address.', - 'email.required' => 'E-mail address is required.', - 'email.unique' => 'E-mail already in use for this account.', - ); - - $validation = \Validator::make(Input::all(), $rules, $messages); - - if ($validation->fails()) { - return \Response::json([ - 'status' => 'error', - 'messages'=> $validation->messages()->toArray() - ]); - } - + public function postInviteUser() + { + $rules = [ + 'email' => ['required', 'email', 'unique:users,email,NULL,id,account_id,'.Auth::user()->account_id], + ]; + + $messages = [ + 'email.email' => 'Please enter a valid E-mail address.', + 'email.required' => 'E-mail address is required.', + 'email.unique' => 'E-mail already in use for this account.', + ]; + + $validation = \Validator::make(Input::all(), $rules, $messages); + + if ($validation->fails()) { + return \Response::json([ + 'status' => 'error', + 'messages' => $validation->messages()->toArray(), + ]); + } + $temp_password = str_random(8); - - $user = new User; + + $user = new User(); $user->email = Input::get('email'); $user->password = \Hash::make($temp_password); $user->account_id = Auth::user()->account_id; $user->save(); - + $data = [ - 'user' => $user, + 'user' => $user, 'temp_password' => $temp_password, - 'inviter' => Auth::user() + 'inviter' => Auth::user(), ]; - - \Mail::send('Emails.inviteUser', $data, function($message) use ($data) { + + \Mail::send('Emails.inviteUser', $data, function ($message) use ($data) { $message->to($data['user']->email) ->subject($data['inviter']->first_name.' '.$data['inviter']->last_name.' added you to an Attendize Ticketing account.'); }); - + return Response::json([ - 'status' => 'success', - 'message'=> 'Success! '.$user->email.' has been sent further instructions.' + 'status' => 'success', + 'message' => 'Success! '.$user->email.' has been sent further instructions.', ]); - } - } diff --git a/app/Http/Controllers/MyBaseController.php b/app/Http/Controllers/MyBaseController.php index 86062f08..6ec2847f 100644 --- a/app/Http/Controllers/MyBaseController.php +++ b/app/Http/Controllers/MyBaseController.php @@ -1,14 +1,14 @@ -get()); @@ -19,7 +19,8 @@ class MyBaseController extends Controller { * * @return void */ - protected function setupLayout() { + protected function setupLayout() + { if (!is_null($this->layout)) { $this->layout = View::make($this->layout); } @@ -27,16 +28,16 @@ class MyBaseController extends Controller { /** * Returns data which is required in each view, optionally combined with additional data. - * - * @param int $event_id + * + * @param int $event_id * @param array $additional_data + * * @return arrau */ - public function getEventViewData($event_id, $additional_data = array()) { - return array_merge(array( - 'event' => Event::scope()->findOrFail($event_id) - ) - , $additional_data); + public function getEventViewData($event_id, $additional_data = []) + { + return array_merge([ + 'event' => Event::scope()->findOrFail($event_id), + ], $additional_data); } - } diff --git a/app/Http/Controllers/OrganiserController.php b/app/Http/Controllers/OrganiserController.php index 24e0bd9d..06844272 100644 --- a/app/Http/Controllers/OrganiserController.php +++ b/app/Http/Controllers/OrganiserController.php @@ -2,80 +2,77 @@ namespace App\Http\Controllers; -use App\Http\Controllers\Controller; -use Illuminate\Support\Facades\Session; -use Response, - Input, - Image, - View; - use App\Models\Event; use App\Models\Organiser; +use Image; +use Input; +use Response; +use View; -class OrganiserController extends MyBaseController { - - public function showSelectOragniser() { +class OrganiserController extends MyBaseController +{ + public function showSelectOragniser() + { return View::make('ManageOrganiser.SelectOrganiser'); } - public function showOrganiserDashboard($organiser_id = FALSE) { - - $allowed_sorts = ['created_at', 'start_date', 'end_date', 'title']; + public function showOrganiserDashboard($organiser_id = false) + { + $allowed_sorts = ['created_at', 'start_date', 'end_date', 'title']; $searchQuery = Input::get('q'); //$sort_order = Input::get('sort_order') == 'asc' ? 'asc' : 'desc'; $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'start_date'); - - $events = $searchQuery - ? Event::scope()->where('title', 'like', '%' . $searchQuery . '%')->orderBy($sort_by, 'desc')->where('organiser_id', '=', $organiser_id)->paginate(12) + + $events = $searchQuery + ? Event::scope()->where('title', 'like', '%'.$searchQuery.'%')->orderBy($sort_by, 'desc')->where('organiser_id', '=', $organiser_id)->paginate(12) : Event::scope()->where('organiser_id', '=', $organiser_id)->orderBy($sort_by, 'desc')->paginate(12); - $data = [ - 'events' => $events, - 'organisers' => Organiser::scope()->orderBy('name')->get(), + 'events' => $events, + 'organisers' => Organiser::scope()->orderBy('name')->get(), 'current_organiser' => Organiser::scope()->find($organiser_id), - 'q' => $searchQuery ? $searchQuery : '', //Redundant - 'search' => [ - 'q' => $searchQuery ? $searchQuery : '', - 'sort_by' => $sort_by, - 'showPast' => Input::get('past') - ] + 'q' => $searchQuery ? $searchQuery : '', //Redundant + 'search' => [ + 'q' => $searchQuery ? $searchQuery : '', + 'sort_by' => $sort_by, + 'showPast' => Input::get('past'), + ], ]; return View::make('ManageEvents.OrganiserDashboard', $data); } - - public function showEditOrganiser($organiser_id) { - + public function showEditOrganiser($organiser_id) + { $organiser = Organiser::scope()->findOrfail($organiser_id); return View::make('ManageEvents.Modals.EditOrganiser', [ - 'modal_id' => Input::get('modal_id'), - 'organiser' => $organiser + 'modal_id' => Input::get('modal_id'), + 'organiser' => $organiser, ]); } - public function showCreateOrganiser() { - + public function showCreateOrganiser() + { return View::make('ManageOrganiser.CreateOrganiser', [ - 'modal_id' => 'createOrganiser' + 'modal_id' => 'createOrganiser', ]); return View::make('ManageEvents.Modals.CreateOrganiser', [ - 'modal_id' => Input::get('modal_id') + 'modal_id' => Input::get('modal_id'), ]); } - public function postCreateOrganiser() { - $organiser = Organiser::createNew(FALSE, FALSE, TRUE); + public function postCreateOrganiser() + { + $organiser = Organiser::createNew(false, false, true); if (!$organiser->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $organiser->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $organiser->errors(), + ]); } $organiser->name = Input::get('name'); @@ -83,14 +80,13 @@ class OrganiserController extends MyBaseController { $organiser->email = Input::get('email'); $organiser->facebook = Input::get('facebook'); $organiser->twitter = Input::get('twitter'); - $organiser->confirmation_key = md5(time().rand(0,999999)); + $organiser->confirmation_key = md5(time().rand(0, 999999)); if (Input::hasFile('organiser_logo')) { + $path = public_path().'/'.config('attendize.organiser_images_path'); + $filename = 'organiser_logo-'.$organiser->id.'.'.strtolower(Input::file('organiser_logo')->getClientOriginalExtension()); - $path = public_path() . '/' . config('attendize.organiser_images_path'); - $filename = 'organiser_logo-' . $organiser->id . '.' . strtolower(Input::file('organiser_logo')->getClientOriginalExtension()); - - $file_full_path = $path . '/' . $filename; + $file_full_path = $path.'/'.$filename; Input::file('organiser_logo')->move($path, $filename); @@ -102,26 +98,21 @@ class OrganiserController extends MyBaseController { }); $img->save($file_full_path); - - if(file_exists($file_full_path)) { - $organiser->logo_path = config('attendize.organiser_images_path') . '/' . $filename; + + if (file_exists($file_full_path)) { + $organiser->logo_path = config('attendize.organiser_images_path').'/'.$filename; } - } $organiser->save(); \Session::flash('message', 'Successfully Created Organiser'); - - return Response::json(array( - 'status' => 'success', - 'message' => 'Refreshing..', + + return Response::json([ + 'status' => 'success', + 'message' => 'Refreshing..', 'redirectUrl' => route('showOrganiserDashboard', [ - 'organiser_id' => $organiser->id - ]) - )); + 'organiser_id' => $organiser->id, + ]), + ]); } - - - - } diff --git a/app/Http/Controllers/OrganiserCustomizeController.php b/app/Http/Controllers/OrganiserCustomizeController.php index 6e8b6a36..904307ef 100644 --- a/app/Http/Controllers/OrganiserCustomizeController.php +++ b/app/Http/Controllers/OrganiserCustomizeController.php @@ -1,35 +1,35 @@ - Organiser::scope()->findOrFail($organiser_id) + 'organiser' => Organiser::scope()->findOrFail($organiser_id), ]; return View::make('ManageOrganiser.Customize', $data); } - public function postEditOrganiser($organiser_id) { + public function postEditOrganiser($organiser_id) + { $organiser = Organiser::scope()->find($organiser_id); if (!$organiser->validate(Input::all())) { - return Response::json(array( - 'status' => 'error', - 'messages' => $organiser->errors() - )); + return Response::json([ + 'status' => 'error', + 'messages' => $organiser->errors(), + ]); } $organiser->name = Input::get('name'); @@ -41,7 +41,7 @@ class OrganiserCustomizeController extends MyBaseController /* * If the email has been changed the user must confirm the email. */ - if($organiser->email !== Input::get('email')) { + if ($organiser->email !== Input::get('email')) { $organiser->is_email_confirmed = 0; } @@ -49,12 +49,11 @@ class OrganiserCustomizeController extends MyBaseController $organiser->logo_path = ''; } - if (Input::hasFile('organiser_logo') ) { - + if (Input::hasFile('organiser_logo')) { $the_file = \File::get(Input::file('organiser_logo')->getRealPath()); - $file_name = str_slug($organiser->name).'-logo-' . $organiser->id . '.' . strtolower(Input::file('organiser_logo')->getClientOriginalExtension()); + $file_name = str_slug($organiser->name).'-logo-'.$organiser->id.'.'.strtolower(Input::file('organiser_logo')->getClientOriginalExtension()); - $relative_path_to_file = config('attendize.organiser_images_path') . '/' . $file_name; + $relative_path_to_file = config('attendize.organiser_images_path').'/'.$file_name; $full_path_to_file = public_path().'/'.$relative_path_to_file; $img = Image::make($the_file); @@ -66,23 +65,20 @@ class OrganiserCustomizeController extends MyBaseController $img->save($full_path_to_file); - if(\Storage::put($file_name, $the_file)) { + if (\Storage::put($file_name, $the_file)) { $organiser->logo_path = $relative_path_to_file; } - } - $organiser->save(); Session::flash('message', 'Successfully Updated Organiser'); - return Response::json(array( - 'status' => 'success', + return Response::json([ + 'status' => 'success', 'redirectUrl' => route('showOrganiserCustomize', [ - 'organiser_id' => $organiser->id - ]) - )); + 'organiser_id' => $organiser->id, + ]), + ]); } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/OrganiserDashboardController.php b/app/Http/Controllers/OrganiserDashboardController.php index e8663b24..0b0f446b 100644 --- a/app/Http/Controllers/OrganiserDashboardController.php +++ b/app/Http/Controllers/OrganiserDashboardController.php @@ -1,34 +1,28 @@ -findOrFail($organiser_id); $upcoming_events = $organiser->events()->where('end_date', '>=', Carbon::now())->get(); $data = [ - 'organiser' => $organiser, + 'organiser' => $organiser, 'upcoming_events' => $upcoming_events, - 'search' => [ + 'search' => [ 'sort_by' => 's', - 'q' => '' + 'q' => '', ], - 'q'=> 'dd' + 'q' => 'dd', ]; return View::make('ManageOrganiser.Dashboard', $data); } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/OrganiserEventsController.php b/app/Http/Controllers/OrganiserEventsController.php index 670b568f..86ba1e2f 100644 --- a/app/Http/Controllers/OrganiserEventsController.php +++ b/app/Http/Controllers/OrganiserEventsController.php @@ -1,15 +1,16 @@ -findOrfail($organiser_id); $allowed_sorts = ['created_at', 'start_date', 'end_date', 'title']; @@ -18,22 +19,19 @@ class OrganiserEventsController extends MyBaseController $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'start_date'); $events = $searchQuery - ? Event::scope()->where('title', 'like', '%' . $searchQuery . '%')->orderBy($sort_by, 'desc')->where('organiser_id', '=', $organiser_id)->paginate(12) + ? Event::scope()->where('title', 'like', '%'.$searchQuery.'%')->orderBy($sort_by, 'desc')->where('organiser_id', '=', $organiser_id)->paginate(12) : Event::scope()->where('organiser_id', '=', $organiser_id)->orderBy($sort_by, 'desc')->paginate(12); - $data = [ - 'events' => $events, + 'events' => $events, 'organiser' => $organiser, - 'search' => [ - 'q' => $searchQuery ? $searchQuery : '', - 'sort_by' => Input::get('sort_by') ? Input::get('sort_by') : '', - 'showPast' => Input::get('past') - ] + 'search' => [ + 'q' => $searchQuery ? $searchQuery : '', + 'sort_by' => Input::get('sort_by') ? Input::get('sort_by') : '', + 'showPast' => Input::get('past'), + ], ]; return View::make('ManageOrganiser.Events', $data); } - - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/OrganiserViewController.php b/app/Http/Controllers/OrganiserViewController.php index e60125ff..d45bc739 100644 --- a/app/Http/Controllers/OrganiserViewController.php +++ b/app/Http/Controllers/OrganiserViewController.php @@ -1,27 +1,27 @@ - $organiser, - 'tickets' => $organiser->events()->orderBy('created_at', 'desc')->get(), - 'is_embedded' => 0 + 'organiser' => $organiser, + 'tickets' => $organiser->events()->orderBy('created_at', 'desc')->get(), + 'is_embedded' => 0, ]; - + return View::make('Public.ViewOrganiser.OrganiserPage', $data); } - public function showEventHomePreview($event_id) { - return showEventHome($event_id, TRUE); + public function showEventHomePreview($event_id) + { + return showEventHome($event_id, true); } - } diff --git a/app/Http/Controllers/RemindersController.php b/app/Http/Controllers/RemindersController.php index a3e6f0b0..00753d40 100644 --- a/app/Http/Controllers/RemindersController.php +++ b/app/Http/Controllers/RemindersController.php @@ -2,14 +2,12 @@ namespace App\Http\Controllers; -use App\Http\Controllers\Controller; -use Illuminate\Http\Request; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\PasswordBroker; -use Illuminate\Foundation\Auth\ResetsPasswords; - -class RemindersController extends Controller { +use Illuminate\Http\Request; +class RemindersController extends Controller +{ /** * The Guard implementation. * @@ -24,7 +22,8 @@ class RemindersController extends Controller { */ protected $passwords; - public function __construct(Guard $auth, PasswordBroker $passwords) { + public function __construct(Guard $auth, PasswordBroker $passwords) + { $this->auth = $auth; $this->passwords = $passwords; @@ -32,21 +31,22 @@ class RemindersController extends Controller { } /** - * Get the e-mail subject line to be used for the reset link email. - * - * @return string - */ - protected function getEmailSubject() - { - return isset($this->subject) ? $this->subject : 'Your Password Reset Link'; - } - + * Get the e-mail subject line to be used for the reset link email. + * + * @return string + */ + protected function getEmailSubject() + { + return isset($this->subject) ? $this->subject : 'Your Password Reset Link'; + } + /** * Display the password reminder view. * * @return Response */ - public function getRemind() { + public function getRemind() + { return \View::make('Public.LoginAndRegister.ForgotPassword'); } @@ -55,11 +55,11 @@ class RemindersController extends Controller { * * @return Response */ - public function postRemind(Request $request) { - + public function postRemind(Request $request) + { $this->validate($request, ['email' => 'required']); - $response = $this->passwords->sendResetLink($request->only('email'), function($m) { + $response = $this->passwords->sendResetLink($request->only('email'), function ($m) { $m->subject($this->getEmailSubject()); }); @@ -75,12 +75,15 @@ class RemindersController extends Controller { /** * Display the password reset view for the given token. * - * @param string $token + * @param string $token + * * @return Response */ - public function getReset($token = null) { - if (is_null($token)) + public function getReset($token = null) + { + if (is_null($token)) { \App::abort(404); + } return \View::make('Public.LoginAndRegister.ResetPassword')->with('token', $token); } @@ -90,10 +93,11 @@ class RemindersController extends Controller { * * @return Response */ - public function postReset(Request $request) { + public function postReset(Request $request) + { $this->validate($request, [ - 'token' => 'required', - 'email' => 'required', + 'token' => 'required', + 'email' => 'required', 'password' => 'required|confirmed', ]); @@ -101,7 +105,7 @@ class RemindersController extends Controller { 'email', 'password', 'password_confirmation', 'token' ); - $response = $this->passwords->reset($credentials, function($user, $password) { + $response = $this->passwords->reset($credentials, function ($user, $password) { $user->password = bcrypt($password); $user->save(); @@ -112,6 +116,7 @@ class RemindersController extends Controller { switch ($response) { case PasswordBroker::PASSWORD_RESET: \Session::flash('message', 'Password Successfully Reset'); + return redirect(route('login')); default: @@ -120,5 +125,4 @@ class RemindersController extends Controller { ->withErrors(['email' => trans($response)]); } } - } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 441bc1c9..dca0a126 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -2,49 +2,47 @@ namespace App\Http\Controllers; -use Input, - Response, - Auth, - Validator; -use App\Http\Controllers\Controller; use App\Models\User; +use Auth; +use Input; +use Response; -class UserController extends Controller { - - public function showEditUser() { - +class UserController extends Controller +{ + public function showEditUser() + { $data = [ - 'user' => \Auth::user(), - 'modal_id' => \Input::get('modal_id') + 'user' => \Auth::user(), + 'modal_id' => \Input::get('modal_id'), ]; return \View::make('ManageUser.Modals.EditUser', $data); } - public function postEditUser() { - - $rules = array( - 'email' => ['required', 'email', 'exists:users,email,account_id,' . Auth::user()->account_id], + public function postEditUser() + { + $rules = [ + 'email' => ['required', 'email', 'exists:users,email,account_id,'.Auth::user()->account_id], 'new_password' => ['min:5', 'confirmed', 'required_with:password'], - 'password' => 'passcheck', - 'first_name' => ['required'], - 'last_name' => ['required'] - ); + 'password' => 'passcheck', + 'first_name' => ['required'], + 'last_name' => ['required'], + ]; $messages = [ - 'email.email' => 'Please enter a valid E-mail address.', - 'email.required' => 'E-mail address is required.', - 'password.passcheck' => 'This password is incorrect.', - 'email.exists' => 'This E-mail has is already in use.', - 'first_name.required' => 'Please enter your first name.' + 'email.email' => 'Please enter a valid E-mail address.', + 'email.required' => 'E-mail address is required.', + 'password.passcheck' => 'This password is incorrect.', + 'email.exists' => 'This E-mail has is already in use.', + 'first_name.required' => 'Please enter your first name.', ]; $validation = \Validator::make(Input::all(), $rules, $messages); if ($validation->fails()) { return Response::json([ - 'status' => 'error', - 'messages' => $validation->messages()->toArray() + 'status' => 'error', + 'messages' => $validation->messages()->toArray(), ]); } @@ -57,15 +55,12 @@ class UserController extends Controller { $user->first_name = Input::get('first_name'); $user->last_name = Input::get('last_name'); - - //$user->email = Input::get('email'); $user->save(); return Response::json([ - 'status' => 'success', - 'message' => 'Successfully Edited User' + 'status' => 'success', + 'message' => 'Successfully Edited User', ]); } - } diff --git a/app/Http/Controllers/UserLoginController.php b/app/Http/Controllers/UserLoginController.php index d4fa249d..795d485c 100644 --- a/app/Http/Controllers/UserLoginController.php +++ b/app/Http/Controllers/UserLoginController.php @@ -2,57 +2,55 @@ namespace App\Http\Controllers; -use App\Http\Controllers\Controller; -use Request, - View, - Auth, - Input, - Redirect; -use \Illuminate\Contracts\Auth\Guard; - -class UserLoginController extends Controller { +use Auth; +use Illuminate\Contracts\Auth\Guard; +use Input; +use Redirect; +use Request; +use View; +class UserLoginController extends Controller +{ protected $auth; - public function __construct(Guard $auth) { + public function __construct(Guard $auth) + { $this->auth = $auth; $this->middleware('guest'); } - public function showLogin() { + public function showLogin() + { /* * If there's an ajax request to the login page assume the person has been * logged out and redirect them to the login page */ if (Request::ajax()) { - return Response::json(array( - 'status' => 'success', - 'redirectUrl' => route('login') - )); + return Response::json([ + 'status' => 'success', + 'redirectUrl' => route('login'), + ]); } return View::make('Public.LoginAndRegister.Login'); } /** - * Handle the login - * + * Handle the login. + * * @return void */ - public function postLogin() { - + public function postLogin() + { $email = Input::get('email'); $password = Input::get('password'); - if ($this->auth->attempt(array('email' => $email, 'password' => $password), true)) { + if ($this->auth->attempt(['email' => $email, 'password' => $password], true)) { return Redirect::to(route('showSelectOrganiser')); } + return Redirect::to('login?failed=yup')->with('message', 'Your username/password combination was incorrect') ->withInput(); } - - - - } diff --git a/app/Http/Controllers/UserLogoutController.php b/app/Http/Controllers/UserLogoutController.php index 6e885552..0b856711 100644 --- a/app/Http/Controllers/UserLogoutController.php +++ b/app/Http/Controllers/UserLogoutController.php @@ -2,21 +2,22 @@ namespace App\Http\Controllers; -use Illuminate\Routing\Controller; use Illuminate\Contracts\Auth\Guard; +use Illuminate\Routing\Controller; -class UserLogoutController extends Controller { - +class UserLogoutController extends Controller +{ protected $auth; - - public function __construct(Guard $auth) { + + public function __construct(Guard $auth) + { $this->auth = $auth; } - - public function doLogout() { + public function doLogout() + { $this->auth->logout(); + return \Redirect::to('/?logged_out=yup'); } - -} \ No newline at end of file +} diff --git a/app/Http/Controllers/UserSignupController.php b/app/Http/Controllers/UserSignupController.php index da0d5196..2bbf4675 100644 --- a/app/Http/Controllers/UserSignupController.php +++ b/app/Http/Controllers/UserSignupController.php @@ -1,106 +1,106 @@ - 0 && !Utils::isAttendize()) { + public function __construct(Guard $auth) + { + if (Account::count() > 0 && !Utils::isAttendize()) { return Redirect::route('login'); } $this->auth = $auth; $this->middleware('guest'); } - - public function showSignup() { + public function showSignup() + { return View::make('Public.LoginAndRegister.Signup'); } - /** - * Creates an account + * Creates an account. * * @return void */ - public function postSignup() { - $rules = array( - 'email' => array('required', 'email', 'unique:users'), - 'password' => array('required', 'min:5', 'confirmed'), - 'first_name' => array('required'), - 'terms_agreed' => Utils::isAttendize() ? array('required') : '' - ); + public function postSignup() + { + $rules = [ + 'email' => ['required', 'email', 'unique:users'], + 'password' => ['required', 'min:5', 'confirmed'], + 'first_name' => ['required'], + 'terms_agreed' => Utils::isAttendize() ? ['required'] : '', + ]; - $messages = array( - 'email.email' => 'Please enter a valid E-mail address.', - 'email.required' => 'E-mail address is required.', - 'password.required' => 'Password is required.', - 'password.min' => 'Your password is too short! Min 5 symbols.', - 'email.unique' => 'This E-mail has already been taken.', - 'first_name.required' => 'Please enter your first name.', - 'terms_agreed.required' => 'Please agree to our Terms of Service.' - ); + $messages = [ + 'email.email' => 'Please enter a valid E-mail address.', + 'email.required' => 'E-mail address is required.', + 'password.required' => 'Password is required.', + 'password.min' => 'Your password is too short! Min 5 symbols.', + 'email.unique' => 'This E-mail has already been taken.', + 'first_name.required' => 'Please enter your first name.', + 'terms_agreed.required' => 'Please agree to our Terms of Service.', + ]; - $validation = Validator::make(Input::all(), $rules, $messages); + $validation = Validator::make(Input::all(), $rules, $messages); - if ($validation->fails()) { - return Redirect::to('signup')->withInput()->withErrors($validation); - } + if ($validation->fails()) { + return Redirect::to('signup')->withInput()->withErrors($validation); + } - $account = new Account; - $account->email = Input::get('email'); - $account->first_name = Input::get('first_name'); - $account->last_name = Input::get('last_name'); - $account->currency_id = config('attendize.default_currency'); - $account->timezone_id = config('attendize.default_timezone'); - $account->save(); + $account = new Account(); + $account->email = Input::get('email'); + $account->first_name = Input::get('first_name'); + $account->last_name = Input::get('last_name'); + $account->currency_id = config('attendize.default_currency'); + $account->timezone_id = config('attendize.default_timezone'); + $account->save(); - $user = new User; - $user->email = Input::get('email'); - $user->first_name = Input::get('first_name'); - $user->last_name = Input::get('last_name'); - $user->password = Hash::make(Input::get('password')); - $user->account_id = $account->id; + $user = new User(); + $user->email = Input::get('email'); + $user->first_name = Input::get('first_name'); + $user->last_name = Input::get('last_name'); + $user->password = Hash::make(Input::get('password')); + $user->account_id = $account->id; $user->is_parent = 1; $user->is_registered = 1; - $user->save(); + $user->save(); - - if(Utils::isAttendize()) { - Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function($message) { + if (Utils::isAttendize()) { + Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function ($message) { $message->to(Input::get('email'), Input::get('first_name')) ->subject('Thank you for registering for Attendize'); }); } - Session::flash('message', "Success! You can now login."); + Session::flash('message', 'Success! You can now login.'); - return Redirect::to('login'); + return Redirect::to('login'); } - function confirmEmail($confirmation_code) { - + public function confirmEmail($confirmation_code) + { $user = User::whereConfirmationCode($confirmation_code)->first(); - if ( ! $user) - { + if (!$user) { return \View::make('Public.Errors.Generic', [ - 'message' => 'The confirmation code is missing or malformed.' + 'message' => 'The confirmation code is missing or malformed.', ]); } @@ -108,21 +108,19 @@ class UserSignupController extends Controller { $user->confirmation_code = null; $user->save(); - \Session::flash('message', "Success! Your email is now verified. You can now login."); + \Session::flash('message', 'Success! Your email is now verified. You can now login.'); //$this->auth->login($user); return Redirect::route('login'); } - + private function validateEmail($data) { $rules = [ - 'email' => 'required|email|unique:users' + 'email' => 'required|email|unique:users', ]; return Validator::make($data, $rules); } - - } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 311083cf..9b0339ff 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -1,35 +1,36 @@ - 'App\Http\Middleware\Authenticate', - 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', - 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', - 'first.run' => 'App\Http\Middleware\FirstRunMiddleware', - 'installed' => 'App\Http\Middleware\CheckInstalled' - ]; +class Kernel extends HttpKernel +{ + /** + * The application's global HTTP middleware stack. + * + * @var array + */ + protected $middleware = [ + 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode', + 'Illuminate\Cookie\Middleware\EncryptCookies', + 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', + 'Illuminate\Session\Middleware\StartSession', + 'Illuminate\View\Middleware\ShareErrorsFromSession', + 'App\Http\Middleware\VerifyCsrfToken', + 'App\Http\Middleware\GeneralChecks', + ]; + /** + * The application's route middleware. + * + * @var array + */ + protected $routeMiddleware = [ + 'auth' => 'App\Http\Middleware\Authenticate', + 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', + 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', + 'first.run' => 'App\Http\Middleware\FirstRunMiddleware', + 'installed' => 'App\Http\Middleware\CheckInstalled', + ]; } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 6cdaef1c..a9632879 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -1,50 +1,49 @@ -auth = $auth; + } - /** - * Create a new filter instance. - * - * @param Guard $auth - * @return void - */ - public function __construct(Guard $auth) - { - $this->auth = $auth; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if ($this->auth->guest()) - { - if ($request->ajax()) - { - return response('Unauthorized.', 401); - } - else - { - return redirect()->guest('login'); - } - } - - return $next($request); - } + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * + * @return mixed + */ + public function handle($request, Closure $next) + { + if ($this->auth->guest()) { + if ($request->ajax()) { + return response('Unauthorized.', 401); + } else { + return redirect()->guest('login'); + } + } + return $next($request); + } } diff --git a/app/Http/Middleware/CheckInstalled.php b/app/Http/Middleware/CheckInstalled.php index d8e1c2c3..1a064074 100644 --- a/app/Http/Middleware/CheckInstalled.php +++ b/app/Http/Middleware/CheckInstalled.php @@ -1,23 +1,25 @@ -count() === 0 && !($request->route()->getName() == 'showCreateOrganiser') && !($request->route()->getName() == 'postCreateOrganiser')) { return redirect(route('showCreateOrganiser', [ - 'first_run' => '1' + 'first_run' => '1', ])); } elseif (Organiser::scope()->count() === 1 && ($request->route()->getName() == 'showSelectOrganiser')) { return redirect(route('showOrganiserDashboard', [ - 'organiser_id' => Organiser::scope()->first()->id + 'organiser_id' => Organiser::scope()->first()->id, ])); } @@ -42,4 +38,4 @@ class FirstRunMiddleware return $response; } -} \ No newline at end of file +} diff --git a/app/Http/Middleware/GeneralChecks.php b/app/Http/Middleware/GeneralChecks.php index 26851223..714ef31b 100644 --- a/app/Http/Middleware/GeneralChecks.php +++ b/app/Http/Middleware/GeneralChecks.php @@ -1,15 +1,17 @@ -auth = $auth; + } - /** - * Create a new filter instance. - * - * @param Guard $auth - * @return void - */ - public function __construct(Guard $auth) - { - $this->auth = $auth; - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if ($this->auth->check()) - { - return new RedirectResponse(route('showSelectOrganiser')); - } - - return $next($request); - } + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * + * @return mixed + */ + public function handle($request, Closure $next) + { + if ($this->auth->check()) { + return new RedirectResponse(route('showSelectOrganiser')); + } + return $next($request); + } } diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 3d701ec3..30c8b13b 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -1,25 +1,26 @@ - 'showInstaller', - 'uses' => 'InstallerController@showInstaller' + 'as' => 'showInstaller', + 'uses' => 'InstallerController@showInstaller', ]); Route::post('install', [ - 'as' => 'postInstaller', - 'uses' => 'InstallerController@postInstaller' + 'as' => 'postInstaller', + 'uses' => 'InstallerController@postInstaller', ]); /* - * Stripe connect return + * Stripe connect return */ Route::any('payment/return/stripe', [ - 'as' => 'showStripeReturn', - 'uses' => 'ManageAccountController@showStripeReturn' + 'as' => 'showStripeReturn', + 'uses' => 'ManageAccountController@showStripeReturn', ]); - /* * Logout */ Route::any('/logout', [ 'uses' => 'UserLogoutController@doLogout', - 'as' => 'logout' + 'as' => 'logout', ]); - -Route::group(array('middleware' => ['installed']), function() { - +Route::group(['middleware' => ['installed']], function () { /* * Login */ Route::get('/login', [ - 'as' => 'login', - 'uses' => 'UserLoginController@showLogin' + 'as' => 'login', + 'uses' => 'UserLoginController@showLogin', ]); Route::post('/login', 'UserLoginController@postLogin'); @@ -57,36 +54,34 @@ Route::group(array('middleware' => ['installed']), function() { * Forgot password */ Route::get('login/forgot-password', [ - 'as' => 'forgotPassword', - 'uses' => 'RemindersController@getRemind' + 'as' => 'forgotPassword', + 'uses' => 'RemindersController@getRemind', ]); Route::post('login/forgot-password', [ - 'as' => 'postForgotPassword', - 'uses' => 'RemindersController@postRemind' + 'as' => 'postForgotPassword', + 'uses' => 'RemindersController@postRemind', ]); /* * Reset Password */ Route::get('login/reset-password/{token}', [ - 'as' => 'showResetPassword', - 'uses' => 'RemindersController@getReset' + 'as' => 'showResetPassword', + 'uses' => 'RemindersController@getReset', ]); Route::post('login/reset-password', [ - 'as' => 'postResetPassword', - 'uses' => 'RemindersController@postReset' + 'as' => 'postResetPassword', + 'uses' => 'RemindersController@postReset', ]); - - /* * Registration / Account creation */ Route::get('/signup', [ 'uses' => 'UserSignupController@showSignup', - 'as' => 'showSignup' + 'as' => 'showSignup', ]); Route::post('/signup', 'UserSignupController@postSignup'); @@ -94,155 +89,147 @@ Route::group(array('middleware' => ['installed']), function() { * Confirm Email */ Route::get('signup/confirm_email/{confirmation_code}', [ - 'as' => 'confirmEmail', - 'uses' => 'UserSignupController@confirmEmail' + 'as' => 'confirmEmail', + 'uses' => 'UserSignupController@confirmEmail', ]); }); /* * Public organiser page routes */ -Route::group(['prefix' => 'o'], function() { - - Route::get('/{organiser_id}/{organier_slug?}', [ - 'as' => 'showOrganiserHome', - 'uses' => 'OrganiserViewController@showOrganiserHome' - ]); - -}); +Route::group(['prefix' => 'o'], function () { + Route::get('/{organiser_id}/{organier_slug?}', [ + 'as' => 'showOrganiserHome', + 'uses' => 'OrganiserViewController@showOrganiserHome', + ]); + +}); /* * Public event page routes */ -Route::group(array('prefix' => 'e'), function() { - - +Route::group(['prefix' => 'e'], function () { /* * Embedded events */ Route::get('/{event_id}/embed', [ - 'as' => 'showEmbeddedEventPage', - 'uses' => 'EventViewEmbeddedController@showEmbeddedEvent' + 'as' => 'showEmbeddedEventPage', + 'uses' => 'EventViewEmbeddedController@showEmbeddedEvent', ]); Route::get('/{event_id}/{event_slug?}', [ - 'as' => 'showEventPage', - 'uses' => 'EventViewController@showEventHome' + 'as' => 'showEventPage', + 'uses' => 'EventViewController@showEventHome', ]); Route::post('/{event_id}/contact_organiser', [ - 'as' => 'postContactOrganiser', - 'uses' => 'EventViewController@postContactOrganiser' + 'as' => 'postContactOrganiser', + 'uses' => 'EventViewController@postContactOrganiser', ]); /* * Used for previewing designs in the backend. Doesn't log page views etc. */ Route::get('/{event_id}/preview', [ - 'as' => 'showEventPagePreview', - 'uses' => 'EventViewController@showEventHomePreview' + 'as' => 'showEventPagePreview', + 'uses' => 'EventViewController@showEventHomePreview', ]); Route::post('{event_id}/checkout/', [ - 'as' => 'postValidateTickets', - 'uses' => 'EventCheckoutController@postValidateTickets' + 'as' => 'postValidateTickets', + 'uses' => 'EventCheckoutController@postValidateTickets', ]); Route::get('{event_id}/checkout/create', [ - 'as' => 'showEventCheckout', - 'uses' => 'EventCheckoutController@showEventCheckout' + 'as' => 'showEventCheckout', + 'uses' => 'EventCheckoutController@showEventCheckout', ]); Route::post('{event_id}/checkout/create', [ - 'as' => 'postCreateOrder', - 'uses' => 'EventCheckoutController@postCreateOrder' + 'as' => 'postCreateOrder', + 'uses' => 'EventCheckoutController@postCreateOrder', ]); }); - - /* * View order */ Route::get('order/{order_reference}', [ - 'as' => 'showOrderDetails', - 'uses' => 'EventCheckoutController@showOrderDetails' + 'as' => 'showOrderDetails', + 'uses' => 'EventCheckoutController@showOrderDetails', ]); Route::get('order/{order_reference}/tickets', [ - 'as' => 'showOrderTickets', - 'uses' => 'EventCheckoutController@showOrderTickets' + 'as' => 'showOrderTickets', + 'uses' => 'EventCheckoutController@showOrderTickets', ]); - /* * Begin logged in stuff */ -Route::group(array('middleware' => ['auth', 'first.run']), function() { - +Route::group(['middleware' => ['auth', 'first.run']], function () { + /* * Edit User */ - Route::group(['prefix' => 'user'], function() { - + Route::group(['prefix' => 'user'], function () { + Route::get('/', [ - 'as' => 'showEditUser', - 'uses' => 'UserController@showEditUser' + 'as' => 'showEditUser', + 'uses' => 'UserController@showEditUser', ]); Route::post('/', [ - 'as' => 'postEditUser', - 'uses' => 'UserController@postEditUser' + 'as' => 'postEditUser', + 'uses' => 'UserController@postEditUser', ]); - + }); /* * Manage account */ - Route::group(array('prefix' => 'account'), function() { + Route::group(['prefix' => 'account'], function () { Route::get('/', [ - 'as' => 'showEditAccount', - 'uses' => 'ManageAccountController@showEditAccount' + 'as' => 'showEditAccount', + 'uses' => 'ManageAccountController@showEditAccount', ]); Route::post('/', [ - 'as' => 'postEditAccount', - 'uses' => 'ManageAccountController@postEditAccount' + 'as' => 'postEditAccount', + 'uses' => 'ManageAccountController@postEditAccount', ]); Route::post('/edit_payment', [ - 'as' => 'postEditAccountPayment', - 'uses' => 'ManageAccountController@postEditAccountPayment' + 'as' => 'postEditAccountPayment', + 'uses' => 'ManageAccountController@postEditAccountPayment', ]); Route::post('invite_user', [ - 'as' => 'postInviteUser', - 'uses' => 'ManageAccountController@postInviteUser' + 'as' => 'postInviteUser', + 'uses' => 'ManageAccountController@postInviteUser', ]); - + }); - - Route::get('select_organiser', [ - 'as' => 'showSelectOrganiser', - 'uses' => 'OrganiserController@showSelectOragniser' + 'as' => 'showSelectOrganiser', + 'uses' => 'OrganiserController@showSelectOragniser', ]); /* * New organiser dashboard */ - Route::group(array('prefix' => 'organiser'), function() { + Route::group(['prefix' => 'organiser'], function () { /* * ----------- * Organiser Dashboard * ----------- */ Route::get('{organiser_id}/dashboard', [ - 'as' => 'showOrganiserDashboard', - 'uses' => 'OrganiserDashboardController@showDashboard' + 'as' => 'showOrganiserDashboard', + 'uses' => 'OrganiserDashboardController@showDashboard', ]); /* @@ -251,8 +238,8 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() { * ----------- */ Route::get('{organiser_id}/events', [ - 'as' => 'showOrganiserEvents', - 'uses' => 'OrganiserEventsController@showEvents' + 'as' => 'showOrganiserEvents', + 'uses' => 'OrganiserEventsController@showEvents', ]); /* * ----------- @@ -260,17 +247,15 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() { * ----------- */ Route::get('{organiser_id}/customize', [ - 'as' => 'showOrganiserCustomize', - 'uses' => 'OrganiserCustomizeController@showCustomize' + 'as' => 'showOrganiserCustomize', + 'uses' => 'OrganiserCustomizeController@showCustomize', ]); }); /* * Events dashboard */ - Route::group(array('prefix' => 'events'), function() { - - + Route::group(['prefix' => 'events'], function () { /* * ----------- @@ -278,91 +263,86 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() { * ----------- */ Route::get('/organiser/create', [ - 'as' => 'showCreateOrganiser', - 'uses' => 'OrganiserController@showCreateOrganiser' + 'as' => 'showCreateOrganiser', + 'uses' => 'OrganiserController@showCreateOrganiser', ]); Route::post('/organiser/create', [ - 'as' => 'postCreateOrganiser', - 'uses' => 'OrganiserController@postCreateOrganiser' + 'as' => 'postCreateOrganiser', + 'uses' => 'OrganiserController@postCreateOrganiser', ]); Route::get('/organiser/{organiser_id}', [ - 'as' => 'showOrganiserEventsDashboard', - 'uses' => 'OrganiserController@showOrganiserDashboard' + 'as' => 'showOrganiserEventsDashboard', + 'uses' => 'OrganiserController@showOrganiserDashboard', ]); Route::get('/organiser/{organiser_id?}', [ - 'as' => 'showSearchEventsDashboard', - 'uses' => 'OrganiserController@showOrganiserDashboard' + 'as' => 'showSearchEventsDashboard', + 'uses' => 'OrganiserController@showOrganiserDashboard', ]); Route::get('/organiser/{organiser_id}/edit', [ - 'as' => 'showEditOrganiser', - 'uses' => 'OrganiserController@showEditOrganiser' + 'as' => 'showEditOrganiser', + 'uses' => 'OrganiserController@showEditOrganiser', ]); Route::post('/organiser/{organiser_id}/edit', [ - 'as' => 'postEditOrganiser', - 'uses' => 'OrganiserCustomizeController@postEditOrganiser' + 'as' => 'postEditOrganiser', + 'uses' => 'OrganiserCustomizeController@postEditOrganiser', ]); - - - - /* * ---------- * Create Event * ---------- */ Route::get('/create', [ - 'as' => 'showCreateEvent', - 'uses' => 'EventController@showCreateEvent' + 'as' => 'showCreateEvent', + 'uses' => 'EventController@showCreateEvent', ]); Route::post('/create', [ - 'as' => 'postCreateEvent', - 'uses' => 'EventController@postCreateEvent' + 'as' => 'postCreateEvent', + 'uses' => 'EventController@postCreateEvent', ]); }); - + /* * Upoad event images */ Route::post('/upload_image', [ - 'as' => 'postUploadEventImage', - 'uses' => 'EventController@postUploadEventImage' + 'as' => 'postUploadEventImage', + 'uses' => 'EventController@postUploadEventImage', ]); - - /* * Event Management Stuff */ - Route::group(array('prefix' => 'event'), function() { + Route::group(['prefix' => 'event'], function () { /* * ------- * Dashboard * ------- */ - Route::get('{event_id}/dashboard/', array( - 'as' => 'showEventDashboard', - 'uses' => 'EventDashboardController@showDashboard') + Route::get('{event_id}/dashboard/', [ + 'as' => 'showEventDashboard', + 'uses' => 'EventDashboardController@showDashboard', ] ); - Route::get('{event_id}', function($event_id) { + Route::get('{event_id}', function ($event_id) { return Redirect::route('showEventDashboard', [ - 'event_id' => $event_id + 'event_id' => $event_id, ]); }); - /** + /* * @todo Move to a controller */ - Route::get('{event_id}/go_live', ['as' => 'MakeEventLive', function($event_id) { + Route::get('{event_id}/go_live', ['as' => 'MakeEventLive', function ($event_id) { $event = \App\Models\Event::scope()->findOrFail($event_id); $event->is_live = 1; $event->save(); \Session::flash('message', 'Event Successfully Made Live! You can undo this action in event settings page.'); + return Redirect::route('showEventDashboard', [ - 'event_id' => $event_id + 'event_id' => $event_id, ]); }]); @@ -371,157 +351,152 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() { * Tickets * ------- */ - Route::get('{event_id}/tickets/', array( - 'as' => 'showEventTickets', - 'uses' => 'EventTicketsController@showTickets' - )); - Route::get('{event_id}/tickets/edit/{ticket_id}', array( - 'as' => 'showEditTicket', - 'uses' => 'EventTicketsController@showEditTicket' - )); - Route::post('{event_id}/tickets/edit/{ticket_id}', array( - 'as' => 'postEditTicket', - 'uses' => 'EventTicketsController@postEditTicket' - )); - Route::get('{event_id}/tickets/create', array( - 'as' => 'showCreateTicket', - 'uses' => 'EventTicketsController@showCreateTicket' - )); - Route::post('{event_id}/tickets/create', array( - 'as' => 'postCreateTicket', - 'uses' => 'EventTicketsController@postCreateTicket' - )); - Route::post('{event_id}/tickets/delete', array( - 'as' => 'postDeleteTicket', - 'uses' => 'EventTicketsController@postDeleteTicket' - )); - Route::post('{event_id}/tickets/pause', array( - 'as' => 'postPauseTicket', - 'uses' => 'EventTicketsController@postPauseTicket' - )); + Route::get('{event_id}/tickets/', [ + 'as' => 'showEventTickets', + 'uses' => 'EventTicketsController@showTickets', + ]); + Route::get('{event_id}/tickets/edit/{ticket_id}', [ + 'as' => 'showEditTicket', + 'uses' => 'EventTicketsController@showEditTicket', + ]); + Route::post('{event_id}/tickets/edit/{ticket_id}', [ + 'as' => 'postEditTicket', + 'uses' => 'EventTicketsController@postEditTicket', + ]); + Route::get('{event_id}/tickets/create', [ + 'as' => 'showCreateTicket', + 'uses' => 'EventTicketsController@showCreateTicket', + ]); + Route::post('{event_id}/tickets/create', [ + 'as' => 'postCreateTicket', + 'uses' => 'EventTicketsController@postCreateTicket', + ]); + Route::post('{event_id}/tickets/delete', [ + 'as' => 'postDeleteTicket', + 'uses' => 'EventTicketsController@postDeleteTicket', + ]); + Route::post('{event_id}/tickets/pause', [ + 'as' => 'postPauseTicket', + 'uses' => 'EventTicketsController@postPauseTicket', + ]); /* * Ticket questions */ Route::get('{event_id}/tickets/questions', [ - 'as' => 'showTicketQuestions', - 'uses' => 'EventTicketQuestionsController@showQuestions' + 'as' => 'showTicketQuestions', + 'uses' => 'EventTicketQuestionsController@showQuestions', ]); Route::post('{event_id}/tickets/questions/create', [ - 'as' => 'postCreateQuestion', - 'uses' => 'EventTicketQuestionsController@postCreateQuestion' + 'as' => 'postCreateQuestion', + 'uses' => 'EventTicketQuestionsController@postCreateQuestion', ]); - - - /* * ------- * Attendees * ------- */ - Route::get('{event_id}/attendees/', array( - 'as' => 'showEventAttendees', - 'uses' => 'EventAttendeesController@showAttendees' - )); + Route::get('{event_id}/attendees/', [ + 'as' => 'showEventAttendees', + 'uses' => 'EventAttendeesController@showAttendees', + ]); Route::get('{event_id}/attendees/message', [ - 'as' => 'showMessageAttendees', - 'uses' => 'EventAttendeesController@showMessageAttendees' + 'as' => 'showMessageAttendees', + 'uses' => 'EventAttendeesController@showMessageAttendees', ]); Route::post('{event_id}/attendees/message', [ - 'as' => 'postMessageAttendees', - 'uses' => 'EventAttendeesController@postMessageAttendees' + 'as' => 'postMessageAttendees', + 'uses' => 'EventAttendeesController@postMessageAttendees', ]); Route::get('{event_id}/attendees/single_message', [ - 'as' => 'showMessageAttendee', - 'uses' => 'EventAttendeesController@showMessageAttendee' + 'as' => 'showMessageAttendee', + 'uses' => 'EventAttendeesController@showMessageAttendee', ]); Route::post('{event_id}/attendees/single_message', [ - 'as' => 'postMessageAttendee', - 'uses' => 'EventAttendeesController@postMessageAttendee' + 'as' => 'postMessageAttendee', + 'uses' => 'EventAttendeesController@postMessageAttendee', ]); - Route::get('{event_id}/attendees/create', [ - 'as' => 'showCreateAttendee', - 'uses' => 'EventAttendeesController@showCreateAttendee' + 'as' => 'showCreateAttendee', + 'uses' => 'EventAttendeesController@showCreateAttendee', ]); Route::post('{event_id}/attendees/create', [ - 'as' => 'postCreateAttendee', - 'uses' => 'EventAttendeesController@postCreateAttendee' + 'as' => 'postCreateAttendee', + 'uses' => 'EventAttendeesController@postCreateAttendee', ]); Route::get('{event_id}/attendees/print', [ - 'as' => 'showPrintAttendees', - 'uses' => 'EventAttendeesController@showPrintAttendees' + 'as' => 'showPrintAttendees', + 'uses' => 'EventAttendeesController@showPrintAttendees', ]); Route::get('{event_id}/attendees/export/{export_as?}', [ - 'as' => 'showExportAttendees', - 'uses' => 'EventAttendeesController@showExportAttendees' + 'as' => 'showExportAttendees', + 'uses' => 'EventAttendeesController@showExportAttendees', ]); Route::get('{event_id}/attendees/{attendee_id}/edit', [ - 'as' => 'showEditAttendee', - 'uses' => 'EventAttendeesController@showEditAttendee' + 'as' => 'showEditAttendee', + 'uses' => 'EventAttendeesController@showEditAttendee', ]); Route::post('{event_id}/attendees/{attendee_id}/edit', [ - 'as' => 'postEditAttendee', - 'uses' => 'EventAttendeesController@postEditAttendee' + 'as' => 'postEditAttendee', + 'uses' => 'EventAttendeesController@postEditAttendee', ]); Route::get('{event_id}/attendees/{attendee_id}/cancel', [ - 'as' => 'showCancelAttendee', - 'uses' => 'EventAttendeesController@showCancelAttendee' + 'as' => 'showCancelAttendee', + 'uses' => 'EventAttendeesController@showCancelAttendee', ]); Route::post('{event_id}/attendees/{attendee_id}/cancel', [ - 'as' => 'postCancelAttendee', - 'uses' => 'EventAttendeesController@postCancelAttendee' + 'as' => 'postCancelAttendee', + 'uses' => 'EventAttendeesController@postCancelAttendee', ]); - /* * ------- * Orders * ------- */ - Route::get('{event_id}/orders/', array( - 'as' => 'showEventOrders', - 'uses' => 'EventOrdersController@showOrders' - )); + Route::get('{event_id}/orders/', [ + 'as' => 'showEventOrders', + 'uses' => 'EventOrdersController@showOrders', + ]); - Route::get('order/{order_id}', array( - 'as' => 'showManageOrder', - 'uses' => 'EventOrdersController@manageOrder' - )); + Route::get('order/{order_id}', [ + 'as' => 'showManageOrder', + 'uses' => 'EventOrdersController@manageOrder', + ]); - Route::get('order/{order_id}/cancel', array( - 'as' => 'showCancelOrder', - 'uses' => 'EventOrdersController@showCancelOrder' - )); + Route::get('order/{order_id}/cancel', [ + 'as' => 'showCancelOrder', + 'uses' => 'EventOrdersController@showCancelOrder', + ]); - Route::post('order/{order_id}/cancel', array( - 'as' => 'postCancelOrder', - 'uses' => 'EventOrdersController@postCancelOrder' - )); + Route::post('order/{order_id}/cancel', [ + 'as' => 'postCancelOrder', + 'uses' => 'EventOrdersController@postCancelOrder', + ]); Route::get('{event_id}/orders/export/{export_as?}', [ - 'as' => 'showExportOrders', - 'uses' => 'EventOrdersController@showExportOrders' + 'as' => 'showExportOrders', + 'uses' => 'EventOrdersController@showExportOrders', ]); Route::get('{event_id}/orders/message', [ - 'as' => 'showMessageOrder', - 'uses' => 'EventOrdersController@showMessageOrder' + 'as' => 'showMessageOrder', + 'uses' => 'EventOrdersController@showMessageOrder', ]); Route::post('{event_id}/orders/message', [ - 'as' => 'postMessageOrder', - 'uses' => 'EventOrdersController@postMessageOrder' + 'as' => 'postMessageOrder', + 'uses' => 'EventOrdersController@postMessageOrder', ]); /* @@ -529,102 +504,88 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() { * Edit Event * ------- */ - Route::post('{event_id}/customize', array( - 'as' => 'postEditEvent', - 'uses' => 'EventController@postEditEvent' - )); + Route::post('{event_id}/customize', [ + 'as' => 'postEditEvent', + 'uses' => 'EventController@postEditEvent', + ]); /* * ------- * Customize Design etc. * ------- */ - Route::get('{event_id}/customize', array( - 'as' => 'showEventCustomize', - 'uses' => 'EventCustomizeController@showCustomize' - )); - - Route::get('{event_id}/customize/{tab?}', array( - 'as' => 'showEventCustomizeTab', - 'uses' => 'EventCustomizeController@showCustomize' - )); - - - - Route::post('{event_id}/customize/order_page', array( - 'as' => 'postEditEventOrderPage', - 'uses' => 'EventCustomizeController@postEditEventOrderPage' - )); - Route::post('{event_id}/customize/design', array( - 'as' => 'postEditEventDesign', - 'uses' => 'EventCustomizeController@postEditEventDesign' - )); - Route::post('{event_id}/customize/social', array( - 'as' => 'postEditEventSocial', - 'uses' => 'EventCustomizeController@postEditEventSocial' - )); - - Route::post('{event_id}/customize/fees', array( - 'as' => 'postEditEventFees', - 'uses' => 'EventCustomizeController@postEditEventFees' - )); + Route::get('{event_id}/customize', [ + 'as' => 'showEventCustomize', + 'uses' => 'EventCustomizeController@showCustomize', + ]); + Route::get('{event_id}/customize/{tab?}', [ + 'as' => 'showEventCustomizeTab', + 'uses' => 'EventCustomizeController@showCustomize', + ]); + Route::post('{event_id}/customize/order_page', [ + 'as' => 'postEditEventOrderPage', + 'uses' => 'EventCustomizeController@postEditEventOrderPage', + ]); + Route::post('{event_id}/customize/design', [ + 'as' => 'postEditEventDesign', + 'uses' => 'EventCustomizeController@postEditEventDesign', + ]); + Route::post('{event_id}/customize/social', [ + 'as' => 'postEditEventSocial', + 'uses' => 'EventCustomizeController@postEditEventSocial', + ]); + Route::post('{event_id}/customize/fees', [ + 'as' => 'postEditEventFees', + 'uses' => 'EventCustomizeController@postEditEventFees', + ]); /* * ------- * Check In App * ------- */ - Route::get('{event_id}/check_in', array( - 'as' => 'showChechIn', - 'uses' => 'EventCheckInController@showCheckIn' - )); - Route::post('{event_id}/check_in/search', array( - 'as' => 'postCheckInSearch', - 'uses' => 'EventCheckInController@postCheckInSearch' - )); - Route::post('{event_id}/check_in/', array( - 'as' => 'postCheckInAttendee', - 'uses' => 'EventCheckInController@postCheckInAttendee' - )); - - - - + Route::get('{event_id}/check_in', [ + 'as' => 'showChechIn', + 'uses' => 'EventCheckInController@showCheckIn', + ]); + Route::post('{event_id}/check_in/search', [ + 'as' => 'postCheckInSearch', + 'uses' => 'EventCheckInController@postCheckInSearch', + ]); + Route::post('{event_id}/check_in/', [ + 'as' => 'postCheckInAttendee', + 'uses' => 'EventCheckInController@postCheckInAttendee', + ]); /* * ------- * Promote * ------- */ - Route::get('{event_id}/promote', array( - 'as' => 'showEventPromote', - 'uses' => 'EventPromoteController@showPromote' - )); + Route::get('{event_id}/promote', [ + 'as' => 'showEventPromote', + 'uses' => 'EventPromoteController@showPromote', + ]); }); }); - -Route::post('queue/push', function() { +Route::post('queue/push', function () { // set_time_limit(300); return Queue::marshal(); }); - -Route::get('/', function() { +Route::get('/', function () { return Redirect::route('showSelectOrganiser'); }); - -Route::get('/terms_and_conditions', ['as' => 'termsAndConditions', function() { +Route::get('/terms_and_conditions', ['as' => 'termsAndConditions', function () { return 'TODO: add terms and cond'; //return View::make('Public.Website.Terms_and_Cond'); }]); - - diff --git a/app/Models/Account.php b/app/Models/Account.php index 9c38fa1b..4d85fbbe 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -1,38 +1,43 @@ - ['required'], - 'last_name' => ['required'], - 'email' => ['required', 'email'] + 'last_name' => ['required'], + 'email' => ['required', 'email'], ]; - + protected $messages = []; - - public function users() { + + public function users() + { return $this->hasMany('\App\Models\User'); } - - public function orders() { + + public function orders() + { return $this->hasMany('\App\Models\Order'); } - - public function currency() { + + public function currency() + { return $this->hasOne('\App\Models\Currency'); } - public function getStripeApiKeyAttribute() { - if(Utils::isAttendize()) { + public function getStripeApiKeyAttribute() + { + if (Utils::isAttendize()) { return $this->stripe_access_token; } return $this->stripe_secret_key; } - - } diff --git a/app/Models/Activity.php b/app/Models/Activity.php index f1b22bbb..0cea7db9 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -1,14 +1,16 @@ -belongsTo('\App\Models\Order'); } - - public function ticket() { + + public function ticket() + { return $this->belongsTo('\App\Models\Ticket'); } - - public function event() { - return $this->belongsTo('\App\Models\Event'); + + public function event() + { + return $this->belongsTo('\App\Models\Event'); } - - - public function scopeWithoutCancelled($query) { + + public function scopeWithoutCancelled($query) + { return $query->where('attendees.is_cancelled', '=', 0); } - - public function getFullNameAttribute() { + + public function getFullNameAttribute() + { return $this->first_name.' '.$this->last_name; } - -// + +// // public function getReferenceAttribute() { // return $this->order->order_reference // } - - public function getDates() { - return array('created_at', 'updated_at', 'arrival_time'); - } - - /** - * Generate a private referennce number for the attendee. Use for checking in the attendee. - */ - public static function boot() { - parent::boot(); - static::creating(function($order) { - $order->private_reference_number = str_pad(rand(0, pow(10, 9)-1), 9, '0', STR_PAD_LEFT); - }); + public function getDates() + { + return ['created_at', 'updated_at', 'arrival_time']; } - + + /** + * Generate a private referennce number for the attendee. Use for checking in the attendee. + */ + public static function boot() + { + parent::boot(); + + static::creating(function ($order) { + $order->private_reference_number = str_pad(rand(0, pow(10, 9) - 1), 9, '0', STR_PAD_LEFT); + }); + } } diff --git a/app/Models/Currency.php b/app/Models/Currency.php index ac0e4bc0..deaca975 100644 --- a/app/Models/Currency.php +++ b/app/Models/Currency.php @@ -1,23 +1,25 @@ -belongsTo('\App\Models\Event'); - } - + public function event() + { + return $this->belongsTo('\App\Models\Event'); + } } diff --git a/app/Models/DateFormat.php b/app/Models/DateFormat.php index 0194c94a..0543b640 100644 --- a/app/Models/DateFormat.php +++ b/app/Models/DateFormat.php @@ -1,17 +1,18 @@ - array('required'), - 'description' => array('required'), - 'location_venue_name' => array('required_without:venue_name_full'), - 'venue_name_full' => array('required_without:location_venue_name'), - 'start_date' => array('required'), - 'end_date' => array('required'), - 'organiser_name' => array('required_without:organiser_id'), - 'event_image' => ['mimes:jpeg,jpg,png', 'max:3000'] - ); - protected $messages = array( - 'title.required' => 'You must at least give a title for your event.', - 'organiser_name.required_without' => 'Please create an organiser or select an existing organiser.', - 'event_image.mimes' => 'Please ensure you are uploading an image (JPG, PNG, JPEG)', - 'event_image.max' => 'Pleae ensure the image is not larger then 3MB', - 'location_venue_name.required_without' => 'Please enter a venue for your event', - 'venue_name_full.required_without' => 'Please enter a venue for your event' - ); - public function questions() { - return $this->belongsToMany('\App\Models\Question', 'event_question'); + protected $rules = [ + 'title' => ['required'], + 'description' => ['required'], + 'location_venue_name' => ['required_without:venue_name_full'], + 'venue_name_full' => ['required_without:location_venue_name'], + 'start_date' => ['required'], + 'end_date' => ['required'], + 'organiser_name' => ['required_without:organiser_id'], + 'event_image' => ['mimes:jpeg,jpg,png', 'max:3000'], + ]; + protected $messages = [ + 'title.required' => 'You must at least give a title for your event.', + 'organiser_name.required_without' => 'Please create an organiser or select an existing organiser.', + 'event_image.mimes' => 'Please ensure you are uploading an image (JPG, PNG, JPEG)', + 'event_image.max' => 'Pleae ensure the image is not larger then 3MB', + 'location_venue_name.required_without' => 'Please enter a venue for your event', + 'venue_name_full.required_without' => 'Please enter a venue for your event', + ]; + + public function questions() + { + return $this->belongsToMany('\App\Models\Question', 'event_question'); } - public function attendees() { + public function attendees() + { return $this->hasMany('\App\Models\Attendee'); } - - public function images() { + + public function images() + { return $this->hasMany('\App\Models\EventImage'); } - public function messages() { + + public function messages() + { return $this->hasMany('\App\Models\Message')->orderBy('created_at', 'DESC'); } - public function tickets() { + public function tickets() + { return $this->hasMany('\App\Models\Ticket'); } - - public function stats() { + + public function stats() + { return $this->hasMany('\App\Models\EventStats'); } - - public function affiliates() { + + public function affiliates() + { return $this->hasMany('\App\Models\Affiliate'); } - public function orders() { + public function orders() + { return $this->hasMany('\App\Models\Order'); } - public function account() { + public function account() + { return $this->belongsTo('\App\Models\Account'); } - public function currency() { + public function currency() + { return $this->belongsTo('\App\Models\Currency'); } - public function organiser() { + public function organiser() + { return $this->belongsTo('\App\Models\Organiser'); } - + /* * Getters & Setters */ - public function getEmbedUrlAttribute() { + public function getEmbedUrlAttribute() + { return str_replace(['http:', 'https:'], '', route('showEmbeddedEventPage', ['event' => $this->id])); } - public function getFixedFeeAttribute() { + public function getFixedFeeAttribute() + { return config('attendize.ticket_booking_fee_fixed') + $this->organiser_fee_fixed; } - public function getPercentageFeeAttribute() { + + public function getPercentageFeeAttribute() + { return config('attendize.ticket_booking_fee_percentage') + $this->organiser_fee_percentage; } - - public function getHappeningNowAttribute() { + + public function getHappeningNowAttribute() + { return Carbon::now()->between($this->start_date, $this->end_date); } - - public function getCurrencySymbolAttribute() { + + public function getCurrencySymbolAttribute() + { return $this->currency->symbol_left; } - public function getCurrencyCodeAttribute() { + + public function getCurrencyCodeAttribute() + { return $this->currency->code; } - - public function getEmbedHtmlCodeAttribute () { + + public function getEmbedHtmlCodeAttribute() + { return " "; } - + /* * Get a usable address for embedding Google Maps */ - public function getMapAddressAttribute() { - + public function getMapAddressAttribute() + { $string = $this->venue.',' .$this->location_street_number.',' .$this->location_address_line_1.',' @@ -114,26 +138,27 @@ class Event extends MyBaseModel { .$this->location_state.',' .$this->location_post_code.',' .$this->location_country; - + return urlencode($string); - } - - public function getBgImageUrlAttribute() { + + public function getBgImageUrlAttribute() + { return URL::to('/').'/'.$this->bg_image_path; } - - public function getEventUrlAttribute() { + + public function getEventUrlAttribute() + { return URL::to('/').'/e/'.$this->id.'/'.Str::slug($this->title); } - - public function getSalesAndFeesVoulmeAttribute() { + public function getSalesAndFeesVoulmeAttribute() + { return $this->sales_volume + $this->organiser_fees_volume; } - public function getDates() { - return array('created_at', 'updated_at', 'start_date', 'end_date'); + public function getDates() + { + return ['created_at', 'updated_at', 'start_date', 'end_date']; } - } diff --git a/app/Models/EventImage.php b/app/Models/EventImage.php index 858b7da0..811ce498 100644 --- a/app/Models/EventImage.php +++ b/app/Models/EventImage.php @@ -1,15 +1,16 @@ -ticket_revenue = $ticket->ticket_revenue + $amount; - + return $ticket->save(); } - - public function updateViewCount($event_id) { + public function updateViewCount($event_id) + { $stats = $this->firstOrNew([ 'event_id' => $event_id, - 'date' => DB::raw('CURDATE()') + 'date' => DB::raw('CURDATE()'), ]); - + $cookie_name = 'visitTrack_'.$event_id.'_'.date('dmy'); - - if(!Cookie::get($cookie_name)) { + + if (!Cookie::get($cookie_name)) { Cookie::queue($cookie_name, true, 60 * 24 * 14); ++$stats->unique_views; } - + ++$stats->views; return $stats->save(); } - + /* * TODO: Missing amount? */ - public function updateSalesVolume($event_id) { + public function updateSalesVolume($event_id) + { $stats = $this->firstOrNew([ 'event_id' => $event_id, - 'date' => DB::raw('CURDATE()') + 'date' => DB::raw('CURDATE()'), ]); - + $stats->sales_volume = $stats->sales_volume + $amount; - + return $stats->save(); } - - public function updateTicketsSoldCount($event_id, $count) { - + public function updateTicketsSoldCount($event_id, $count) + { $stats = $this->firstOrNew([ 'event_id' => $event_id, - 'date' => DB::raw('CURDATE()') + 'date' => DB::raw('CURDATE()'), ]); - + $stats->increment('tickets_sold', $count); return $stats->save(); } - } diff --git a/app/Models/Message.php b/app/Models/Message.php index 167b7e70..558e5de8 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -1,31 +1,36 @@ -belongsTo('\App\Models\Event'); } - - public function getRecipientsLabelAttribute() { - if($this->recipients == 0) { + + public function getRecipientsLabelAttribute() + { + if ($this->recipients == 0) { return 'All Attendees'; } - + $ticket = Ticket::scope()->find($this->recipients); + return 'Ticket: '.$ticket->title; } - - public function getDates() { - return array('created_at', 'updated_at', 'sent_at'); - } + public function getDates() + { + return ['created_at', 'updated_at', 'sent_at']; + } } diff --git a/app/Models/MyBaseModel.php b/app/Models/MyBaseModel.php index 52b20eb7..48cbf1b3 100644 --- a/app/Models/MyBaseModel.php +++ b/app/Models/MyBaseModel.php @@ -2,26 +2,28 @@ namespace App\Models; -use Auth, - Validator; +use Auth; +use Validator; /* * Adapted from: https://github.com/hillelcoren/invoice-ninja/blob/master/app/models/EntityModel.php */ -class MyBaseModel extends \Illuminate\Database\Eloquent\Model { - +class MyBaseModel extends \Illuminate\Database\Eloquent\Model +{ protected $softDelete = true; public $timestamps = true; - protected $rules = array(); - protected $messages = array(); + protected $rules = []; + protected $messages = []; protected $errors; - public function validate($data) { + public function validate($data) + { $v = Validator::make($data, $this->rules, $this->messages); if ($v->fails()) { $this->errors = $v->messages(); + return false; } @@ -29,30 +31,30 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model { return true; } - public function errors($returnArray = TRUE) { + public function errors($returnArray = true) + { return $returnArray ? $this->errors->toArray() : $this->errors; } /** - * - * @param int $account_id - * @param int $user_id + * @param int $account_id + * @param int $user_id * @param bool $ignore_user_id + * * @return \className */ - public static function createNew($account_id = FALSE, $user_id = FALSE, $ignore_user_id = FALSE) { + public static function createNew($account_id = false, $user_id = false, $ignore_user_id = false) + { $className = get_called_class(); $entity = new $className(); if (Auth::check()) { - if (!$ignore_user_id) { $entity->user_id = Auth::user()->id; } $entity->account_id = Auth::user()->account_id; - } else if ($account_id || $user_id) { - + } elseif ($account_id || $user_id) { if ($user_id && !$ignore_user_id) { $entity->user_id = $user_id; } @@ -65,16 +67,17 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model { return $entity; } - public function getFormatedDate($field, $format = 'd-m-Y H:i') { - return $this->$field === NULL ? NULL : date($format, strtotime($this->$field)); + public function getFormatedDate($field, $format = 'd-m-Y H:i') + { + return $this->$field === null ? null : date($format, strtotime($this->$field)); } /** - * * @param int $accountId */ - public function scopeScope($query, $accountId = false) { - + public function scopeScope($query, $accountId = false) + { + /* * GOD MODE - DON'T UNCOMMENT! * returning $query before adding the account_id condition will let you @@ -82,18 +85,16 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model { * //return $query; */ - if (!$accountId) { $accountId = Auth::user()->account_id; } $table = $this->getTable(); - $query->where(function($query) use ($accountId, $table) { - $query->whereRaw(\DB::raw('(' . $table . '.account_id = ' . $accountId . ')')); + $query->where(function ($query) use ($accountId, $table) { + $query->whereRaw(\DB::raw('('.$table.'.account_id = '.$accountId.')')); }); return $query; } - } diff --git a/app/Models/Order.php b/app/Models/Order.php index 381b3223..7b9fca19 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -2,84 +2,94 @@ namespace App\Models; +use File; use Illuminate\Database\Eloquent\SoftDeletes; use PDF; -use File; - -class Order extends MyBaseModel { +class Order extends MyBaseModel +{ use SoftDeletes; public $rules = [ 'order_first_name' => ['required'], - 'order_last_name' => ['required'], - 'order_email' => ['required', 'email'], + 'order_last_name' => ['required'], + 'order_email' => ['required', 'email'], ]; public $messages = [ 'order_first_name.required' => 'Please enter a valid first name', - 'order_last_name.required' => 'Please enter a valid last name', - 'order_email.email' => 'Please enter a valid email', + 'order_last_name.required' => 'Please enter a valid last name', + 'order_email.email' => 'Please enter a valid email', ]; - public function orderItems() { + public function orderItems() + { return $this->hasMany('\App\Models\OrderItem'); } - public function attendees() { + public function attendees() + { return $this->hasMany('\App\Models\Attendee'); } - public function account() { + public function account() + { return $this->belongsTo('\App\Models\Account'); } - public function event() { + public function event() + { return $this->belongsTo('\App\Models\Event'); } - public function tickets() { + public function tickets() + { return $this->hasMany('\App\Models\Ticket'); } - public function orderStatus() { + public function orderStatus() + { return $this->belongsTo('\App\Models\OrderStatus'); } - public function getOrganiserAmountAttribute() { + public function getOrganiserAmountAttribute() + { return $this->amount + $this->organiser_booking_fee; } - public function getTotalAmountAttribute() { + public function getTotalAmountAttribute() + { return $this->amount + $this->organiser_booking_fee + $this->booking_fee; } - public function getFullNameAttribute() { - return $this->first_name . ' ' . $this->last_name; + public function getFullNameAttribute() + { + return $this->first_name.' '.$this->last_name; } /** - * Generate and save the PDF tickets - * + * Generate and save the PDF tickets. + * * @todo Move this from the order model - * @return boolean + * + * @return bool */ - public function generatePdfTickets() { - + public function generatePdfTickets() + { $data = [ - 'order' => $this, - 'event' => $this->event, - 'tickets' => $this->event->tickets, - 'attendees' => $this->attendees + 'order' => $this, + 'event' => $this->event, + 'tickets' => $this->event->tickets, + 'attendees' => $this->attendees, ]; - $pdf_file_path = public_path(config('attendize.event_pdf_tickets_path')) . '/' . $this->order_reference; - $pdf_file = $pdf_file_path.'.pdf'; - + $pdf_file_path = public_path(config('attendize.event_pdf_tickets_path')).'/'.$this->order_reference; + $pdf_file = $pdf_file_path.'.pdf'; + if (file_exists($pdf_file)) { return true; } - - if(!is_dir($pdf_file_path)) { + + if (!is_dir($pdf_file_path)) { File::makeDirectory($pdf_file_path, 0777, true, true); } @@ -92,12 +102,12 @@ class Order extends MyBaseModel { return file_exists($pdf_file); } - public static function boot() { + public static function boot() + { parent::boot(); - static::creating(function($order) { - $order->order_reference = strtoupper(str_random(5)) . date('jn'); + static::creating(function ($order) { + $order->order_reference = strtoupper(str_random(5)).date('jn'); }); } - } diff --git a/app/Models/OrderItem.php b/app/Models/OrderItem.php index b203436c..0802f08f 100644 --- a/app/Models/OrderItem.php +++ b/app/Models/OrderItem.php @@ -1,15 +1,17 @@ - array('required'), - 'email' => array('required', 'email'), - 'organiser_logo' => ['mimes:jpeg,jpg,png', 'max:10000'] - ); - protected $messages = array( - 'name.required' => 'You must at least give a name for the event organiser.', - 'organiser_logo.max' => 'Please upload an image smaller than 10Mb', - 'organiser_logo.size' => 'Please upload an image smaller than 10Mb', - 'organiser_logo.mimes' => 'Please select a valid image type (jpeg, jpg, png)' - ); - - public function events() { +class Organiser extends MyBaseModel +{ + protected $rules = [ + 'name' => ['required'], + 'email' => ['required', 'email'], + 'organiser_logo' => ['mimes:jpeg,jpg,png', 'max:10000'], + ]; + protected $messages = [ + 'name.required' => 'You must at least give a name for the event organiser.', + 'organiser_logo.max' => 'Please upload an image smaller than 10Mb', + 'organiser_logo.size' => 'Please upload an image smaller than 10Mb', + 'organiser_logo.mimes' => 'Please select a valid image type (jpeg, jpg, png)', + ]; + + public function events() + { return $this->hasMany('\App\Models\Event'); } - - public function attendees() { + + public function attendees() + { return $this->hasManyThrough('\App\Models\Attendee', '\App\Models\Event'); } - - public function getFullLogoPathAttribute() { - if($this->logo_path && (file_exists(config('attendize.cdn_url_user_assets').'/'.$this->logo_path) || file_exists(public_path($this->logo_path)))) { + + public function getFullLogoPathAttribute() + { + if ($this->logo_path && (file_exists(config('attendize.cdn_url_user_assets').'/'.$this->logo_path) || file_exists(public_path($this->logo_path)))) { return config('attendize.cdn_url_user_assets').'/'.$this->logo_path; } - + return config('attendize.fallback_organiser_logo_url'); } - public function getOrganiserUrlAttribute() { + public function getOrganiserUrlAttribute() + { return route('showOrganiserHome', [ - 'organiser_id' => $this->id, - 'organiser_slug' => Str::slug($this->oraganiser_name) + 'organiser_id' => $this->id, + 'organiser_slug' => Str::slug($this->oraganiser_name), ]); } - public function getOrganiserSalesVolumeAttribute() { + public function getOrganiserSalesVolumeAttribute() + { return $this->events->sum('sales_volume'); } - - public function getDailyStats() { - - - + public function getDailyStats() + { } - - - } diff --git a/app/Models/PaymentGateway.php b/app/Models/PaymentGateway.php index 6a220824..851cf0f0 100644 --- a/app/Models/PaymentGateway.php +++ b/app/Models/PaymentGateway.php @@ -1,14 +1,17 @@ -belongsToMany('\App\Models\Event'); } - - - public function question_types() { + + public function question_types() + { return $this->hasOne('\App\Models\QuestionType'); } - } diff --git a/app/Models/QuestionType.php b/app/Models/QuestionType.php index 3c49d979..4976fa6a 100644 --- a/app/Models/QuestionType.php +++ b/app/Models/QuestionType.php @@ -1,7 +1,7 @@ - array('required'), - 'price' => array('required', 'numeric', 'min:0'), - 'start_sale_date' => array('date'), - 'end_sale_date' => array('date', 'after:start_sale_date'), - 'quantity_available' => ['integer', 'min:0'] + 'title' => ['required'], + 'price' => ['required', 'numeric', 'min:0'], + 'start_sale_date' => ['date'], + 'end_sale_date' => ['date', 'after:start_sale_date'], + 'quantity_available' => ['integer', 'min:0'], ]; public $messages = [ - 'price.numeric' => 'The price must be a valid number (e.g 12.50)', - 'title.required' => 'You must at least give a title for your ticket. (e.g Early Bird)', - 'quantity_available.integer' => 'Please ensure the quantity available is a number.' + 'price.numeric' => 'The price must be a valid number (e.g 12.50)', + 'title.required' => 'You must at least give a title for your ticket. (e.g Early Bird)', + 'quantity_available.integer' => 'Please ensure the quantity available is a number.', ]; - public function event() { + public function event() + { return $this->belongsTo('\App\Models\Event'); } - public function order() { + public function order() + { return $this->belongsToMany('\App\Models\Order'); } - public function questions() { + public function questions() + { return $this->belongsToMany('\App\Models\Question', 'ticket_question'); } - - public function reserved() { - + + public function reserved() + { } - public function scopeSoldOut($query) { + public function scopeSoldOut($query) + { $query->where('remaining_tickets', '=', 0); } @@ -43,104 +49,97 @@ class Ticket extends MyBaseModel { * Getters & Setters */ - public function getDates() { - return array('created_at', 'updated_at', 'start_sale_date', 'end_sale_date'); + public function getDates() + { + return ['created_at', 'updated_at', 'start_sale_date', 'end_sale_date']; } - public function getQuantityRemainingAttribute() { - - if(is_null($this->quantity_available)) { + public function getQuantityRemainingAttribute() + { + if (is_null($this->quantity_available)) { return 9999; //Better way to do this? } - + return $this->quantity_available - ($this->quantity_sold + $this->quantity_reserved); } - - public function getQuantityReservedAttribute() { + public function getQuantityReservedAttribute() + { $reserved_total = \DB::table('reserved_tickets') ->where('ticket_id', $this->id) ->where('expires', '>', \Carbon::now()) ->sum('quantity_reserved'); - return $reserved_total; } - - - public function getBookingFeeAttribute () { - return (int)ceil($this->price) === 0 ? 0 : round(($this->price * (config('attendize.ticket_booking_fee_percentage') / 100)) + (config('attendize.ticket_booking_fee_fixed')), 2); + + public function getBookingFeeAttribute() + { + return (int) ceil($this->price) === 0 ? 0 : round(($this->price * (config('attendize.ticket_booking_fee_percentage') / 100)) + (config('attendize.ticket_booking_fee_fixed')), 2); } - - public function getOrganiserBookingFeeAttribute() { - return (int)ceil($this->price) === 0 ? 0 : round(($this->price * ($this->event->organiser_fee_percentage / 100)) + ($this->event->organiser_fee_fixed), 2); + + public function getOrganiserBookingFeeAttribute() + { + return (int) ceil($this->price) === 0 ? 0 : round(($this->price * ($this->event->organiser_fee_percentage / 100)) + ($this->event->organiser_fee_fixed), 2); } - - public function getTotalBookingFeeAttribute() { + + public function getTotalBookingFeeAttribute() + { return $this->getBookingFeeAttribute() + $this->getOrganiserBookingFeeAttribute(); } - - public function getTotalPriceAttribute() { + + public function getTotalPriceAttribute() + { return $this->getTotalBookingFeeAttribute() + $this->price; } - - public function getTicketMaxMinRangAttribute() { + + public function getTicketMaxMinRangAttribute() + { $range = []; - - for($i=$this->min_per_person; $i<=$this->max_per_person; $i++) { + + for ($i = $this->min_per_person; $i <= $this->max_per_person; $i++) { $range[] = [$i => $i]; } - + return $range; } - - public function isFree() { - return (int)ceil($this->price) === 0; + public function isFree() + { + return (int) ceil($this->price) === 0; } - - /** - * Return the maximum figure to go to on dropdowns - * - * @return int - public function getMaxPerPersonMaxValueAttribute() { - return $this->max_per_person === -1 ? config('attendize.max_tickets_per_person') : $this->max_per_person; - } + /** + * Return the maximum figure to go to on dropdowns. + * + * @return int */ - public function getSaleStatusAttribute() { - - if ($this->start_sale_date !== NULL) { + public function getSaleStatusAttribute() + { + if ($this->start_sale_date !== null) { if ($this->start_sale_date->isFuture()) { return config('attendize.ticket_status_before_sale_date'); } } - - - if ($this->end_sale_date !== NULL) { + if ($this->end_sale_date !== null) { if ($this->end_sale_date->isPast()) { return config('attendize.ticket_status_after_sale_date'); } } - if ((int)$this->quantity_available > 0) { - if ((int)$this->quantity_remaining <= 0) { + if ((int) $this->quantity_available > 0) { + if ((int) $this->quantity_remaining <= 0) { return config('attendize.ticket_status_sold_out'); } } - if($this->event->start_date->lte(\Carbon::now())) { + if ($this->event->start_date->lte(\Carbon::now())) { return config('attendize.ticket_status_off_sale'); } - + return config('attendize.ticket_status_on_sale'); } - - - - - // public function setQuantityAvailableAttribute($value) { // $this->attributes['quantity_available'] = trim($value) == '' ? -1 : $value; @@ -149,5 +148,4 @@ class Ticket extends MyBaseModel { // public function setMaxPerPersonAttribute($value) { // $this->attributes['max_per_person'] = trim($value) == '' ? -1 : $value; // } - } diff --git a/app/Models/TicketStatus.php b/app/Models/TicketStatus.php index c60e4968..b53acaee 100644 --- a/app/Models/TicketStatus.php +++ b/app/Models/TicketStatus.php @@ -1,14 +1,17 @@ -belongsTo('\App\Models\Account'); } - public function activity() { + public function activity() + { return $this->hasMany('\App\Models\Activity'); } @@ -39,7 +42,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon * * @return mixed */ - public function getAuthIdentifier() { + public function getAuthIdentifier() + { return $this->getKey(); } @@ -48,7 +52,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon * * @return string */ - public function getAuthPassword() { + public function getAuthPassword() + { return $this->password; } @@ -57,28 +62,32 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon * * @return string */ - public function getReminderEmail() { + public function getReminderEmail() + { return $this->email; } - public function getRememberToken() { + public function getRememberToken() + { return $this->remember_token; } - public function setRememberToken($value) { + public function setRememberToken($value) + { $this->remember_token = $value; } - public function getRememberTokenName() { + public function getRememberTokenName() + { return 'remember_token'; } - - public static function boot() { + + public static function boot() + { parent::boot(); - static::creating(function($user) { + static::creating(function ($user) { $user->confirmation_code = str_random(); }); } - } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a4d90618..f7f38140 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,19 +3,16 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; -use Request; -use App\Models\Organiser; -use Auth; - -class AppServiceProvider extends ServiceProvider { +class AppServiceProvider extends ServiceProvider +{ /** * Bootstrap any application services. * * @return void */ - public function boot() { - + public function boot() + { require app_path('Attendize/constants.php'); } @@ -28,15 +25,10 @@ class AppServiceProvider extends ServiceProvider { * * @return void */ - public function register() { - - - + public function register() + { $this->app->bind( 'Illuminate\Contracts\Auth\Registrar', 'App\Services\Registrar' ); - } - - } diff --git a/app/Providers/BusServiceProvider.php b/app/Providers/BusServiceProvider.php index f0d9be6f..c676fca7 100644 --- a/app/Providers/BusServiceProvider.php +++ b/app/Providers/BusServiceProvider.php @@ -1,34 +1,35 @@ -mapUsing(function($command) - { - return Dispatcher::simpleMapping( - $command, 'App\Commands', 'App\Handlers\Commands' - ); - }); - } - - /** - * Register any application services. - * - * @return void - */ - public function register() - { - // - } +class BusServiceProvider extends ServiceProvider +{ + /** + * Bootstrap any application services. + * + * @param \Illuminate\Bus\Dispatcher $dispatcher + * + * @return void + */ + public function boot(Dispatcher $dispatcher) + { + $dispatcher->mapUsing(function ($command) { + return Dispatcher::simpleMapping( + $command, 'App\Commands', 'App\Handlers\Commands' + ); + }); + } + /** + * Register any application services. + * + * @return void + */ + public function register() + { + // + } } diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php index 06e57992..74133070 100644 --- a/app/Providers/ConfigServiceProvider.php +++ b/app/Providers/ConfigServiceProvider.php @@ -1,23 +1,24 @@ - [ + 'EventListener', + ], + ]; - /** - * The event handler mappings for the application. - * - * @var array - */ - protected $listen = [ - 'event.name' => [ - 'EventListener', - ], - ]; - - /** - * Register any other events for your application. - * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void - */ - public function boot(DispatcherContract $events) - { - parent::boot($events); - - // - } + /** + * Register any other events for your application. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * + * @return void + */ + public function boot(DispatcherContract $events) + { + parent::boot($events); + // + } } diff --git a/app/Providers/HelpersServiceProvider.php b/app/Providers/HelpersServiceProvider.php index 8aba8832..17cc1faf 100644 --- a/app/Providers/HelpersServiceProvider.php +++ b/app/Providers/HelpersServiceProvider.php @@ -1,28 +1,28 @@ -group(['namespace' => $this->namespace], function($router) - { - require app_path('Http/routes.php'); - }); - } + // + } + /** + * Define the routes for the application. + * + * @param \Illuminate\Routing\Router $router + * + * @return void + */ + public function map(Router $router) + { + $router->group(['namespace' => $this->namespace], function ($router) { + require app_path('Http/routes.php'); + }); + } } diff --git a/app/Services/Registrar.php b/app/Services/Registrar.php index 10354681..0e9db762 100644 --- a/app/Services/Registrar.php +++ b/app/Services/Registrar.php @@ -1,39 +1,42 @@ - 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|confirmed|min:6', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @param array $data - * @return User - */ - public function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } +class Registrar implements RegistrarContract +{ + /** + * Get a validator for an incoming registration request. + * + * @param array $data + * + * @return \Illuminate\Contracts\Validation\Validator + */ + public function validator(array $data) + { + return Validator::make($data, [ + 'name' => 'required|max:255', + 'email' => 'required|email|max:255|unique:users', + 'password' => 'required|confirmed|min:6', + ]); + } + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * + * @return User + */ + public function create(array $data) + { + return User::create([ + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => bcrypt($data['password']), + ]); + } } diff --git a/bootstrap/app.php b/bootstrap/app.php index f50a3f72..22712ffe 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -12,7 +12,7 @@ */ $app = new Illuminate\Foundation\Application( - realpath(__DIR__.'/../') + realpath(__DIR__.'/../') ); /* @@ -27,18 +27,18 @@ $app = new Illuminate\Foundation\Application( */ $app->singleton( - 'Illuminate\Contracts\Http\Kernel', - 'App\Http\Kernel' + 'Illuminate\Contracts\Http\Kernel', + 'App\Http\Kernel' ); $app->singleton( - 'Illuminate\Contracts\Console\Kernel', - 'App\Console\Kernel' + 'Illuminate\Contracts\Console\Kernel', + 'App\Console\Kernel' ); $app->singleton( - 'Illuminate\Contracts\Debug\ExceptionHandler', - 'App\Exceptions\Handler' + 'Illuminate\Contracts\Debug\ExceptionHandler', + 'App\Exceptions\Handler' ); /* diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 2c35b3fc..38301379 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -29,7 +29,6 @@ require __DIR__.'/../vendor/autoload.php'; $compiledPath = __DIR__.'/cache/compiled.php'; -if (file_exists($compiledPath)) -{ - require $compiledPath; +if (file_exists($compiledPath)) { + require $compiledPath; } diff --git a/config/Wkhtml2pdf.php b/config/Wkhtml2pdf.php index 59a3603e..20c6dad2 100644 --- a/config/Wkhtml2pdf.php +++ b/config/Wkhtml2pdf.php @@ -1,9 +1,9 @@ false, - 'binpath' => 'lib/', - 'binfile' => 'wkhtmltopdf-amd64', - 'output_mode' => 'I' -); \ No newline at end of file + 'debug' => false, + 'binpath' => 'lib/', + 'binfile' => 'wkhtmltopdf-amd64', + 'output_mode' => 'I', +]; diff --git a/config/app.php b/config/app.php index 51404c96..cdf7e73b 100644 --- a/config/app.php +++ b/config/app.php @@ -68,7 +68,7 @@ return [ | will not be safe. Please do this before deploying an application! | */ - 'key' => env('APP_KEY', 'SomeRandomString'), + 'key' => env('APP_KEY', 'SomeRandomString'), 'cipher' => MCRYPT_RIJNDAEL_128, /* |-------------------------------------------------------------------------- @@ -141,8 +141,6 @@ return [ 'App\Providers\RouteServiceProvider', 'App\Providers\HelpersServiceProvider', - - ], /* |-------------------------------------------------------------------------- @@ -156,55 +154,55 @@ return [ */ 'aliases' => [ - 'App' => 'Illuminate\Support\Facades\App', - 'Artisan' => 'Illuminate\Support\Facades\Artisan', - 'Auth' => 'Illuminate\Support\Facades\Auth', - 'Blade' => 'Illuminate\Support\Facades\Blade', - 'Bus' => 'Illuminate\Support\Facades\Bus', - 'Cache' => 'Illuminate\Support\Facades\Cache', - 'Config' => 'Illuminate\Support\Facades\Config', - 'Cookie' => 'Illuminate\Support\Facades\Cookie', - 'Crypt' => 'Illuminate\Support\Facades\Crypt', - 'DB' => 'Illuminate\Support\Facades\DB', + 'App' => 'Illuminate\Support\Facades\App', + 'Artisan' => 'Illuminate\Support\Facades\Artisan', + 'Auth' => 'Illuminate\Support\Facades\Auth', + 'Blade' => 'Illuminate\Support\Facades\Blade', + 'Bus' => 'Illuminate\Support\Facades\Bus', + 'Cache' => 'Illuminate\Support\Facades\Cache', + 'Config' => 'Illuminate\Support\Facades\Config', + 'Cookie' => 'Illuminate\Support\Facades\Cookie', + 'Crypt' => 'Illuminate\Support\Facades\Crypt', + 'DB' => 'Illuminate\Support\Facades\DB', 'Eloquent' => 'Illuminate\Database\Eloquent\Model', /* * changed Event alias to LaravelEvent as there was a conflict * If something blows up it could be because of this */ - 'LaravelEvent' => 'Illuminate\Support\Facades\Event', - 'File' => 'Illuminate\Support\Facades\File', - 'Hash' => 'Illuminate\Support\Facades\Hash', - 'Input' => 'Illuminate\Support\Facades\Input', - 'Inspiring' => 'Illuminate\Foundation\Inspiring', - 'Lang' => 'Illuminate\Support\Facades\Lang', - 'Log' => 'Illuminate\Support\Facades\Log', - 'Mail' => 'Illuminate\Support\Facades\Mail', - 'Password' => 'Illuminate\Support\Facades\Password', - 'Queue' => 'Illuminate\Support\Facades\Queue', - 'Redirect' => 'Illuminate\Support\Facades\Redirect', - 'Redis' => 'Illuminate\Support\Facades\Redis', - 'Request' => 'Illuminate\Support\Facades\Request', - 'Response' => 'Illuminate\Support\Facades\Response', - 'Route' => 'Illuminate\Support\Facades\Route', - 'Schema' => 'Illuminate\Support\Facades\Schema', - 'Session' => 'Illuminate\Support\Facades\Session', - 'Storage' => 'Illuminate\Support\Facades\Storage', - 'URL' => 'Illuminate\Support\Facades\URL', - 'Validator' => 'Illuminate\Support\Facades\Validator', - 'View' => 'Illuminate\Support\Facades\View', - 'Form' => 'Illuminate\Html\FormFacade', - 'HTML' => 'Illuminate\Html\HtmlFacade', - 'Str' => 'Illuminate\Support\Str', - 'Utils' => 'App\Attendize\Utils', - 'Carbon' => 'Carbon\Carbon', - 'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf', - 'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade', - 'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade', - 'Image' => 'Intervention\Image\Facades\Image', - 'Excel' => 'Maatwebsite\Excel\Facades\Excel', - 'Socialize' => 'Laravel\Socialite\Facades\Socialite', - 'HttpClient' => 'Vinelab\Http\Facades\Client', - 'Purifier' => 'Mews\Purifier\Facades\Purifier', + 'LaravelEvent' => 'Illuminate\Support\Facades\Event', + 'File' => 'Illuminate\Support\Facades\File', + 'Hash' => 'Illuminate\Support\Facades\Hash', + 'Input' => 'Illuminate\Support\Facades\Input', + 'Inspiring' => 'Illuminate\Foundation\Inspiring', + 'Lang' => 'Illuminate\Support\Facades\Lang', + 'Log' => 'Illuminate\Support\Facades\Log', + 'Mail' => 'Illuminate\Support\Facades\Mail', + 'Password' => 'Illuminate\Support\Facades\Password', + 'Queue' => 'Illuminate\Support\Facades\Queue', + 'Redirect' => 'Illuminate\Support\Facades\Redirect', + 'Redis' => 'Illuminate\Support\Facades\Redis', + 'Request' => 'Illuminate\Support\Facades\Request', + 'Response' => 'Illuminate\Support\Facades\Response', + 'Route' => 'Illuminate\Support\Facades\Route', + 'Schema' => 'Illuminate\Support\Facades\Schema', + 'Session' => 'Illuminate\Support\Facades\Session', + 'Storage' => 'Illuminate\Support\Facades\Storage', + 'URL' => 'Illuminate\Support\Facades\URL', + 'Validator' => 'Illuminate\Support\Facades\Validator', + 'View' => 'Illuminate\Support\Facades\View', + 'Form' => 'Illuminate\Html\FormFacade', + 'HTML' => 'Illuminate\Html\HtmlFacade', + 'Str' => 'Illuminate\Support\Str', + 'Utils' => 'App\Attendize\Utils', + 'Carbon' => 'Carbon\Carbon', + 'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf', + 'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade', + 'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade', + 'Image' => 'Intervention\Image\Facades\Image', + 'Excel' => 'Maatwebsite\Excel\Facades\Excel', + 'Socialize' => 'Laravel\Socialite\Facades\Socialite', + 'HttpClient' => 'Vinelab\Http\Facades\Client', + 'Purifier' => 'Mews\Purifier\Facades\Purifier', 'Markdown' => 'MaxHoffmann\Parsedown\ParsedownFacade', ], diff --git a/config/attendize.php b/config/attendize.php index 9e8b21c0..3ace731e 100644 --- a/config/attendize.php +++ b/config/attendize.php @@ -17,14 +17,14 @@ return [ 'fallback_organiser_logo_url' => '/assets/images/logo-100x100-lightBg.png', 'cdn_url' => '', - 'max_tickets_per_person' => 30, #Depreciated - 'checkout_timeout_after' => 8, #mintutes + 'max_tickets_per_person' => 30, //Depreciated + 'checkout_timeout_after' => 8, //mintutes 'ticket_status_sold_out' => 1, - 'ticket_status_after_sale_date' => 2, + 'ticket_status_after_sale_date' => 2, 'ticket_status_before_sale_date' => 3, 'ticket_status_on_sale' => 4, - 'ticket_status_off_sale' => 5, + 'ticket_status_off_sale' => 5, 'ticket_booking_fee_fixed' => 0, 'ticket_booking_fee_percentage' => 0, @@ -34,14 +34,14 @@ return [ 'order_partially_refunded' => 3, 'order_cancelled' => 4, - 'default_timezone' => 30, #Europe/Dublin - 'default_currency' => 2, #Euro + 'default_timezone' => 30, //Europe/Dublin + 'default_currency' => 2, //Euro 'default_date_format' => 'j M, Y', 'default_date_picker_format' => 'd M, yyyy', 'default_datetime_format' => 'F j, Y, g:i a', - 'default_query_cache' => 120, #Minutes + 'default_query_cache' => 120, //Minutes 'default_locale' => 'en', 'cdn_url_user_assets' => '', - 'cdn_url_static_assets' => '' + 'cdn_url_static_assets' => '', ]; diff --git a/config/auth.php b/config/auth.php index 914949f7..9eadb35f 100644 --- a/config/auth.php +++ b/config/auth.php @@ -2,66 +2,66 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Authentication Driver - |-------------------------------------------------------------------------- - | - | This option controls the authentication driver that will be utilized. - | This driver manages the retrieval and authentication of the users - | attempting to get access to protected areas of your application. - | - | Supported: "database", "eloquent" - | - */ + /* + |-------------------------------------------------------------------------- + | Default Authentication Driver + |-------------------------------------------------------------------------- + | + | This option controls the authentication driver that will be utilized. + | This driver manages the retrieval and authentication of the users + | attempting to get access to protected areas of your application. + | + | Supported: "database", "eloquent" + | + */ - 'driver' => 'eloquent', + 'driver' => 'eloquent', - /* - |-------------------------------------------------------------------------- - | Authentication Model - |-------------------------------------------------------------------------- - | - | When using the "Eloquent" authentication driver, we need to know which - | Eloquent model should be used to retrieve your users. Of course, it - | is often just the "User" model but you may use whatever you like. - | - */ + /* + |-------------------------------------------------------------------------- + | Authentication Model + |-------------------------------------------------------------------------- + | + | When using the "Eloquent" authentication driver, we need to know which + | Eloquent model should be used to retrieve your users. Of course, it + | is often just the "User" model but you may use whatever you like. + | + */ - 'model' => 'App\Models\User', + 'model' => 'App\Models\User', - /* - |-------------------------------------------------------------------------- - | Authentication Table - |-------------------------------------------------------------------------- - | - | When using the "Database" authentication driver, we need to know which - | table should be used to retrieve your users. We have chosen a basic - | default value but you may easily change it to any table you like. - | - */ + /* + |-------------------------------------------------------------------------- + | Authentication Table + |-------------------------------------------------------------------------- + | + | When using the "Database" authentication driver, we need to know which + | table should be used to retrieve your users. We have chosen a basic + | default value but you may easily change it to any table you like. + | + */ - 'table' => 'users', + 'table' => 'users', - /* - |-------------------------------------------------------------------------- - | Password Reset Settings - |-------------------------------------------------------------------------- - | - | Here you may set the options for resetting passwords including the view - | that is your password reset e-mail. You can also set the name of the - | table that maintains all of the reset tokens for your application. - | - | The expire time is the number of minutes that the reset token should be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - */ + /* + |-------------------------------------------------------------------------- + | Password Reset Settings + |-------------------------------------------------------------------------- + | + | Here you may set the options for resetting passwords including the view + | that is your password reset e-mail. You can also set the name of the + | table that maintains all of the reset tokens for your application. + | + | The expire time is the number of minutes that the reset token should be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + */ - 'password' => [ - 'email' => 'Emails.Auth.Reminder', - 'table' => 'password_resets', - 'expire' => 60, - ], + 'password' => [ + 'email' => 'Emails.Auth.Reminder', + 'table' => 'password_resets', + 'expire' => 60, + ], ]; diff --git a/config/barcode.php b/config/barcode.php index 6fc229f3..d012466b 100644 --- a/config/barcode.php +++ b/config/barcode.php @@ -1,5 +1,5 @@ public_path("/"), + 'store_path' => public_path('/'), ]; diff --git a/config/cache.php b/config/cache.php index 9ddd5f33..103100ac 100644 --- a/config/cache.php +++ b/config/cache.php @@ -2,78 +2,78 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Cache Store - |-------------------------------------------------------------------------- - | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Cache Store + |-------------------------------------------------------------------------- + | + | This option controls the default cache connection that gets used while + | using this caching library. This connection is used when another is + | not explicitly specified when executing a given caching function. + | + */ - 'default' => env('CACHE_DRIVER', 'file'), + 'default' => env('CACHE_DRIVER', 'file'), - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - */ + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + */ - 'stores' => [ + 'stores' => [ - 'apc' => [ - 'driver' => 'apc' - ], + 'apc' => [ + 'driver' => 'apc', + ], - 'array' => [ - 'driver' => 'array' - ], + 'array' => [ + 'driver' => 'array', + ], - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - ], + 'database' => [ + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, + ], - 'file' => [ - 'driver' => 'file', - 'path' => storage_path().'/framework/cache', - ], + 'file' => [ + 'driver' => 'file', + 'path' => storage_path().'/framework/cache', + ], - 'memcached' => [ - 'driver' => 'memcached', - 'servers' => [ - [ - 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100 - ], - ], - ], + 'memcached' => [ + 'driver' => 'memcached', + 'servers' => [ + [ + 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100, + ], + ], + ], - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. - | - */ + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing a RAM based store such as APC or Memcached, there might + | be other applications utilizing the same cache. So, we'll specify a + | value to get prefixed to all our keys so we can avoid collisions. + | + */ - 'prefix' => 'laravel', + 'prefix' => 'laravel', ]; diff --git a/config/compile.php b/config/compile.php index 3a002fca..2f00654e 100644 --- a/config/compile.php +++ b/config/compile.php @@ -2,40 +2,40 @@ return [ - /* - |-------------------------------------------------------------------------- - | Additional Compiled Classes - |-------------------------------------------------------------------------- - | - | Here you may specify additional classes to include in the compiled file - | generated by the `artisan optimize` command. These should be classes - | that are included on basically every request into the application. - | - */ + /* + |-------------------------------------------------------------------------- + | Additional Compiled Classes + |-------------------------------------------------------------------------- + | + | Here you may specify additional classes to include in the compiled file + | generated by the `artisan optimize` command. These should be classes + | that are included on basically every request into the application. + | + */ - 'files' => [ + 'files' => [ - realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'), - realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'), - realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'), - realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'), - realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'), + realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'), + realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'), + realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'), + realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'), + realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'), - ], + ], - /* - |-------------------------------------------------------------------------- - | Compiled File Providers - |-------------------------------------------------------------------------- - | - | Here you may list service providers which define a "compiles" function - | that returns additional files that should be compiled, providing an - | easy way to get common files from any packages you are utilizing. - | - */ + /* + |-------------------------------------------------------------------------- + | Compiled File Providers + |-------------------------------------------------------------------------- + | + | Here you may list service providers which define a "compiles" function + | that returns additional files that should be compiled, providing an + | easy way to get common files from any packages you are utilizing. + | + */ - 'providers' => [ - // - ], + 'providers' => [ + // + ], ]; diff --git a/config/database.php b/config/database.php index c47f6bc0..45413b8e 100644 --- a/config/database.php +++ b/config/database.php @@ -2,124 +2,124 @@ return [ - /* - |-------------------------------------------------------------------------- - | PDO Fetch Style - |-------------------------------------------------------------------------- - | - | By default, database results will be returned as instances of the PHP - | stdClass object; however, you may desire to retrieve records in an - | array format for simplicity. Here you can tweak the fetch style. - | - */ + /* + |-------------------------------------------------------------------------- + | PDO Fetch Style + |-------------------------------------------------------------------------- + | + | By default, database results will be returned as instances of the PHP + | stdClass object; however, you may desire to retrieve records in an + | array format for simplicity. Here you can tweak the fetch style. + | + */ - 'fetch' => PDO::FETCH_CLASS, + 'fetch' => PDO::FETCH_CLASS, - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Database Connection Name + |-------------------------------------------------------------------------- + | + | Here you may specify which of the database connections below you wish + | to use as your default connection for all database work. Of course + | you may use many connections at once using the Database library. + | + */ - 'default' => 'mysql', + 'default' => 'mysql', - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ - 'connections' => [ + 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => storage_path().'/database.sqlite', - 'prefix' => '', - ], + 'sqlite' => [ + 'driver' => 'sqlite', + 'database' => storage_path().'/database.sqlite', + 'prefix' => '', + ], - 'mysql' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST'), - 'database' => env('DB_DATABASE'), - 'username' => env('DB_USERNAME'), - 'password' => env('DB_PASSWORD'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], + 'mysql' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST'), + 'database' => env('DB_DATABASE'), + 'username' => env('DB_USERNAME'), + 'password' => env('DB_PASSWORD'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], - 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - ], + 'pgsql' => [ + 'driver' => 'pgsql', + 'host' => env('DB_HOST', 'localhost'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'schema' => 'public', + ], - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'prefix' => '', - ], + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'host' => env('DB_HOST', 'localhost'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'prefix' => '', + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ - 'migrations' => 'migrations', + 'migrations' => 'migrations', - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer set of commands than a typical key-value systems + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ - 'redis' => [ + 'redis' => [ - 'cluster' => false, + 'cluster' => false, - 'default' => [ - 'host' => '127.0.0.1', - 'port' => 6379, - 'database' => 0, - ], + 'default' => [ + 'host' => '127.0.0.1', + 'port' => 6379, + 'database' => 0, + ], - ], + ], ]; diff --git a/config/debugbar.php b/config/debugbar.php index 8131c837..f8200e7d 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -1,6 +1,6 @@ array( - 'enabled' => true, - 'driver' => 'file', // redis, file, pdo - 'path' => storage_path() . '/debugbar', // For file driver + 'storage' => [ + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo + 'path' => storage_path().'/debugbar', // For file driver 'connection' => null, // Leave null for default connection (Redis/PDO) - ), + ], /* |-------------------------------------------------------------------------- @@ -70,7 +70,7 @@ return array( | */ - 'collectors' => array( + 'collectors' => [ 'phpinfo' => true, // Php version 'messages' => true, // Messages 'time' => true, // Time Datalogger @@ -90,7 +90,7 @@ return array( 'config' => false, // Display config settings 'auth' => false, // Display Laravel authentication status 'session' => false, // Display session data in a separate tab - ), + ], /* |-------------------------------------------------------------------------- @@ -101,33 +101,33 @@ return array( | */ - 'options' => array( - 'auth' => array( + 'options' => [ + 'auth' => [ 'show_name' => false, // Also show the users name/email in the debugbar - ), - 'db' => array( + ], + 'db' => [ 'with_params' => true, // Render SQL with the parameters substituted 'timeline' => false, // Add the queries to the timeline 'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files. - 'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries + 'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries 'enabled' => false, - 'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+ - ), + 'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+ + ], 'hints' => true, // Show hints for common mistakes - ), - 'mail' => array( - 'full_log' => false - ), - 'views' => array( + ], + 'mail' => [ + 'full_log' => false, + ], + 'views' => [ 'data' => false, //Note: Can slow down the application, because the data can be quite large.. - ), - 'route' => array( - 'label' => true // show complete route on bar - ), - 'logs' => array( - 'file' => null - ), - ), + ], + 'route' => [ + 'label' => true, // show complete route on bar + ], + 'logs' => [ + 'file' => null, + ], + ], /* |-------------------------------------------------------------------------- @@ -142,4 +142,4 @@ return array( 'inject' => true, -); +]; diff --git a/config/excel.php b/config/excel.php index 24fd87e7..a33a787f 100644 --- a/config/excel.php +++ b/config/excel.php @@ -1,8 +1,8 @@ array( + 'cache' => [ /* |-------------------------------------------------------------------------- @@ -29,24 +29,24 @@ return array( | Cache settings |-------------------------------------------------------------------------- */ - 'settings' => array( + 'settings' => [ 'memoryCacheSize' => '32MB', - 'cacheTime' => 600 + 'cacheTime' => 600, - ), + ], /* |-------------------------------------------------------------------------- | Memcache settings |-------------------------------------------------------------------------- */ - 'memcache' => array( + 'memcache' => [ 'host' => 'localhost', 'port' => 11211, - ), + ], /* |-------------------------------------------------------------------------- @@ -54,10 +54,10 @@ return array( |-------------------------------------------------------------------------- */ - 'dir' => storage_path('cache') - ), + 'dir' => storage_path('cache'), + ], - 'properties' => array( + 'properties' => [ 'creator' => 'Maatwebsite', 'lastModifiedBy' => 'Maatwebsite', 'title' => 'Spreadsheet', @@ -67,35 +67,35 @@ return array( 'category' => 'Excel', 'manager' => 'Maatwebsite', 'company' => 'Maatwebsite', - ), + ], /* |-------------------------------------------------------------------------- | Sheets settings |-------------------------------------------------------------------------- */ - 'sheets' => array( + 'sheets' => [ /* |-------------------------------------------------------------------------- | Default page setup |-------------------------------------------------------------------------- */ - 'pageSetup' => array( + 'pageSetup' => [ 'orientation' => 'portrait', 'paperSize' => '9', 'scale' => '100', 'fitToPage' => false, 'fitToHeight' => true, 'fitToWidth' => true, - 'columnsToRepeatAtLeft' => array('', ''), - 'rowsToRepeatAtTop' => array(0, 0), + 'columnsToRepeatAtLeft' => ['', ''], + 'rowsToRepeatAtTop' => [0, 0], 'horizontalCentered' => false, 'verticalCentered' => false, 'printArea' => null, 'firstPageNumber' => null, - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -108,7 +108,7 @@ return array( 'creator' => 'Maatwebsite', - 'csv' => array( + 'csv' => [ /* |-------------------------------------------------------------------------- | Delimiter @@ -134,10 +134,10 @@ return array( |-------------------------------------------------------------------------- */ - 'line_ending' => "\r\n" - ), + 'line_ending' => "\r\n", + ], - 'export' => array( + 'export' => [ /* |-------------------------------------------------------------------------- @@ -210,7 +210,7 @@ return array( | Default sheet settings |-------------------------------------------------------------------------- */ - 'sheets' => array( + 'sheets' => [ /* |-------------------------------------------------------------------------- @@ -245,8 +245,8 @@ return array( | Apply strict comparison when testing for null values in the array |-------------------------------------------------------------------------- */ - 'strictNullComparison' => false - ), + 'strictNullComparison' => false, + ], /* |-------------------------------------------------------------------------- @@ -254,7 +254,7 @@ return array( |-------------------------------------------------------------------------- */ - 'store' => array( + 'store' => [ /* |-------------------------------------------------------------------------- @@ -274,16 +274,16 @@ return array( | Whether we want to return information about the stored file or not | */ - 'returnInfo' => false + 'returnInfo' => false, - ), + ], /* |-------------------------------------------------------------------------- | PDF Settings |-------------------------------------------------------------------------- */ - 'pdf' => array( + 'pdf' => [ /* |-------------------------------------------------------------------------- @@ -298,48 +298,48 @@ return array( | PDF Driver settings |-------------------------------------------------------------------------- */ - 'drivers' => array( + 'drivers' => [ /* |-------------------------------------------------------------------------- | DomPDF settings |-------------------------------------------------------------------------- */ - 'DomPDF' => array( - 'path' => base_path('vendor/dompdf/dompdf/') - ), + 'DomPDF' => [ + 'path' => base_path('vendor/dompdf/dompdf/'), + ], /* |-------------------------------------------------------------------------- | tcPDF settings |-------------------------------------------------------------------------- */ - 'tcPDF' => array( - 'path' => base_path('vendor/tecnick.com/tcpdf/') - ), + 'tcPDF' => [ + 'path' => base_path('vendor/tecnick.com/tcpdf/'), + ], /* |-------------------------------------------------------------------------- | mPDF settings |-------------------------------------------------------------------------- */ - 'mPDF' => array( - 'path' => base_path('vendor/mpdf/mpdf/') - ), - ) - ) - ), + 'mPDF' => [ + 'path' => base_path('vendor/mpdf/mpdf/'), + ], + ], + ], + ], - 'filters' => array( + 'filters' => [ /* |-------------------------------------------------------------------------- | Register read filters |-------------------------------------------------------------------------- */ - 'registered' => array( - 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' - ), + 'registered' => [ + 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter', + ], /* |-------------------------------------------------------------------------- @@ -347,10 +347,10 @@ return array( |-------------------------------------------------------------------------- */ - 'enabled' => array() - ), + 'enabled' => [], + ], - 'import' => array( + 'import' => [ /* |-------------------------------------------------------------------------- @@ -415,12 +415,12 @@ return array( |-------------------------------------------------------------------------- */ - 'encoding' => array( + 'encoding' => [ 'input' => 'UTF-8', - 'output' => 'UTF-8' + 'output' => 'UTF-8', - ), + ], /* |-------------------------------------------------------------------------- @@ -466,7 +466,7 @@ return array( | */ - 'dates' => array( + 'dates' => [ /* |-------------------------------------------------------------------------- @@ -490,15 +490,15 @@ return array( | Date columns |-------------------------------------------------------------------------- */ - 'columns' => array() - ), + 'columns' => [], + ], /* |-------------------------------------------------------------------------- | Import sheets by config |-------------------------------------------------------------------------- */ - 'sheets' => array( + 'sheets' => [ /* |-------------------------------------------------------------------------- @@ -509,16 +509,16 @@ return array( | */ - 'test' => array( + 'test' => [ - 'firstname' => 'A2' + 'firstname' => 'A2', - ) + ], - ) - ), + ], + ], - 'views' => array( + 'views' => [ /* |-------------------------------------------------------------------------- @@ -529,155 +529,155 @@ return array( | */ - 'styles' => array( + 'styles' => [ /* |-------------------------------------------------------------------------- | Table headings |-------------------------------------------------------------------------- */ - 'th' => array( - 'font' => array( + 'th' => [ + 'font' => [ 'bold' => true, 'size' => 12, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Strong tags |-------------------------------------------------------------------------- */ - 'strong' => array( - 'font' => array( + 'strong' => [ + 'font' => [ 'bold' => true, 'size' => 12, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Bold tags |-------------------------------------------------------------------------- */ - 'b' => array( - 'font' => array( + 'b' => [ + 'font' => [ 'bold' => true, 'size' => 12, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Italic tags |-------------------------------------------------------------------------- */ - 'i' => array( - 'font' => array( + 'i' => [ + 'font' => [ 'italic' => true, 'size' => 12, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 1 |-------------------------------------------------------------------------- */ - 'h1' => array( - 'font' => array( + 'h1' => [ + 'font' => [ 'bold' => true, 'size' => 24, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 2 |-------------------------------------------------------------------------- */ - 'h2' => array( - 'font' => array( + 'h2' => [ + 'font' => [ 'bold' => true, 'size' => 18, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 2 |-------------------------------------------------------------------------- */ - 'h3' => array( - 'font' => array( + 'h3' => [ + 'font' => [ 'bold' => true, 'size' => 13.5, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 4 |-------------------------------------------------------------------------- */ - 'h4' => array( - 'font' => array( + 'h4' => [ + 'font' => [ 'bold' => true, 'size' => 12, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 5 |-------------------------------------------------------------------------- */ - 'h5' => array( - 'font' => array( + 'h5' => [ + 'font' => [ 'bold' => true, 'size' => 10, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Heading 6 |-------------------------------------------------------------------------- */ - 'h6' => array( - 'font' => array( + 'h6' => [ + 'font' => [ 'bold' => true, 'size' => 7.5, - ) - ), + ], + ], /* |-------------------------------------------------------------------------- | Hyperlinks |-------------------------------------------------------------------------- */ - 'a' => array( - 'font' => array( + 'a' => [ + 'font' => [ 'underline' => true, - 'color' => array('argb' => 'FF0000FF'), - ) - ), + 'color' => ['argb' => 'FF0000FF'], + ], + ], /* |-------------------------------------------------------------------------- | Horizontal rules |-------------------------------------------------------------------------- */ - 'hr' => array( - 'borders' => array( - 'bottom' => array( + 'hr' => [ + 'borders' => [ + 'bottom' => [ 'style' => 'thin', - 'color' => array('FF000000') - ), - ) - ) - ) + 'color' => ['FF000000'], + ], + ], + ], + ], - ) + ], -); \ No newline at end of file +]; diff --git a/config/filesystems.php b/config/filesystems.php index 430c6637..877d7c04 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -2,69 +2,69 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Filesystem Disk - |-------------------------------------------------------------------------- - | - | Here you may specify the default filesystem disk that should be used - | by the framework. A "local" driver, as well as a variety of cloud - | based drivers are available for your choosing. Just store away! - | - | Supported: "local", "s3", "rackspace" - | - */ + /* + |-------------------------------------------------------------------------- + | Default Filesystem Disk + |-------------------------------------------------------------------------- + | + | Here you may specify the default filesystem disk that should be used + | by the framework. A "local" driver, as well as a variety of cloud + | based drivers are available for your choosing. Just store away! + | + | Supported: "local", "s3", "rackspace" + | + */ - 'default' => 'local', + 'default' => 'local', - /* - |-------------------------------------------------------------------------- - | Default Cloud Filesystem Disk - |-------------------------------------------------------------------------- - | - | Many applications store files both locally and in the cloud. For this - | reason, you may specify a default "cloud" driver here. This driver - | will be bound as the Cloud disk implementation in the container. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Cloud Filesystem Disk + |-------------------------------------------------------------------------- + | + | Many applications store files both locally and in the cloud. For this + | reason, you may specify a default "cloud" driver here. This driver + | will be bound as the Cloud disk implementation in the container. + | + */ - 'cloud' => 's3', + 'cloud' => 's3', - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. - | - */ + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been setup for each driver as an example of the required options. + | + */ - 'disks' => [ + 'disks' => [ - 'local' => [ - 'driver' => 'local', - 'root' => public_path().'/user_content', - ], + 'local' => [ + 'driver' => 'local', + 'root' => public_path().'/user_content', + ], - 's3' => [ - 'driver' => 's3', - 'key' => 'your-key', - 'secret' => 'your-secret', - 'region' => 'your-region', - 'bucket' => 'your-bucket', - ], + 's3' => [ + 'driver' => 's3', + 'key' => 'your-key', + 'secret' => 'your-secret', + 'region' => 'your-region', + 'bucket' => 'your-bucket', + ], - 'rackspace' => [ - 'driver' => 'rackspace', - 'username' => 'your-username', - 'key' => 'your-key', - 'container' => 'your-container', - 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', - 'region' => 'IAD', - ], + 'rackspace' => [ + 'driver' => 'rackspace', + 'username' => 'your-username', + 'key' => 'your-key', + 'container' => 'your-container', + 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', + 'region' => 'IAD', + ], - ], + ], ]; diff --git a/config/image.php b/config/image.php index b106809e..67983819 100644 --- a/config/image.php +++ b/config/image.php @@ -1,6 +1,6 @@ 'gd' + 'driver' => 'gd', -); +]; diff --git a/config/mail.php b/config/mail.php index f3e93058..f5db3cc7 100644 --- a/config/mail.php +++ b/config/mail.php @@ -2,123 +2,123 @@ return [ - /* - |-------------------------------------------------------------------------- - | Mail Driver - |-------------------------------------------------------------------------- - | - | Laravel supports both SMTP and PHP's "mail" function as drivers for the - | sending of e-mail. You may specify which one you're using throughout - | your application here. By default, Laravel is setup for SMTP mail. - | - | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log" - | - */ + /* + |-------------------------------------------------------------------------- + | Mail Driver + |-------------------------------------------------------------------------- + | + | Laravel supports both SMTP and PHP's "mail" function as drivers for the + | sending of e-mail. You may specify which one you're using throughout + | your application here. By default, Laravel is setup for SMTP mail. + | + | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log" + | + */ - 'driver' => env('MAIL_DRIVER', 'mail'), + 'driver' => env('MAIL_DRIVER', 'mail'), - /* - |-------------------------------------------------------------------------- - | SMTP Host Address - |-------------------------------------------------------------------------- - | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. - | - */ + /* + |-------------------------------------------------------------------------- + | SMTP Host Address + |-------------------------------------------------------------------------- + | + | Here you may provide the host address of the SMTP server used by your + | applications. A default option is provided that is compatible with + | the Mailgun mail service which will provide reliable deliveries. + | + */ - 'host' => env('MAIL_HOST', 'smtp.sendgrid.net'), + 'host' => env('MAIL_HOST', 'smtp.sendgrid.net'), - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- - | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. - | - */ + /* + |-------------------------------------------------------------------------- + | SMTP Host Port + |-------------------------------------------------------------------------- + | + | This is the SMTP port used by your application to deliver e-mails to + | users of the application. Like the host we have set this value to + | stay compatible with the Mailgun e-mail application by default. + | + */ - 'port' => env('MAIL_PORT', 587), + 'port' => env('MAIL_PORT', 587), - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. + | + */ - 'from' => ['address' => env('MAIL_FROM_ADDRESS'), 'name' => env('MAIL_FROM_NAME')], + 'from' => ['address' => env('MAIL_FROM_ADDRESS'), 'name' => env('MAIL_FROM_NAME')], - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ + /* + |-------------------------------------------------------------------------- + | E-Mail Encryption Protocol + |-------------------------------------------------------------------------- + | + | Here you may specify the encryption protocol that should be used when + | the application send e-mail messages. A sensible default using the + | transport layer security protocol should provide great security. + | + */ - 'encryption' => env('MAIL_ENCRYPTION','tls'), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ + /* + |-------------------------------------------------------------------------- + | SMTP Server Username + |-------------------------------------------------------------------------- + | + | If your SMTP server requires a username for authentication, you should + | set it here. This will get used to authenticate with your server on + | connection. You may also set the "password" value below this one. + | + */ - 'username' => env('MAIL_USERNAME'), + 'username' => env('MAIL_USERNAME'), - /* - |-------------------------------------------------------------------------- - | SMTP Server Password - |-------------------------------------------------------------------------- - | - | Here you may set the password required by your SMTP server to send out - | messages from your application. This will be given to the server on - | connection so that the application will be able to send messages. - | - */ + /* + |-------------------------------------------------------------------------- + | SMTP Server Password + |-------------------------------------------------------------------------- + | + | Here you may set the password required by your SMTP server to send out + | messages from your application. This will be given to the server on + | connection so that the application will be able to send messages. + | + */ - 'password' => env('MAIL_PASSWORD'), + 'password' => env('MAIL_PASSWORD'), - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ + /* + |-------------------------------------------------------------------------- + | Sendmail System Path + |-------------------------------------------------------------------------- + | + | When using the "sendmail" driver to send e-mails, we will need to know + | the path to where Sendmail lives on this server. A default path has + | been provided here, which will work well on most of your systems. + | + */ - 'sendmail' => '/usr/sbin/sendmail -bs', + 'sendmail' => '/usr/sbin/sendmail -bs', - /* - |-------------------------------------------------------------------------- - | Mail "Pretend" - |-------------------------------------------------------------------------- - | - | When this option is enabled, e-mail will not actually be sent over the - | web and will instead be written to your application's logs files so - | you may inspect the message. This is great for local development. - | - */ + /* + |-------------------------------------------------------------------------- + | Mail "Pretend" + |-------------------------------------------------------------------------- + | + | When this option is enabled, e-mail will not actually be sent over the + | web and will instead be written to your application's logs files so + | you may inspect the message. This is great for local development. + | + */ - 'pretend' => false, + 'pretend' => false, ]; diff --git a/config/queue.php b/config/queue.php index fd16e588..311da9ff 100644 --- a/config/queue.php +++ b/config/queue.php @@ -34,34 +34,34 @@ return [ ], 'database' => [ 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'table' => 'jobs', + 'queue' => 'default', 'expire' => 60, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'ttr' => 60, + 'host' => 'localhost', + 'queue' => 'default', + 'ttr' => 60, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', + 'key' => 'your-public-key', 'secret' => 'your-secret-key', - 'queue' => 'your-queue-url', + 'queue' => 'your-queue-url', 'region' => 'us-east-1', ], 'iron' => [ - 'driver' => 'iron', - 'host' => 'mq-aws-eu-west-1.iron.io', - 'token' => 'e86QTHwOmEDzqYtti9xAKSgjS7E', + 'driver' => 'iron', + 'host' => 'mq-aws-eu-west-1.iron.io', + 'token' => 'e86QTHwOmEDzqYtti9xAKSgjS7E', 'project' => '535d254120fa16000900000a', - 'queue' => '54e8a61d8d560bccac9dc83e', - 'encrypt' => true + 'queue' => '54e8a61d8d560bccac9dc83e', + 'encrypt' => true, ], 'redis' => [ 'driver' => 'redis', - 'queue' => 'default', + 'queue' => 'default', 'expire' => 60, ], ], diff --git a/config/services.php b/config/services.php index dddc9866..e606dbe0 100644 --- a/config/services.php +++ b/config/services.php @@ -2,36 +2,36 @@ return [ - /* - |-------------------------------------------------------------------------- - | Third Party Services - |-------------------------------------------------------------------------- - | - | This file is for storing the credentials for third party services such - | as Stripe, Mailgun, Mandrill, and others. This file provides a sane - | default location for this type of information, allowing packages - | to have a conventional place to find your various credentials. - | - */ + /* + |-------------------------------------------------------------------------- + | Third Party Services + |-------------------------------------------------------------------------- + | + | This file is for storing the credentials for third party services such + | as Stripe, Mailgun, Mandrill, and others. This file provides a sane + | default location for this type of information, allowing packages + | to have a conventional place to find your various credentials. + | + */ - 'mailgun' => [ - 'domain' => '', - 'secret' => '', - ], + 'mailgun' => [ + 'domain' => '', + 'secret' => '', + ], - 'mandrill' => [ - 'secret' => '', - ], + 'mandrill' => [ + 'secret' => '', + ], - 'ses' => [ - 'key' => '', - 'secret' => '', - 'region' => 'us-east-1', - ], + 'ses' => [ + 'key' => '', + 'secret' => '', + 'region' => 'us-east-1', + ], - 'stripe' => [ - 'model' => 'User', - 'secret' => '', - ], + 'stripe' => [ + 'model' => 'User', + 'secret' => '', + ], ]; diff --git a/config/session.php b/config/session.php index 47470fab..2514731d 100644 --- a/config/session.php +++ b/config/session.php @@ -2,152 +2,152 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Session Driver - |-------------------------------------------------------------------------- - | - | This option controls the default session "driver" that will be used on - | requests. By default, we will use the lightweight native driver but - | you may specify any of the other wonderful drivers provided here. - | - | Supported: "file", "cookie", "database", "apc", - | "memcached", "redis", "array" - | - */ + /* + |-------------------------------------------------------------------------- + | Default Session Driver + |-------------------------------------------------------------------------- + | + | This option controls the default session "driver" that will be used on + | requests. By default, we will use the lightweight native driver but + | you may specify any of the other wonderful drivers provided here. + | + | Supported: "file", "cookie", "database", "apc", + | "memcached", "redis", "array" + | + */ - 'driver' => env('SESSION_DRIVER', 'file'), + 'driver' => env('SESSION_DRIVER', 'file'), - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Lifetime + |-------------------------------------------------------------------------- + | + | Here you may specify the number of minutes that you wish the session + | to be allowed to remain idle before it expires. If you want them + | to immediately expire on the browser closing, set that option. + | + */ - 'lifetime' => 120, + 'lifetime' => 120, - 'expire_on_close' => false, + 'expire_on_close' => false, - /* - |-------------------------------------------------------------------------- - | Session Encryption - |-------------------------------------------------------------------------- - | - | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Encryption + |-------------------------------------------------------------------------- + | + | This option allows you to easily specify that all of your session data + | should be encrypted before it is stored. All encryption will be run + | automatically by Laravel and you can use the Session like normal. + | + */ - 'encrypt' => false, + 'encrypt' => false, - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ + /* + |-------------------------------------------------------------------------- + | Session File Location + |-------------------------------------------------------------------------- + | + | When using the native session driver, we need a location where session + | files may be stored. A default has been set for you but a different + | location may be specified. This is only needed for file sessions. + | + */ - 'files' => storage_path().'/framework/sessions', + 'files' => storage_path().'/framework/sessions', - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Database Connection + |-------------------------------------------------------------------------- + | + | When using the "database" or "redis" session drivers, you may specify a + | connection that should be used to manage these sessions. This should + | correspond to a connection in your database configuration options. + | + */ - 'connection' => null, + 'connection' => null, - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Database Table + |-------------------------------------------------------------------------- + | + | When using the "database" session driver, you may specify the table we + | should use to manage the sessions. Of course, a sensible default is + | provided for you; however, you are free to change this as needed. + | + */ - 'table' => 'sessions', + 'table' => 'sessions', - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Sweeping Lottery + |-------------------------------------------------------------------------- + | + | Some session drivers must manually sweep their storage location to get + | rid of old sessions from storage. Here are the chances that it will + | happen on a given request. By default, the odds are 2 out of 100. + | + */ - 'lottery' => [2, 100], + 'lottery' => [2, 100], - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Cookie Name + |-------------------------------------------------------------------------- + | + | Here you may change the name of the cookie used to identify a session + | instance by ID. The name specified here will get used every time a + | new session cookie is created by the framework for every driver. + | + */ - 'cookie' => 'laravel_session', + 'cookie' => 'laravel_session', - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Cookie Path + |-------------------------------------------------------------------------- + | + | The session cookie path determines the path for which the cookie will + | be regarded as available. Typically, this will be the root path of + | your application but you are free to change this when necessary. + | + */ - 'path' => '/', + 'path' => '/', - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ + /* + |-------------------------------------------------------------------------- + | Session Cookie Domain + |-------------------------------------------------------------------------- + | + | Here you may change the domain of the cookie used to identify a session + | in your application. This will determine which domains the cookie is + | available to in your application. A sensible default has been set. + | + */ - 'domain' => null, + 'domain' => null, - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. - | - */ + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you if it can not be done securely. + | + */ - 'secure' => false, + 'secure' => false, ]; diff --git a/config/view.php b/config/view.php index 88fc534a..13ef5e9f 100644 --- a/config/view.php +++ b/config/view.php @@ -2,32 +2,32 @@ return [ - /* - |-------------------------------------------------------------------------- - | View Storage Paths - |-------------------------------------------------------------------------- - | - | Most templating systems load templates from disk. Here you may specify - | an array of paths that should be checked for your views. Of course - | the usual Laravel view path has already been registered for you. - | - */ + /* + |-------------------------------------------------------------------------- + | View Storage Paths + |-------------------------------------------------------------------------- + | + | Most templating systems load templates from disk. Here you may specify + | an array of paths that should be checked for your views. Of course + | the usual Laravel view path has already been registered for you. + | + */ - 'paths' => [ - realpath(base_path('resources/views')) - ], + 'paths' => [ + realpath(base_path('resources/views')), + ], - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ + /* + |-------------------------------------------------------------------------- + | Compiled View Path + |-------------------------------------------------------------------------- + | + | This option determines where all the compiled Blade templates will be + | stored for your application. Typically, this is within the storage + | directory. However, as usual, you are free to change this value. + | + */ - 'compiled' => realpath(storage_path().'/framework/views'), + 'compiled' => realpath(storage_path().'/framework/views'), ]; diff --git a/database/migrations/2014_03_26_180116_create_users_table.php b/database/migrations/2014_03_26_180116_create_users_table.php index a68e12c6..6bea0384 100644 --- a/database/migrations/2014_03_26_180116_create_users_table.php +++ b/database/migrations/2014_03_26_180116_create_users_table.php @@ -2,25 +2,26 @@ use Illuminate\Database\Migrations\Migration; -class CreateUsersTable extends Migration { - +class CreateUsersTable extends Migration +{ /** * Run the migrations. * * @return void */ - public function up() { - Schema::create('order_statuses', function($t) { + public function up() + { + Schema::create('order_statuses', function ($t) { $t->increments('id'); $t->string('name'); }); - Schema::create('ticket_statuses', function($table) { + Schema::create('ticket_statuses', function ($table) { $table->increments('id'); $table->text('name'); }); - Schema::create('reserved_tickets', function($table) { + Schema::create('reserved_tickets', function ($table) { $table->increments('id'); @@ -33,27 +34,27 @@ class CreateUsersTable extends Migration { $table->timestamps(); }); - Schema::create('timezones', function($t) { + Schema::create('timezones', function ($t) { $t->increments('id'); $t->string('name'); $t->string('location'); }); - Schema::create('date_formats', function($t) { + Schema::create('date_formats', function ($t) { $t->increments('id'); $t->string('format'); $t->string('picker_format'); $t->string('label'); }); - Schema::create('datetime_formats', function($t) { + Schema::create('datetime_formats', function ($t) { $t->increments('id'); $t->string('format'); $t->string('label'); }); // Create the `currency` table - Schema::create('currencies', function($table) { + Schema::create('currencies', function ($table) { $table->increments('id')->unsigned(); $table->string('title', 255); $table->string('symbol_left', 12); @@ -67,11 +68,10 @@ class CreateUsersTable extends Migration { $table->timestamps(); }); - - /** + /* * Accounts table */ - Schema::create('accounts', function($t) { + Schema::create('accounts', function ($t) { $t->increments('id'); $t->string('first_name'); @@ -107,7 +107,7 @@ class CreateUsersTable extends Migration { $t->string('stripe_secret_key', 55); $t->string('stripe_publishable_key', 55); $t->text('stripe_data_raw', 55); - + $t->foreign('timezone_id')->references('id')->on('timezones'); $t->foreign('date_format_id')->references('id')->on('date_formats'); $t->foreign('datetime_format_id')->references('id')->on('date_formats'); @@ -115,19 +115,16 @@ class CreateUsersTable extends Migration { $t->foreign('currency_id')->references('id')->on('currencies'); }); - /* * Users Table */ - Schema::create('users', function($t) { - + Schema::create('users', function ($t) { $t->increments('id'); $t->unsignedInteger('account_id')->index(); $t->timestamps(); $t->softDeletes(); - $t->string('first_name'); $t->string('last_name'); $t->string('phone'); @@ -139,7 +136,6 @@ class CreateUsersTable extends Migration { $t->boolean('is_parent')->default(false); $t->string('remember_token', 100)->nullable(); - $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); @@ -165,10 +161,7 @@ class CreateUsersTable extends Migration { $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); - - - - Schema::create('events', function($t) { + Schema::create('events', function ($t) { $t->increments('id'); $t->string('title'); @@ -213,13 +206,12 @@ class CreateUsersTable extends Migration { $t->string('location_long'); $t->string('location_google_place_id'); - $t->unsignedInteger('ask_for_all_attendees_info')->default(0); - + $t->text('pre_order_display_message'); - + $t->text('post_order_display_message'); - + $t->text('social_share_text', 'Check Out [event_title] - [event_url]'); $t->boolean('social_show_facebook')->default(true); $t->boolean('social_show_linkedin')->default(true); @@ -227,22 +219,18 @@ class CreateUsersTable extends Migration { $t->boolean('social_show_email')->default(true); $t->boolean('social_show_googleplus')->default(true); - - $t->unsignedInteger('location_is_manual')->default(0); - + $t->boolean('is_live')->default(false); $t->timestamps(); $t->softDeletes(); }); - - /* * Users table */ - Schema::create('orders', function($t) { + Schema::create('orders', function ($t) { $t->increments('id'); $t->unsignedInteger('account_id')->index(); $t->unsignedInteger('order_status_id'); @@ -261,7 +249,7 @@ class CreateUsersTable extends Migration { $t->decimal('booking_fee', 8, 2); $t->decimal('organiser_booking_fee', 8, 2); $t->date('order_date')->nullable(); - + $t->text('notes'); $t->boolean('is_deleted')->default(0); $t->boolean('is_cancelled')->default(0); @@ -278,16 +266,15 @@ class CreateUsersTable extends Migration { $t->foreign('order_status_id')->references('id')->on('order_statuses')->onDelete('no action'); }); - /** + /* * Tickets table */ - Schema::create('tickets', function($t) { + Schema::create('tickets', function ($t) { $t->increments('id'); $t->timestamps(); $t->softDeletes(); - $t->unsignedInteger('edited_by_user_id')->nullable(); $t->unsignedInteger('account_id')->index(); $t->unsignedInteger('order_id')->nullable(); @@ -323,7 +310,7 @@ class CreateUsersTable extends Migration { $t->foreign('user_id')->references('id')->on('users'); }); - Schema::create('order_items', function($table) { + Schema::create('order_items', function ($table) { $table->increments('id'); $table->string('title', 255); $table->integer('quantity'); @@ -410,11 +397,10 @@ class CreateUsersTable extends Migration { // }); // - - /** + /* * Tickets / Orders pivot table */ - Schema::create('ticket_order', function($t) { + Schema::create('ticket_order', function ($t) { $t->increments('id'); $t->integer('order_id')->unsigned()->index(); $t->foreign('order_id')->references('id')->on('orders')->onDelete('cascade'); @@ -422,7 +408,7 @@ class CreateUsersTable extends Migration { $t->foreign('ticket_id')->references('id')->on('users')->onDelete('cascade'); }); - /** + /* * Tickets / Questions pivot table */ // Schema::create('ticket_question', function($t) { @@ -433,16 +419,13 @@ class CreateUsersTable extends Migration { // $t->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); // }); - - - - Schema::create('event_stats', function($table) { + Schema::create('event_stats', function ($table) { $table->increments('id')->index(); $table->date('date'); $table->integer('views')->default(0); $table->integer('unique_views')->default(0); $table->integer('tickets_sold')->default(0); - + $table->decimal('sales_volume', 13, 2); $table->decimal('organiser_fees_volume', 13, 2); @@ -451,8 +434,7 @@ class CreateUsersTable extends Migration { $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); }); - - Schema::create('attendees', function($t) { + Schema::create('attendees', function ($t) { $t->increments('id'); $t->unsignedInteger('order_id')->index(); $t->unsignedInteger('event_id')->index(); @@ -468,20 +450,19 @@ class CreateUsersTable extends Migration { $t->timestamps(); $t->softDeletes(); - $t->boolean('is_cancelled')->default(FALSE); - $t->boolean('has_arrived')->default(FALSE); + $t->boolean('is_cancelled')->default(false); + $t->boolean('has_arrived')->default(false); $t->dateTime('arrival_time'); $t->unsignedInteger('account_id')->index(); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $t->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); $t->foreign('order_id')->references('id')->on('orders')->onDelete('cascade'); }); - Schema::create('messages', function($table) { + Schema::create('messages', function ($table) { $table->increments('id'); $table->text('message'); $table->string('subject'); @@ -498,20 +479,18 @@ class CreateUsersTable extends Migration { $table->foreign('user_id')->references('id')->on('users')->onDelete('no action'); }); - - - Schema::create('event_images', function($t) { + Schema::create('event_images', function ($t) { $t->increments('id'); $t->string('image_path'); $t->timestamps(); - + $t->unsignedInteger('event_id'); $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); - + $t->unsignedInteger('account_id'); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); - + $t->unsignedInteger('user_id'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); }); @@ -522,8 +501,8 @@ class CreateUsersTable extends Migration { * * @return void */ - public function down() { + public function down() + { Schema::drop('users'); } - } diff --git a/database/migrations/2014_04_08_232044_setup_countries_table.php b/database/migrations/2014_04_08_232044_setup_countries_table.php index 5a459875..e11ded41 100644 --- a/database/migrations/2014_04_08_232044_setup_countries_table.php +++ b/database/migrations/2014_04_08_232044_setup_countries_table.php @@ -1,45 +1,44 @@ integer('id')->index(); + $table->string('capital', 255)->nullable(); + $table->string('citizenship', 255)->nullable(); + $table->string('country_code', 3)->default(''); + $table->string('currency', 255)->nullable(); + $table->string('currency_code', 255)->nullable(); + $table->string('currency_sub_unit', 255)->nullable(); + $table->string('full_name', 255)->nullable(); + $table->string('iso_3166_2', 2)->default(''); + $table->string('iso_3166_3', 3)->default(''); + $table->string('name', 255)->default(''); + $table->string('region_code', 3)->default(''); + $table->string('sub_region_code', 3)->default(''); + $table->boolean('eea')->default(0); - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - // Creates the users table - Schema::create('Countries', function($table) - { - $table->integer('id')->index(); - $table->string('capital', 255)->nullable(); - $table->string('citizenship', 255)->nullable(); - $table->string('country_code', 3)->default(''); - $table->string('currency', 255)->nullable(); - $table->string('currency_code', 255)->nullable(); - $table->string('currency_sub_unit', 255)->nullable(); - $table->string('full_name', 255)->nullable(); - $table->string('iso_3166_2', 2)->default(''); - $table->string('iso_3166_3', 3)->default(''); - $table->string('name', 255)->default(''); - $table->string('region_code', 3)->default(''); - $table->string('sub_region_code', 3)->default(''); - $table->boolean('eea')->default(0); - - $table->primary('id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('Countries'); - } + $table->primary('id'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('Countries'); + } } diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 679df38f..c647b562 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,33 +1,31 @@ string('email')->index(); - $table->string('token')->index(); - $table->timestamp('created_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('password_resets'); - } +class CreatePasswordResetsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('password_resets', function (Blueprint $table) { + $table->string('email')->index(); + $table->string('token')->index(); + $table->timestamp('created_at'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('password_resets'); + } } diff --git a/database/migrations/2014_11_07_132018_add_affiliates_table.php b/database/migrations/2014_11_07_132018_add_affiliates_table.php index 18b5e2f9..4e83b4bb 100644 --- a/database/migrations/2014_11_07_132018_add_affiliates_table.php +++ b/database/migrations/2014_11_07_132018_add_affiliates_table.php @@ -1,17 +1,17 @@ increments('id'); $table->string('name', 125); $table->integer('visits'); @@ -32,8 +32,8 @@ class AddAffiliatesTable extends Migration { * * @return void */ - public function down() { + public function down() + { // } - } diff --git a/database/migrations/2014_11_17_011806_create_failed_jobs_table.php b/database/migrations/2014_11_17_011806_create_failed_jobs_table.php index 61efc17d..b000ca74 100644 --- a/database/migrations/2014_11_17_011806_create_failed_jobs_table.php +++ b/database/migrations/2014_11_17_011806_create_failed_jobs_table.php @@ -1,35 +1,33 @@ increments('id'); - $table->text('connection'); - $table->text('queue'); - $table->text('payload'); - $table->timestamp('failed_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('failed_jobs'); - } +class CreateFailedJobsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('failed_jobs', function (Blueprint $table) { + $table->increments('id'); + $table->text('connection'); + $table->text('queue'); + $table->text('payload'); + $table->timestamp('failed_at'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('failed_jobs'); + } } diff --git a/database/seeds/ConstantsSeeder.php b/database/seeds/ConstantsSeeder.php index 4668f306..70575cff 100644 --- a/database/seeds/ConstantsSeeder.php +++ b/database/seeds/ConstantsSeeder.php @@ -2,27 +2,26 @@ use Illuminate\Database\Seeder; -class ConstantsSeeder extends Seeder { - - public function run() { - - +class ConstantsSeeder extends Seeder +{ + public function run() + { $order_statuses = [ [ - 'id' => 1, - 'name' => 'Completed' + 'id' => 1, + 'name' => 'Completed', ], [ - 'id' => 2, - 'name' => 'Refunded' + 'id' => 2, + 'name' => 'Refunded', ], [ - 'id' => 3, - 'name' => 'Partially Refunded' + 'id' => 3, + 'name' => 'Partially Refunded', ], [ - 'id' => 4, - 'name' => 'Cancelled' + 'id' => 4, + 'name' => 'Cancelled', ], ]; @@ -30,137 +29,134 @@ class ConstantsSeeder extends Seeder { $ticket_statuses = [ [ - 'id' => 1, - 'name' => 'Sold Out' + 'id' => 1, + 'name' => 'Sold Out', ], [ - 'id' => 2, - 'name' => 'Sales Have Ended' + 'id' => 2, + 'name' => 'Sales Have Ended', ], [ - 'id' => 3, - 'name' => 'Not On Sale Yet' + 'id' => 3, + 'name' => 'Not On Sale Yet', ], [ - 'id' => 4, - 'name' => 'On Sale' + 'id' => 4, + 'name' => 'On Sale', ], [ - 'id' => 5, - 'name' => 'On Sale' - ] + 'id' => 5, + 'name' => 'On Sale', + ], ]; DB::table('ticket_statuses')->insert($ticket_statuses); - /* * Question Types */ $question_types = [ [ - 'id' => 0, - 'name' => 'Single-line text box', - 'allow_multiple' => 0 + 'id' => 0, + 'name' => 'Single-line text box', + 'allow_multiple' => 0, ], [ - 'id' => 1, - 'name' => 'Multi-line text box', - 'allow_multiple' => 0 + 'id' => 1, + 'name' => 'Multi-line text box', + 'allow_multiple' => 0, ], [ - 'id' => 2, - 'name' => 'Drop down options (single section)', - 'allow_multiple' => 0 + 'id' => 2, + 'name' => 'Drop down options (single section)', + 'allow_multiple' => 0, ], [ - 'id' => 3, - 'name' => 'Drop down options (multiple section)', - 'allow_multiple' => 1 + 'id' => 3, + 'name' => 'Drop down options (multiple section)', + 'allow_multiple' => 1, ], [ - 'id' => 4, - 'name' => 'Check Boxes', - 'allow_multiple' => 1 - ] - + 'id' => 4, + 'name' => 'Check Boxes', + 'allow_multiple' => 1, + ], + ]; //DB::table('question_types')->insert($question_types); - - - $currencies = array( - array( - 'id' => 1, - 'title' => 'U.S. Dollar', - 'symbol_left' => '$', - 'symbol_right' => '', - 'code' => 'USD', - 'decimal_place' => 2, - 'value' => 1.00000000, - 'decimal_point' => '.', + $currencies = [ + [ + 'id' => 1, + 'title' => 'U.S. Dollar', + 'symbol_left' => '$', + 'symbol_right' => '', + 'code' => 'USD', + 'decimal_place' => 2, + 'value' => 1.00000000, + 'decimal_point' => '.', 'thousand_point' => ',', - 'status' => 1, - 'created_at' => '2013-11-29 19:51:38', - 'updated_at' => '2013-11-29 19:51:38', - ), - array( - 'id' => 2, - 'title' => 'Euro', - 'symbol_left' => '€', - 'symbol_right' => '', - 'code' => 'EUR', - 'decimal_place' => 2, - 'value' => 0.74970001, - 'decimal_point' => '.', + 'status' => 1, + 'created_at' => '2013-11-29 19:51:38', + 'updated_at' => '2013-11-29 19:51:38', + ], + [ + 'id' => 2, + 'title' => 'Euro', + 'symbol_left' => '€', + 'symbol_right' => '', + 'code' => 'EUR', + 'decimal_place' => 2, + 'value' => 0.74970001, + 'decimal_point' => '.', 'thousand_point' => ',', - 'status' => 1, - 'created_at' => '2013-11-29 19:51:38', - 'updated_at' => '2013-11-29 19:51:38', - ), - array( - 'id' => 3, - 'title' => 'Pound Sterling', - 'symbol_left' => '£', - 'symbol_right' => '', - 'code' => 'GBP', - 'decimal_place' => 2, - 'value' => 0.62220001, - 'decimal_point' => '.', + 'status' => 1, + 'created_at' => '2013-11-29 19:51:38', + 'updated_at' => '2013-11-29 19:51:38', + ], + [ + 'id' => 3, + 'title' => 'Pound Sterling', + 'symbol_left' => '£', + 'symbol_right' => '', + 'code' => 'GBP', + 'decimal_place' => 2, + 'value' => 0.62220001, + 'decimal_point' => '.', 'thousand_point' => ',', - 'status' => 1, - 'created_at' => '2013-11-29 19:51:38', - 'updated_at' => '2013-11-29 19:51:38', - ), - array( - 'id' => 4, - 'title' => 'Australian Dollar', - 'symbol_left' => '$', - 'symbol_right' => '', - 'code' => 'AUD', - 'decimal_place' => 2, - 'value' => 0.94790000, - 'decimal_point' => '.', + 'status' => 1, + 'created_at' => '2013-11-29 19:51:38', + 'updated_at' => '2013-11-29 19:51:38', + ], + [ + 'id' => 4, + 'title' => 'Australian Dollar', + 'symbol_left' => '$', + 'symbol_right' => '', + 'code' => 'AUD', + 'decimal_place' => 2, + 'value' => 0.94790000, + 'decimal_point' => '.', 'thousand_point' => ',', - 'status' => 1, - 'created_at' => '2013-11-29 19:51:38', - 'updated_at' => '2013-11-29 19:51:38', - ), - array( - 'id' => 5, - 'title' => 'Canadian Dollar', - 'symbol_left' => '$', - 'symbol_right' => '', - 'code' => 'CAD', - 'decimal_place' => 2, - 'value' => 0.98500001, - 'decimal_point' => '.', + 'status' => 1, + 'created_at' => '2013-11-29 19:51:38', + 'updated_at' => '2013-11-29 19:51:38', + ], + [ + 'id' => 5, + 'title' => 'Canadian Dollar', + 'symbol_left' => '$', + 'symbol_right' => '', + 'code' => 'CAD', + 'decimal_place' => 2, + 'value' => 0.98500001, + 'decimal_point' => '.', 'thousand_point' => ',', - 'status' => 1, - 'created_at' => '2013-11-29 19:51:38', - 'updated_at' => '2013-11-29 19:51:38', - ) + 'status' => 1, + 'created_at' => '2013-11-29 19:51:38', + 'updated_at' => '2013-11-29 19:51:38', + ], // array( // 'id' => 6, // 'title' => 'Czech Koruna', @@ -385,27 +381,27 @@ class ConstantsSeeder extends Seeder { // 'created_at' => '2013-11-29 19:51:38', // 'updated_at' => '2013-11-29 19:51:38', // ) - ); + ]; DB::table('currencies')->insert($currencies); - \App\Models\DateTimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013')); - \App\Models\DateTimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013')); - \App\Models\DateTimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013')); - \App\Models\DateTimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013')); - \App\Models\DateTimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm')); - \App\Models\DateTimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm')); - \App\Models\DateTimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm')); + \App\Models\DateTimeFormat::create(['format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013']); + \App\Models\DateTimeFormat::create(['format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013']); + \App\Models\DateTimeFormat::create(['format' => 'd/F/Y g:i a', 'label' => '10/March/2013']); + \App\Models\DateTimeFormat::create(['format' => 'd-F-Y g:i a', 'label' => '10-March-2013']); + \App\Models\DateTimeFormat::create(['format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm']); + \App\Models\DateTimeFormat::create(['format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm']); + \App\Models\DateTimeFormat::create(['format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm']); - \App\Models\DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013')); - \App\Models\DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013')); - \App\Models\DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013')); - \App\Models\DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013')); - \App\Models\DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013')); - \App\Models\DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013')); - \App\Models\DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013')); + \App\Models\DateFormat::create(['format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013']); + \App\Models\DateFormat::create(['format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013']); + \App\Models\DateFormat::create(['format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013']); + \App\Models\DateFormat::create(['format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013']); + \App\Models\DateFormat::create(['format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013']); + \App\Models\DateFormat::create(['format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013']); + \App\Models\DateFormat::create(['format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013']); - /* + /* d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05. D, DD: Abbreviated and full weekday names, respectively. Eg, Mon, Monday. m, mm: Numeric month, no leading zero and leading zero, respectively. Eg, 7, 07. @@ -413,126 +409,123 @@ class ConstantsSeeder extends Seeder { yy, yyyy: 2- and 4-digit years, respectively. Eg, 12, 2012.) */ - - - $timezones = array( - 'Pacific/Midway' => "(GMT-11:00) Midway Island", - 'US/Samoa' => "(GMT-11:00) Samoa", - 'US/Hawaii' => "(GMT-10:00) Hawaii", - 'US/Alaska' => "(GMT-09:00) Alaska", - 'US/Pacific' => "(GMT-08:00) Pacific Time (US & Canada)", - 'America/Tijuana' => "(GMT-08:00) Tijuana", - 'US/Arizona' => "(GMT-07:00) Arizona", - 'US/Mountain' => "(GMT-07:00) Mountain Time (US & Canada)", - 'America/Chihuahua' => "(GMT-07:00) Chihuahua", - 'America/Mazatlan' => "(GMT-07:00) Mazatlan", - 'America/Mexico_City' => "(GMT-06:00) Mexico City", - 'America/Monterrey' => "(GMT-06:00) Monterrey", - 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", - 'US/Central' => "(GMT-06:00) Central Time (US & Canada)", - 'US/Eastern' => "(GMT-05:00) Eastern Time (US & Canada)", - 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", - 'America/Bogota' => "(GMT-05:00) Bogota", - 'America/Lima' => "(GMT-05:00) Lima", - 'America/Caracas' => "(GMT-04:30) Caracas", - 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", - 'America/La_Paz' => "(GMT-04:00) La Paz", - 'America/Santiago' => "(GMT-04:00) Santiago", - 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", - 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", - 'Greenland' => "(GMT-03:00) Greenland", - 'Atlantic/Stanley' => "(GMT-02:00) Stanley", - 'Atlantic/Azores' => "(GMT-01:00) Azores", - 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", - 'Africa/Casablanca' => "(GMT) Casablanca", - 'Europe/Dublin' => "(GMT) Dublin", - 'Europe/Lisbon' => "(GMT) Lisbon", - 'Europe/London' => "(GMT) London", - 'Africa/Monrovia' => "(GMT) Monrovia", - 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", - 'Europe/Belgrade' => "(GMT+01:00) Belgrade", - 'Europe/Berlin' => "(GMT+01:00) Berlin", - 'Europe/Bratislava' => "(GMT+01:00) Bratislava", - 'Europe/Brussels' => "(GMT+01:00) Brussels", - 'Europe/Budapest' => "(GMT+01:00) Budapest", - 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", - 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", - 'Europe/Madrid' => "(GMT+01:00) Madrid", - 'Europe/Paris' => "(GMT+01:00) Paris", - 'Europe/Prague' => "(GMT+01:00) Prague", - 'Europe/Rome' => "(GMT+01:00) Rome", - 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", - 'Europe/Skopje' => "(GMT+01:00) Skopje", - 'Europe/Stockholm' => "(GMT+01:00) Stockholm", - 'Europe/Vienna' => "(GMT+01:00) Vienna", - 'Europe/Warsaw' => "(GMT+01:00) Warsaw", - 'Europe/Zagreb' => "(GMT+01:00) Zagreb", - 'Europe/Athens' => "(GMT+02:00) Athens", - 'Europe/Bucharest' => "(GMT+02:00) Bucharest", - 'Africa/Cairo' => "(GMT+02:00) Cairo", - 'Africa/Harare' => "(GMT+02:00) Harare", - 'Europe/Helsinki' => "(GMT+02:00) Helsinki", - 'Europe/Istanbul' => "(GMT+02:00) Istanbul", - 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", - 'Europe/Kiev' => "(GMT+02:00) Kyiv", - 'Europe/Minsk' => "(GMT+02:00) Minsk", - 'Europe/Riga' => "(GMT+02:00) Riga", - 'Europe/Sofia' => "(GMT+02:00) Sofia", - 'Europe/Tallinn' => "(GMT+02:00) Tallinn", - 'Europe/Vilnius' => "(GMT+02:00) Vilnius", - 'Asia/Baghdad' => "(GMT+03:00) Baghdad", - 'Asia/Kuwait' => "(GMT+03:00) Kuwait", - 'Africa/Nairobi' => "(GMT+03:00) Nairobi", - 'Asia/Riyadh' => "(GMT+03:00) Riyadh", - 'Asia/Tehran' => "(GMT+03:30) Tehran", - 'Europe/Moscow' => "(GMT+04:00) Moscow", - 'Asia/Baku' => "(GMT+04:00) Baku", - 'Europe/Volgograd' => "(GMT+04:00) Volgograd", - 'Asia/Muscat' => "(GMT+04:00) Muscat", - 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", - 'Asia/Yerevan' => "(GMT+04:00) Yerevan", - 'Asia/Kabul' => "(GMT+04:30) Kabul", - 'Asia/Karachi' => "(GMT+05:00) Karachi", - 'Asia/Tashkent' => "(GMT+05:00) Tashkent", - 'Asia/Kolkata' => "(GMT+05:30) Kolkata", - 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", - 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", - 'Asia/Almaty' => "(GMT+06:00) Almaty", - 'Asia/Dhaka' => "(GMT+06:00) Dhaka", - 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", - 'Asia/Bangkok' => "(GMT+07:00) Bangkok", - 'Asia/Jakarta' => "(GMT+07:00) Jakarta", - 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", - 'Asia/Chongqing' => "(GMT+08:00) Chongqing", - 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", - 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", - 'Australia/Perth' => "(GMT+08:00) Perth", - 'Asia/Singapore' => "(GMT+08:00) Singapore", - 'Asia/Taipei' => "(GMT+08:00) Taipei", - 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", - 'Asia/Urumqi' => "(GMT+08:00) Urumqi", - 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", - 'Asia/Seoul' => "(GMT+09:00) Seoul", - 'Asia/Tokyo' => "(GMT+09:00) Tokyo", - 'Australia/Adelaide' => "(GMT+09:30) Adelaide", - 'Australia/Darwin' => "(GMT+09:30) Darwin", - 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", - 'Australia/Brisbane' => "(GMT+10:00) Brisbane", - 'Australia/Canberra' => "(GMT+10:00) Canberra", - 'Pacific/Guam' => "(GMT+10:00) Guam", - 'Australia/Hobart' => "(GMT+10:00) Hobart", - 'Australia/Melbourne' => "(GMT+10:00) Melbourne", - 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", - 'Australia/Sydney' => "(GMT+10:00) Sydney", - 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", - 'Asia/Magadan' => "(GMT+12:00) Magadan", - 'Pacific/Auckland' => "(GMT+12:00) Auckland", - 'Pacific/Fiji' => "(GMT+12:00) Fiji", - ); + $timezones = [ + 'Pacific/Midway' => '(GMT-11:00) Midway Island', + 'US/Samoa' => '(GMT-11:00) Samoa', + 'US/Hawaii' => '(GMT-10:00) Hawaii', + 'US/Alaska' => '(GMT-09:00) Alaska', + 'US/Pacific' => '(GMT-08:00) Pacific Time (US & Canada)', + 'America/Tijuana' => '(GMT-08:00) Tijuana', + 'US/Arizona' => '(GMT-07:00) Arizona', + 'US/Mountain' => '(GMT-07:00) Mountain Time (US & Canada)', + 'America/Chihuahua' => '(GMT-07:00) Chihuahua', + 'America/Mazatlan' => '(GMT-07:00) Mazatlan', + 'America/Mexico_City' => '(GMT-06:00) Mexico City', + 'America/Monterrey' => '(GMT-06:00) Monterrey', + 'Canada/Saskatchewan' => '(GMT-06:00) Saskatchewan', + 'US/Central' => '(GMT-06:00) Central Time (US & Canada)', + 'US/Eastern' => '(GMT-05:00) Eastern Time (US & Canada)', + 'US/East-Indiana' => '(GMT-05:00) Indiana (East)', + 'America/Bogota' => '(GMT-05:00) Bogota', + 'America/Lima' => '(GMT-05:00) Lima', + 'America/Caracas' => '(GMT-04:30) Caracas', + 'Canada/Atlantic' => '(GMT-04:00) Atlantic Time (Canada)', + 'America/La_Paz' => '(GMT-04:00) La Paz', + 'America/Santiago' => '(GMT-04:00) Santiago', + 'Canada/Newfoundland' => '(GMT-03:30) Newfoundland', + 'America/Buenos_Aires' => '(GMT-03:00) Buenos Aires', + 'Greenland' => '(GMT-03:00) Greenland', + 'Atlantic/Stanley' => '(GMT-02:00) Stanley', + 'Atlantic/Azores' => '(GMT-01:00) Azores', + 'Atlantic/Cape_Verde' => '(GMT-01:00) Cape Verde Is.', + 'Africa/Casablanca' => '(GMT) Casablanca', + 'Europe/Dublin' => '(GMT) Dublin', + 'Europe/Lisbon' => '(GMT) Lisbon', + 'Europe/London' => '(GMT) London', + 'Africa/Monrovia' => '(GMT) Monrovia', + 'Europe/Amsterdam' => '(GMT+01:00) Amsterdam', + 'Europe/Belgrade' => '(GMT+01:00) Belgrade', + 'Europe/Berlin' => '(GMT+01:00) Berlin', + 'Europe/Bratislava' => '(GMT+01:00) Bratislava', + 'Europe/Brussels' => '(GMT+01:00) Brussels', + 'Europe/Budapest' => '(GMT+01:00) Budapest', + 'Europe/Copenhagen' => '(GMT+01:00) Copenhagen', + 'Europe/Ljubljana' => '(GMT+01:00) Ljubljana', + 'Europe/Madrid' => '(GMT+01:00) Madrid', + 'Europe/Paris' => '(GMT+01:00) Paris', + 'Europe/Prague' => '(GMT+01:00) Prague', + 'Europe/Rome' => '(GMT+01:00) Rome', + 'Europe/Sarajevo' => '(GMT+01:00) Sarajevo', + 'Europe/Skopje' => '(GMT+01:00) Skopje', + 'Europe/Stockholm' => '(GMT+01:00) Stockholm', + 'Europe/Vienna' => '(GMT+01:00) Vienna', + 'Europe/Warsaw' => '(GMT+01:00) Warsaw', + 'Europe/Zagreb' => '(GMT+01:00) Zagreb', + 'Europe/Athens' => '(GMT+02:00) Athens', + 'Europe/Bucharest' => '(GMT+02:00) Bucharest', + 'Africa/Cairo' => '(GMT+02:00) Cairo', + 'Africa/Harare' => '(GMT+02:00) Harare', + 'Europe/Helsinki' => '(GMT+02:00) Helsinki', + 'Europe/Istanbul' => '(GMT+02:00) Istanbul', + 'Asia/Jerusalem' => '(GMT+02:00) Jerusalem', + 'Europe/Kiev' => '(GMT+02:00) Kyiv', + 'Europe/Minsk' => '(GMT+02:00) Minsk', + 'Europe/Riga' => '(GMT+02:00) Riga', + 'Europe/Sofia' => '(GMT+02:00) Sofia', + 'Europe/Tallinn' => '(GMT+02:00) Tallinn', + 'Europe/Vilnius' => '(GMT+02:00) Vilnius', + 'Asia/Baghdad' => '(GMT+03:00) Baghdad', + 'Asia/Kuwait' => '(GMT+03:00) Kuwait', + 'Africa/Nairobi' => '(GMT+03:00) Nairobi', + 'Asia/Riyadh' => '(GMT+03:00) Riyadh', + 'Asia/Tehran' => '(GMT+03:30) Tehran', + 'Europe/Moscow' => '(GMT+04:00) Moscow', + 'Asia/Baku' => '(GMT+04:00) Baku', + 'Europe/Volgograd' => '(GMT+04:00) Volgograd', + 'Asia/Muscat' => '(GMT+04:00) Muscat', + 'Asia/Tbilisi' => '(GMT+04:00) Tbilisi', + 'Asia/Yerevan' => '(GMT+04:00) Yerevan', + 'Asia/Kabul' => '(GMT+04:30) Kabul', + 'Asia/Karachi' => '(GMT+05:00) Karachi', + 'Asia/Tashkent' => '(GMT+05:00) Tashkent', + 'Asia/Kolkata' => '(GMT+05:30) Kolkata', + 'Asia/Kathmandu' => '(GMT+05:45) Kathmandu', + 'Asia/Yekaterinburg' => '(GMT+06:00) Ekaterinburg', + 'Asia/Almaty' => '(GMT+06:00) Almaty', + 'Asia/Dhaka' => '(GMT+06:00) Dhaka', + 'Asia/Novosibirsk' => '(GMT+07:00) Novosibirsk', + 'Asia/Bangkok' => '(GMT+07:00) Bangkok', + 'Asia/Jakarta' => '(GMT+07:00) Jakarta', + 'Asia/Krasnoyarsk' => '(GMT+08:00) Krasnoyarsk', + 'Asia/Chongqing' => '(GMT+08:00) Chongqing', + 'Asia/Hong_Kong' => '(GMT+08:00) Hong Kong', + 'Asia/Kuala_Lumpur' => '(GMT+08:00) Kuala Lumpur', + 'Australia/Perth' => '(GMT+08:00) Perth', + 'Asia/Singapore' => '(GMT+08:00) Singapore', + 'Asia/Taipei' => '(GMT+08:00) Taipei', + 'Asia/Ulaanbaatar' => '(GMT+08:00) Ulaan Bataar', + 'Asia/Urumqi' => '(GMT+08:00) Urumqi', + 'Asia/Irkutsk' => '(GMT+09:00) Irkutsk', + 'Asia/Seoul' => '(GMT+09:00) Seoul', + 'Asia/Tokyo' => '(GMT+09:00) Tokyo', + 'Australia/Adelaide' => '(GMT+09:30) Adelaide', + 'Australia/Darwin' => '(GMT+09:30) Darwin', + 'Asia/Yakutsk' => '(GMT+10:00) Yakutsk', + 'Australia/Brisbane' => '(GMT+10:00) Brisbane', + 'Australia/Canberra' => '(GMT+10:00) Canberra', + 'Pacific/Guam' => '(GMT+10:00) Guam', + 'Australia/Hobart' => '(GMT+10:00) Hobart', + 'Australia/Melbourne' => '(GMT+10:00) Melbourne', + 'Pacific/Port_Moresby' => '(GMT+10:00) Port Moresby', + 'Australia/Sydney' => '(GMT+10:00) Sydney', + 'Asia/Vladivostok' => '(GMT+11:00) Vladivostok', + 'Asia/Magadan' => '(GMT+12:00) Magadan', + 'Pacific/Auckland' => '(GMT+12:00) Auckland', + 'Pacific/Fiji' => '(GMT+12:00) Fiji', + ]; foreach ($timezones as $name => $location) { - \App\Models\Timezone::create(array('name' => $name, 'location' => $location)); + \App\Models\Timezone::create(['name' => $name, 'location' => $location]); } } - } diff --git a/database/seeds/CountriesSeeder.php b/database/seeds/CountriesSeeder.php index cf52bd96..3b3c75a6 100644 --- a/database/seeds/CountriesSeeder.php +++ b/database/seeds/CountriesSeeder.php @@ -1,10 +1,9 @@ $country){ - DB::table('Countries')->insert(array( - 'id' => $countryId, - 'capital' => ((isset($country['capital'])) ? $country['capital'] : null), - 'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null), - 'country_code' => $country['country-code'], - 'currency' => ((isset($country['currency'])) ? $country['currency'] : null), - 'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null), + foreach ($countries as $countryId => $country) { + DB::table('Countries')->insert([ + 'id' => $countryId, + 'capital' => ((isset($country['capital'])) ? $country['capital'] : null), + 'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null), + 'country_code' => $country['country-code'], + 'currency' => ((isset($country['currency'])) ? $country['currency'] : null), + 'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null), 'currency_sub_unit' => ((isset($country['currency_sub_unit'])) ? $country['currency_sub_unit'] : null), - 'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null), - 'iso_3166_2' => $country['iso_3166_2'], - 'iso_3166_3' => $country['iso_3166_3'], - 'name' => $country['name'], - 'region_code' => $country['region-code'], - 'sub_region_code' => $country['sub-region-code'], - 'eea' => (bool)$country['eea'] - )); + 'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null), + 'iso_3166_2' => $country['iso_3166_2'], + 'iso_3166_3' => $country['iso_3166_3'], + 'name' => $country['name'], + 'region_code' => $country['region-code'], + 'sub_region_code' => $country['sub-region-code'], + 'eea' => (bool) $country['eea'], + ]); } } -} \ No newline at end of file +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index a310855c..6104c4b3 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -2,23 +2,22 @@ use Illuminate\Database\Seeder; -class DatabaseSeeder extends Seeder { - +class DatabaseSeeder extends Seeder +{ /** * Run the database seeds. * * @return void */ - public function run() { + public function run() + { Eloquent::unguard(); - $this->call('ConstantsSeeder'); $this->command->info('Seeded the constants!'); - + // $this->call('UserTableSeeder'); $this->call('CountriesSeeder'); $this->command->info('Seeded the countries!'); } - } diff --git a/public/index.php b/public/index.php index 05322e9f..79772fd6 100644 --- a/public/index.php +++ b/public/index.php @@ -1,8 +1,7 @@ */ @@ -49,7 +48,7 @@ $app = require_once __DIR__.'/../bootstrap/app.php'; $kernel = $app->make('Illuminate\Contracts\Http\Kernel'); $response = $kernel->handle( - $request = Illuminate\Http\Request::capture() + $request = Illuminate\Http\Request::capture() ); $response->send(); diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index 13b4dcb3..fcab34b2 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -2,18 +2,18 @@ return [ - /* - |-------------------------------------------------------------------------- - | Pagination Language Lines - |-------------------------------------------------------------------------- - | - | The following language lines are used by the paginator library to build - | the simple pagination links. You are free to change them to anything - | you want to customize your views to better match your application. - | - */ + /* + |-------------------------------------------------------------------------- + | Pagination Language Lines + |-------------------------------------------------------------------------- + | + | The following language lines are used by the paginator library to build + | the simple pagination links. You are free to change them to anything + | you want to customize your views to better match your application. + | + */ - 'previous' => '« Previous', - 'next' => 'Next »', + 'previous' => '« Previous', + 'next' => 'Next »', ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index 1fc0e1ef..195340ae 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -2,21 +2,21 @@ return [ - /* - |-------------------------------------------------------------------------- - | Password Reminder Language Lines - |-------------------------------------------------------------------------- - | - | The following language lines are the default lines which match reasons - | that are given by the password broker for a password update attempt - | has failed, such as for an invalid token or invalid new password. - | - */ + /* + |-------------------------------------------------------------------------- + | Password Reminder Language Lines + |-------------------------------------------------------------------------- + | + | The following language lines are the default lines which match reasons + | that are given by the password broker for a password update attempt + | has failed, such as for an invalid token or invalid new password. + | + */ - "password" => "Passwords must be at least six characters and match the confirmation.", - "user" => "We can't find a user with that e-mail address.", - "token" => "This password reset token is invalid.", - "sent" => "We have e-mailed your password reset link!", - "reset" => "Your password has been reset!", + 'password' => 'Passwords must be at least six characters and match the confirmation.', + 'user' => "We can't find a user with that e-mail address.", + 'token' => 'This password reset token is invalid.', + 'sent' => 'We have e-mailed your password reset link!', + 'reset' => 'Your password has been reset!', ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 764f0563..ff1c0877 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -2,106 +2,106 @@ return [ - /* - |-------------------------------------------------------------------------- - | Validation Language Lines - |-------------------------------------------------------------------------- - | - | The following language lines contain the default error messages used by - | the validator class. Some of these rules have multiple versions such - | as the size rules. Feel free to tweak each of these messages here. - | - */ + /* + |-------------------------------------------------------------------------- + | Validation Language Lines + |-------------------------------------------------------------------------- + | + | The following language lines contain the default error messages used by + | the validator class. Some of these rules have multiple versions such + | as the size rules. Feel free to tweak each of these messages here. + | + */ - "accepted" => "The :attribute must be accepted.", - "active_url" => "The :attribute is not a valid URL.", - "after" => "The :attribute must be a date after :date.", - "alpha" => "The :attribute may only contain letters.", - "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", - "alpha_num" => "The :attribute may only contain letters and numbers.", - "array" => "The :attribute must be an array.", - "before" => "The :attribute must be a date before :date.", - "between" => [ - "numeric" => "The :attribute must be between :min and :max.", - "file" => "The :attribute must be between :min and :max kilobytes.", - "string" => "The :attribute must be between :min and :max characters.", - "array" => "The :attribute must have between :min and :max items.", - ], - "boolean" => "The :attribute field must be true or false.", - "confirmed" => "The :attribute confirmation does not match.", - "date" => "The :attribute is not a valid date.", - "date_format" => "The :attribute does not match the format :format.", - "different" => "The :attribute and :other must be different.", - "digits" => "The :attribute must be :digits digits.", - "digits_between" => "The :attribute must be between :min and :max digits.", - "email" => "The :attribute must be a valid email address.", - "filled" => "The :attribute field is required.", - "exists" => "The selected :attribute is invalid.", - "image" => "The :attribute must be an image.", - "in" => "The selected :attribute is invalid.", - "integer" => "The :attribute must be an integer.", - "ip" => "The :attribute must be a valid IP address.", - "max" => [ - "numeric" => "The :attribute may not be greater than :max.", - "file" => "The :attribute may not be greater than :max kilobytes.", - "string" => "The :attribute may not be greater than :max characters.", - "array" => "The :attribute may not have more than :max items.", - ], - "mimes" => "The :attribute must be a file of type: :values.", - "min" => [ - "numeric" => "The :attribute must be at least :min.", - "file" => "The :attribute must be at least :min kilobytes.", - "string" => "The :attribute must be at least :min characters.", - "array" => "The :attribute must have at least :min items.", - ], - "not_in" => "The selected :attribute is invalid.", - "numeric" => "The :attribute must be a number.", - "regex" => "The :attribute format is invalid.", - "required" => "The :attribute field is required.", - "required_if" => "The :attribute field is required when :other is :value.", - "required_with" => "The :attribute field is required when :values is present.", - "required_with_all" => "The :attribute field is required when :values is present.", - "required_without" => "The :attribute field is required when :values is not present.", - "required_without_all" => "The :attribute field is required when none of :values are present.", - "same" => "The :attribute and :other must match.", - "size" => [ - "numeric" => "The :attribute must be :size.", - "file" => "The :attribute must be :size kilobytes.", - "string" => "The :attribute must be :size characters.", - "array" => "The :attribute must contain :size items.", - ], - "unique" => "The :attribute has already been taken.", - "url" => "The :attribute format is invalid.", - "timezone" => "The :attribute must be a valid zone.", + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'between' => [ + 'numeric' => 'The :attribute must be between :min and :max.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'email' => 'The :attribute must be a valid email address.', + 'filled' => 'The :attribute field is required.', + 'exists' => 'The selected :attribute is invalid.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'max' => [ + 'numeric' => 'The :attribute may not be greater than :max.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', + ], + 'mimes' => 'The :attribute must be a file of type: :values.', + 'min' => [ + 'numeric' => 'The :attribute must be at least :min.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', + ], + 'not_in' => 'The selected :attribute is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute and :other must match.', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'unique' => 'The :attribute has already been taken.', + 'url' => 'The :attribute format is invalid.', + 'timezone' => 'The :attribute must be a valid zone.', - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as E-Mail Address instead - | of "email". This simply helps us make messages a little cleaner. - | - */ + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap attribute place-holders + | with something more reader friendly such as E-Mail Address instead + | of "email". This simply helps us make messages a little cleaner. + | + */ - 'attributes' => [], + 'attributes' => [], ]; diff --git a/server.php b/server.php index 8f375877..b8cec5a0 100644 --- a/server.php +++ b/server.php @@ -1,21 +1,18 @@ */ - $uri = urldecode( - parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel // application without having installed a "real" web server software here. -if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri)) -{ - return false; +if ($uri !== '/' and file_exists(__DIR__.'/public'.$uri)) { + return false; } require_once __DIR__.'/public/index.php'; diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index b22228a9..be47b9f6 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -1,15 +1,13 @@ make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - return $app; - } + $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); + return $app; + } }