Applied fixes from StyleCI

This commit is contained in:
Attendize 2016-03-04 19:18:10 -05:00 committed by StyleCI Bot
parent 9167653114
commit b3f33a38e8
119 changed files with 3910 additions and 3982 deletions

View File

@ -1,9 +1,9 @@
<?php namespace App\Attendize; <?php
namespace App\Attendize;
class Utils class Utils
{ {
public static function isRegistered() public static function isRegistered()
{ {
return Auth::check() && Auth::user()->is_registered; return Auth::check() && Auth::user()->is_registered;
@ -30,7 +30,8 @@ class Utils
* *
* @return bool * @return bool
*/ */
public static function isAttendize() { public static function isAttendize()
{
return self::isAttendizeCloud() || self::isAttendizeDev(); return self::isAttendizeCloud() || self::isAttendizeDev();
} }
@ -56,11 +57,11 @@ class Utils
public static function isDownForMaintenance() 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; static $max_size = -1;
if ($max_size < 0) { if ($max_size < 0) {
@ -74,18 +75,19 @@ class Utils
$max_size = $upload_max; $max_size = $upload_max;
} }
} }
return $max_size; 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. $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. $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
if ($unit) { if ($unit) {
// Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by. // 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]))); return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
} } else {
else {
return round($size); return round($size);
} }
} }
} }

View File

@ -1,60 +1,62 @@
<?php namespace App\Attendize\handlers; <?php
namespace App\Attendize\handlers;
use App\Attendize\mailers\OrderMailer; use App\Attendize\mailers\OrderMailer;
use Order;
use Attendee; use Attendee;
use Order;
//use PDF; //use PDF;
class QueueHandler { class QueueHandler
{
protected $orderMailer; protected $orderMailer;
public function __construct(OrderMailer $orderMailer) { public function __construct(OrderMailer $orderMailer)
{
$this->orderMailer = $orderMailer; $this->orderMailer = $orderMailer;
} }
public function handleOrder($job, $data)
public function handleOrder($job, $data) { {
echo "Starting Job {$job->getJobId()}\n"; echo "Starting Job {$job->getJobId()}\n";
$order = Order::findOrfail($data['order_id']); $order = Order::findOrfail($data['order_id']);
/* /*
* Steps : * Steps :
* 1 Notify event organiser * 1 Notify event organiser
* 2 Order Confirmation email to buyer * 2 Order Confirmation email to buyer
* 3 Generate / Send Tickets * 3 Generate / Send Tickets
*/ */
$data = [ $data = [
'order' => $order, 'order' => $order,
'event' => $order->event, 'event' => $order->event,
'tickets' => $order->event->tickets, 'tickets' => $order->event->tickets,
'attendees' => $order->attendees 'attendees' => $order->attendees,
]; ];
$pdf_file = storage_path().'/'.$order->order_reference; $pdf_file = storage_path().'/'.$order->order_reference;
exit($pdf_file); exit($pdf_file);
PDF::setOutputMode('F'); // force to 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 //1
$this->orderMailer->sendOrderNotification($order); $this->orderMailer->sendOrderNotification($order);
//2 //2
$this->orderMailer->sendOrderConfirmation($order); $this->orderMailer->sendOrderConfirmation($order);
//3 //3
$this->orderMailer->sendTickets($order); $this->orderMailer->sendTickets($order);
$job->delete(); $job->delete();
} }
public function messageAttendees($job, $data) { public function messageAttendees($job, $data)
{
echo "Starting Job {$job->getJobId()}\n"; echo "Starting Job {$job->getJobId()}\n";
$message_object = Message::find($data['message_id']); $message_object = Message::find($data['message_id']);
$event = $message_object->event; $event = $message_object->event;
@ -67,25 +69,22 @@ class QueueHandler {
} }
$data = [ $data = [
'event' => $event, 'event' => $event,
'message_content' => $message_object->message, '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) $message->to($toFields)
->from(config('attendize.outgoing_email_noreply'), $event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $event->organiser->name)
->replyTo($event->organiser->email, $event->organiser->name) ->replyTo($event->organiser->email, $event->organiser->name)
->subject($message_object->subject); ->subject($message_object->subject);
}); });
$message_object->is_sent = 1; $message_object->is_sent = 1;
$message_object->save(); $message_object->save();
//$message->sent //$message->sent
$job->delete(); $job->delete();
} }
} }

View File

@ -2,15 +2,15 @@
namespace App\Attendize\mailers; namespace App\Attendize\mailers;
use Mail;
use App\Models\Attendee; use App\Models\Attendee;
use App\Models\Message; use App\Models\Message;
use Carbon\Carbon; use Carbon\Carbon;
use Mail;
class AttendeeMailer extends Mailer { class AttendeeMailer extends Mailer
{
public function sendMessageToAttendees(Message $message_object) { public function sendMessageToAttendees(Message $message_object)
{
$event = $message_object->event; $event = $message_object->event;
$attendees = ($message_object->recipients == 0) $attendees = ($message_object->recipients == 0)
@ -23,26 +23,23 @@ class AttendeeMailer extends Mailer {
} }
$data = [ $data = [
'event' => $event, 'event' => $event,
'message_content' => $message_object->message, 'message_content' => $message_object->message,
'subject' => $message_object->subject 'subject' => $message_object->subject,
]; ];
/* /*
* Mandril lets us send the email to multiple people at once. * 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) $message->to($toFields)
->from(config('attendize.outgoing_email_noreply'), $event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $event->organiser->name)
->replyTo($event->organiser->email, $event->organiser->name) ->replyTo($event->organiser->email, $event->organiser->name)
->subject($message_object->subject); ->subject($message_object->subject);
}); });
$message_object->is_sent = 1; $message_object->is_sent = 1;
$message_object->sent_at = Carbon::now(); $message_object->sent_at = Carbon::now();
$message_object->save(); $message_object->save();
} }
} }

View File

@ -1,11 +1,12 @@
<?php namespace App\Attendize\mailers; <?php
namespace App\Attendize\mailers;
use Mail; use Mail;
class Mailer class Mailer
{ {
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [], $attachment = false)
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [], $attachment = FALSE)
{ {
Mail::send($view, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $attachment) { Mail::send($view, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $attachment) {
$replyEmail = $fromEmail; $replyEmail = $fromEmail;
@ -22,4 +23,4 @@ class Mailer
->subject($subject); ->subject($subject);
}); });
} }
} }

View File

@ -1,35 +1,36 @@
<?php namespace App\Attendize\mailers; <?php
namespace App\Attendize\mailers;
use App\Models\Order; use App\Models\Order;
class OrderMailer extends Mailer { class OrderMailer extends Mailer
{
public function sendOrderNotification(Order $order)
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', [ $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 'order' => $order,
]); ]);
} }
public function sendOrderConfirmation(Order $order) { public function sendOrderConfirmation(Order $order)
{
$ticket_pdf = public_path($order->ticket_pdf_path); $ticket_pdf = public_path($order->ticket_pdf_path);
if(!file_exists($ticket_pdf)){ if (!file_exists($ticket_pdf)) {
$ticket_pdf = FALSE; $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', [ $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, 'order' => $order,
'email_logo' => $order->event->organiser->full_logo_path 'email_logo' => $order->event->organiser->full_logo_path,
], $ticket_pdf); ], $ticket_pdf);
} }
public function sendTickets(Order $order) { 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', [ {
// $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 // 'order' => $order
// ]); // ]);
} }
} }

View File

@ -5,10 +5,11 @@
*/ */
/** /**
* Description of UserMailer * Description of UserMailer.
* *
* @author Dave * @author Dave
*/ */
class UserMailer { class UserMailer
{
//put your code here //put your code here
} }

View File

@ -1,7 +1,8 @@
<?php namespace App\Commands; <?php
abstract class Command { namespace App\Commands;
//
abstract class Command
{
//
} }

View File

@ -2,34 +2,33 @@
namespace App\Commands; 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\AttendeeMailer; use App\Attendize\mailers\AttendeeMailer;
use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldBeQueued;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Log;
class MessageAttendeesCommand extends Command implements ShouldBeQueued, SelfHandling { class MessageAttendeesCommand extends Command implements ShouldBeQueued, SelfHandling
{
use InteractsWithQueue, use InteractsWithQueue,
SerializesModels; SerializesModels;
public $attendeeMessage; public $attendeeMessage;
public function __construct(\App\Models\Message $attendeeMessage)
public function __construct(\App\Models\Message $attendeeMessage) { {
$this->attendeeMessage = $attendeeMessage; $this->attendeeMessage = $attendeeMessage;
} }
function handle(AttendeeMailer $mailer) { public function handle(AttendeeMailer $mailer)
Log::info(date('d m y H:i') . " - Starting Job {$this->job->getJobId()} ".__CLASS__); {
Log::info(date('d m y H:i')." - Starting Job {$this->job->getJobId()} ".__CLASS__);
$mailer->sendMessageToAttendees($this->attendeeMessage); $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(); $this->delete();
} }
} }

View File

@ -2,16 +2,15 @@
namespace App\Commands; 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 App\Attendize\mailers\OrderMailer;
use Illuminate\Contracts\Bus\SelfHandling; 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, use InteractsWithQueue,
SerializesModels; SerializesModels;
@ -20,10 +19,12 @@ class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandlin
/** /**
* OrderTicketsCommand constructor. * OrderTicketsCommand constructor.
*
* @param \App\Models\Order $ticketOrder * @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->ticketOrder = $ticketOrder;
$this->sendOrderConfirmation = $sendOrderConfirmation; $this->sendOrderConfirmation = $sendOrderConfirmation;
} }
@ -31,24 +32,23 @@ class OrderTicketsCommand extends Command implements ShouldBeQueued, SelfHandlin
/** /**
* @param OrderMailer $mailer * @param OrderMailer $mailer
*/ */
function handle(OrderMailer $mailer) { public function handle(OrderMailer $mailer)
{
Log::info(date('d m y H:i') . " - Starting Job {$this->job->getJobId()} ".__CLASS__); Log::info(date('d m y H:i')." - Starting Job {$this->job->getJobId()} ".__CLASS__);
//1 - Notify event organiser //1 - Notify event organiser
if($this->sendOrderConfirmation) { if ($this->sendOrderConfirmation) {
$mailer->sendOrderNotification($this->ticketOrder); $mailer->sendOrderNotification($this->ticketOrder);
} }
//2 - Generate PDF Tickets //2 - Generate PDF Tickets
$this->ticketOrder->generatePdfTickets(); $this->ticketOrder->generatePdfTickets();
//3 - Send Tickets / Order confirmation //3 - Send Tickets / Order confirmation
$mailer->sendOrderConfirmation($this->ticketOrder); $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(); $this->delete();
} }
} }

View File

@ -1,4 +1,6 @@
<?php namespace App\Console\Commands; <?php
namespace App\Console\Commands;
use App\Models\Timezone; use App\Models\Timezone;
use DB; use DB;
@ -7,60 +9,59 @@ use Illuminate\Support\Facades\Artisan;
class Install extends Command class Install extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
* @var string * @var string
*/ */
protected $signature = 'attendize:install'; protected $signature = 'attendize:install';
/** /**
* The console command description. * The console command description.
* *
* @var string * @var string
*/ */
protected $description = 'Install of Attendize'; protected $description = 'Install of Attendize';
/** /**
* Execute the console command. * Execute the console command.
* *
* @return mixed * @return mixed
*/ */
public function handle() public function handle()
{ {
$version = file_get_contents(base_path('VERSION')); $version = file_get_contents(base_path('VERSION'));
try { try {
DB::connection(); DB::connection();
} catch (\Exception $e) { } catch (\Exception $e) {
$this->error('Unable to connect to database.'); $this->error('Unable to connect to database.');
$this->error('Please fill valid database credentials into .env and rerun this command.'); $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')) { if (!env('APP_KEY')) {
$this->info('Generating app key'); $this->info('Generating app key');
Artisan::call('key:generate'); Artisan::call('key:generate');
} else { } else {
$this->comment('App key exists -- skipping'); $this->comment('App key exists -- skipping');
} }
$this->info('Migrating database');
Artisan::call('migrate', ['--force' => true]);
$this->info('Migrating database'); if (!Timezone::count()) {
Artisan::call('migrate', ['--force' => true]); $this->info('Seeding DB data');
Artisan::call('db:seed', ['--force' => true]);
} else {
$this->comment('Data already seeded -- skipping');
}
if (!Timezone::count()) { file_put_contents(base_path('installed'), $version);
$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); $this->comment('Success! You can now run Attendize');
$this->comment('Navigate to /signup to create your account.');
$this->comment('Success! You can now run Attendize'); }
$this->comment('Navigate to /signup to create your account.'); }
}
}

View File

@ -1,27 +1,29 @@
<?php namespace App\Console; <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel { class Kernel extends ConsoleKernel
{
/** /**
* The Artisan commands provided by your application. * The Artisan commands provided by your application.
* *
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
Commands\Install::class Commands\Install::class,
]; ];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
}
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
}
} }

View File

@ -1,7 +1,8 @@
<?php namespace App\Events; <?php
abstract class Event { namespace App\Events;
//
abstract class Event
{
//
} }

View File

@ -2,47 +2,51 @@
namespace App\Exceptions; namespace App\Exceptions;
use Exception, Request; use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
//use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler; //use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler { class Handler extends ExceptionHandler
{
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that should not be reported.
* *
* @var array * @var array
*/ */
protected $dontReport = [ protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException' 'Symfony\Component\HttpKernel\Exception\HttpException',
]; ];
/** /**
*
* Report or log an exception. * Report or log an exception.
* *
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* *
* @param \Exception $e * @param \Exception $e
*
* @return void * @return void
*/ */
public function report(Exception $e) { public function report(Exception $e)
{
return parent::report($e); return parent::report($e);
} }
/** /**
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Exception $e * @param \Exception $e
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function render($request, Exception $e) { public function render($request, Exception $e)
{
if ($this->isHttpException($e)) { if ($this->isHttpException($e)) {
return $this->renderHttpException($e); return $this->renderHttpException($e);
} }
if (config('app.debug')) { if (config('app.debug')) {
return $this->renderExceptionWithWhoops($e); return $this->renderExceptionWithWhoops($e);
} }
@ -52,22 +56,23 @@ class Handler extends ExceptionHandler {
/** /**
* Render an exception using Whoops. * Render an exception using Whoops.
* *
* @param \Exception $e * @param \Exception $e
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
protected function renderExceptionWithWhoops(Exception $e) { protected function renderExceptionWithWhoops(Exception $e)
$whoops = new \Whoops\Run; {
$whoops = new \Whoops\Run();
if(Request::ajax()) {
$whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler); if (Request::ajax()) {
$whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
} else { } else {
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
} }
return new \Illuminate\Http\Response( return new \Illuminate\Http\Response(
$whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()
); );
} }
} }

View File

@ -1,33 +1,33 @@
<?php <?php
/** /**
* * @param int $amount
* @param int $amount
* @param string $currency_code * @param string $currency_code
* @param int $decimals * @param int $decimals
* @param string $dec_point * @param string $dec_point
* @param string $thousands_sep * @param string $thousands_sep
*
* @return decimal * @return decimal
*/ */
function money($amount, $currency_code='', $decimals = 2 ,$dec_point = "." , $thousands_sep = "," ) { function money($amount, $currency_code = '', $decimals = 2, $dec_point = '.', $thousands_sep = ',')
{
switch($currency_code) { switch ($currency_code) {
case 'USD' : case 'USD':
case 'AUD' : case 'AUD':
case 'CAD' : case 'CAD':
$currency_symbol = '$'; $currency_symbol = '$';
break; break;
case 'EUR' : case 'EUR':
$currency_symbol = '€'; $currency_symbol = '€';
break; break;
case 'GBP' : case 'GBP':
$currency_symbol = '£'; $currency_symbol = '£';
break; break;
default : default:
$currency_symbol = ''; $currency_symbol = '';
break; break;
} }
return $currency_symbol.number_format($amount, $decimals, $dec_point, $thousands_sep); return $currency_symbol.number_format($amount, $decimals, $dec_point, $thousands_sep);
} }

View File

@ -1,8 +1,7 @@
<?php <?php
Validator::extend('passcheck', function ($attribute, $value, $parameters) Validator::extend('passcheck', function ($attribute, $value, $parameters) {
{
return \Hash::check($value, \Auth::user()->getAuthPassword()); return \Hash::check($value, \Auth::user()->getAuthPassword());
}); });
@ -10,36 +9,35 @@ Validator::extend('passcheck', function ($attribute, $value, $parameters)
* Some macros and blade extensions * 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); $label = Form::label($name, '%s', $options);
return sprintf($label, $value); 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); $label = Form::label($name, '%s', $options);
return sprintf($label, $value) return sprintf($label, $value)
.'<a style="margin-left: 4px;font-size: 11px;" href="javascript:showHelp('."'".$help_text."'".');" >' .'<a style="margin-left: 4px;font-size: 11px;" href="javascript:showHelp('."'".$help_text."'".');" >'
. '<i class="ico ico-question "></i>' .'<i class="ico ico-question "></i>'
. '</a>'; .'</a>';
}); });
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); // $checkbox = Form::checkbox($name, $value = null, $checked, $options);
// $label = Form::rawLabel(); // $label = Form::rawLabel();
// //
// $out = '<div class="checkbox custom-checkbox"> // $out = '<div class="checkbox custom-checkbox">
// <input type="checkbox" name="send_copy" id="send_copy" value="1"> // <input type="checkbox" name="send_copy" id="send_copy" value="1">
// <label for="send_copy">&nbsp;&nbsp;Send a copy to <b>{{$attendee->event->organiser->email}}</b></label> // <label for="send_copy">&nbsp;&nbsp;Send a copy to <b>{{$attendee->event->organiser->email}}</b></label>
// </div>'; // </div>';
// //
// return $out; // return $out;
}); });
Form::macro('styledFile', function($name, $multiple = FALSE) { Form::macro('styledFile', function ($name, $multiple = false) {
$out = '<div class="styledFile" id="input-'.$name.'"> $out = '<div class="styledFile" id="input-'.$name.'">
<div class="input-group"> <div class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
@ -55,17 +53,17 @@ Form::macro('styledFile', function($name, $multiple = FALSE) {
</span> </span>
</div> </div>
</div>'; </div>';
return $out; 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'; $sort_order = $sort_order == 'asc' ? 'desc' : 'asc';
$url_params = http_build_query([ $url_params = http_build_query([
'sort_by' => $sort_by, 'sort_by' => $sort_by,
'sort_order' => $sort_order 'sort_order' => $sort_order,
] + $url_params); ] + $url_params);
$html = "<a href='?$url_params' class='col-sort $class' $extra>"; $html = "<a href='?$url_params' class='col-sort $class' $extra>";
@ -79,10 +77,6 @@ HTML::macro('sortable_link', function($title, $active_sort, $sort_by, $sort_orde
return $html; return $html;
}); });
Blade::directive('money', function ($expression) {
Blade::directive('money', function($expression) {
return "<?php echo number_format($expression, 2); ?>"; return "<?php echo number_format($expression, 2); ?>";
}); });

View File

@ -1,38 +1,40 @@
<?php namespace App\Http\Controllers\Auth; <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar; use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller { class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
/* use AuthenticatesAndRegistersUsers;
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers; /**
* Create a new authentication controller instance.
/** *
* Create a new authentication controller instance. * @param \Illuminate\Contracts\Auth\Guard $auth
* * @param \Illuminate\Contracts\Auth\Registrar $registrar
* @param \Illuminate\Contracts\Auth\Guard $auth *
* @param \Illuminate\Contracts\Auth\Registrar $registrar * @return void
* @return void */
*/ public function __construct(Guard $auth, Registrar $registrar)
public function __construct(Guard $auth, Registrar $registrar) {
{ $this->auth = $auth;
$this->auth = $auth; $this->registrar = $registrar;
$this->registrar = $registrar;
$this->middleware('guest', ['except' => 'getLogout']);
}
$this->middleware('guest', ['except' => 'getLogout']);
}
} }

View File

@ -1,38 +1,38 @@
<?php namespace App\Http\Controllers\Auth; <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
class PasswordController extends Controller { class PasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
/* use ResetsPasswords;
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords; /**
* Create a new password controller instance.
/** *
* Create a new password controller instance. * @param \Illuminate\Contracts\Auth\Guard $auth
* * @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
* @param \Illuminate\Contracts\Auth\Guard $auth *
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords * @return void
* @return void */
*/ public function __construct()
public function __construct() {
{ $this->auth = $auth;
$this->auth = $auth; $this->passwords = $passwords;
$this->passwords = $passwords;
$this->middleware('guest');
}
$this->middleware('guest');
}
} }

View File

@ -1,11 +1,12 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesCommands; use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
abstract class Controller extends BaseController { abstract class Controller extends BaseController
{
use DispatchesCommands, ValidatesRequests; use DispatchesCommands, ValidatesRequests;
} }

View File

@ -2,116 +2,110 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input, use App\Commands\OrderTicketsCommand;
DB, use App\Models\Attendee;
Auth,
Mail,
Response,
View,
Excel,
Session,
Validator;
use App\Models\Event; use App\Models\Event;
use App\Models\EventStats; use App\Models\EventStats;
use App\Models\Order;
use App\Models\Ticket;
use App\Models\Attendee;
use App\Models\OrderItem;
use App\Models\Message; use App\Models\Message;
use App\Commands\MessageAttendeesCommand; use App\Models\Order;
use App\Commands\OrderTicketsCommand; use App\Models\OrderItem;
use App\Models\Ticket;
class EventAttendeesController extends MyBaseController { use Auth;
use DB;
public function showAttendees($event_id) { use Excel;
use Input;
use Mail;
use Response;
use Session;
use Validator;
use View;
class EventAttendeesController extends MyBaseController
{
public function showAttendees($event_id)
{
$allowed_sorts = ['first_name', 'email', 'ticket_id', 'order_reference']; $allowed_sorts = ['first_name', 'email', 'ticket_id', 'order_reference'];
$searchQuery = Input::get('q'); $searchQuery = Input::get('q');
$sort_order = Input::get('sort_order') == 'asc' ? 'asc' : 'desc'; $sort_order = Input::get('sort_order') == 'asc' ? 'asc' : 'desc';
$sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'created_at'); $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'created_at');
$event = Event::scope()->find($event_id); $event = Event::scope()->find($event_id);
//$event = Event::scope()->join('orders', 'orders.event_id', '=', 'attendees.id')->find($event_id); //$event = Event::scope()->join('orders', 'orders.event_id', '=', 'attendees.id')->find($event_id);
if ($searchQuery) { if ($searchQuery) {
$attendees = $event->attendees() $attendees = $event->attendees()
->withoutCancelled() ->withoutCancelled()
->join('orders', 'orders.id', '=', 'attendees.order_id') ->join('orders', 'orders.id', '=', 'attendees.order_id')
->where(function($query) use ($searchQuery) { ->where(function ($query) use ($searchQuery) {
$query->where('orders.order_reference', 'like', $searchQuery . '%') $query->where('orders.order_reference', 'like', $searchQuery.'%')
->orWhere('attendees.first_name', 'like', $searchQuery . '%') ->orWhere('attendees.first_name', 'like', $searchQuery.'%')
->orWhere('attendees.email', 'like', $searchQuery . '%') ->orWhere('attendees.email', 'like', $searchQuery.'%')
->orWhere('attendees.last_name', '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') ->select('attendees.*', 'orders.order_reference')
->paginate(); ->paginate();
} else { } else {
$attendees = $event->attendees() $attendees = $event->attendees()
->join('orders', 'orders.id', '=', 'attendees.order_id') ->join('orders', 'orders.id', '=', 'attendees.order_id')
->withoutCancelled() ->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') ->select('attendees.*', 'orders.order_reference')
->paginate(); ->paginate();
} }
$data = [ $data = [
'attendees' => $attendees, 'attendees' => $attendees,
'event' => $event, 'event' => $event,
'sort_by' => $sort_by, 'sort_by' => $sort_by,
'sort_order' => $sort_order, 'sort_order' => $sort_order,
'q' => $searchQuery ? $searchQuery : '' 'q' => $searchQuery ? $searchQuery : '',
]; ];
return View::make('ManageEvent.Attendees', $data); return View::make('ManageEvent.Attendees', $data);
} }
public function showCreateAttendee($event_id) { public function showCreateAttendee($event_id)
{
$event = Event::scope()->find($event_id); $event = Event::scope()->find($event_id);
/* /*
* If there are no tickets then we can't create an attendee * If there are no tickets then we can't create an attendee
* @todo This is a bit hackish * @todo This is a bit hackish
*/ */
if($event->tickets->count() === 0) { if ($event->tickets->count() === 0) {
return '<script>showMessage("You need to create a ticket before you can add an attendee.");</script>'; return '<script>showMessage("You need to create a ticket before you can add an attendee.");</script>';
} }
return View::make('ManageEvent.Modals.CreateAttendee', array( return View::make('ManageEvent.Modals.CreateAttendee', [
'modal_id' => \Input::get('modal_id'), 'modal_id' => \Input::get('modal_id'),
'event' => $event, 'event' => $event,
'tickets' => $event->tickets()->lists('title', 'id') 'tickets' => $event->tickets()->lists('title', 'id'),
)); ]);
} }
public function postCreateAttendee($event_id) { public function postCreateAttendee($event_id)
{
$rules = [ $rules = [
'first_name' => 'required', 'first_name' => 'required',
'ticket_id' => 'required|exists:tickets,id,account_id,' . \Auth::user()->account_id, 'ticket_id' => 'required|exists:tickets,id,account_id,'.\Auth::user()->account_id,
'ticket_price' => 'numeric|required', 'ticket_price' => 'numeric|required',
'email' => 'email|required', 'email' => 'email|required',
]; ];
$messages = [ $messages = [
'ticket_id.exists' => 'The ticket you have selected does not exist', 'ticket_id.exists' => 'The ticket you have selected does not exist',
'ticket_id.required' => 'The ticket field is required. ' 'ticket_id.required' => 'The ticket field is required. ',
]; ];
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$ticket_id = Input::get('ticket_id'); $ticket_id = Input::get('ticket_id');
@ -121,11 +115,10 @@ class EventAttendeesController extends MyBaseController {
$attendee_email = Input::get('email'); $attendee_email = Input::get('email');
$email_attendee = Input::get('email_ticket'); $email_attendee = Input::get('email_ticket');
/* /*
* Create the order * Create the order
*/ */
$order = new Order; $order = new Order();
$order->first_name = $attendee_first_name; $order->first_name = $attendee_first_name;
$order->last_name = $attendee_last_name; $order->last_name = $attendee_last_name;
$order->email = $attendee_email; $order->email = $attendee_email;
@ -143,30 +136,27 @@ class EventAttendeesController extends MyBaseController {
$ticket->increment('sales_volume', $ticket_price); $ticket->increment('sales_volume', $ticket_price);
$ticket->event->increment('sales_volume', $ticket_price); $ticket->event->increment('sales_volume', $ticket_price);
/* /*
* Insert order item * Insert order item
*/ */
$orderItem = new OrderItem; $orderItem = new OrderItem();
$orderItem->title = $ticket->title; $orderItem->title = $ticket->title;
$orderItem->quantity = 1; $orderItem->quantity = 1;
$orderItem->order_id = $order->id; $orderItem->order_id = $order->id;
$orderItem->unit_price = $ticket_price; $orderItem->unit_price = $ticket_price;
$orderItem->save(); $orderItem->save();
/* /*
* Update the event stats * Update the event stats
*/ */
$event_stats = new EventStats; $event_stats = new EventStats();
$event_stats->updateTicketsSoldCount($event_id, 1); $event_stats->updateTicketsSoldCount($event_id, 1);
$event_stats->updateTicketRevenue($ticket_id, $ticket_price); $event_stats->updateTicketRevenue($ticket_id, $ticket_price);
/* /*
* Create the attendee * Create the attendee
*/ */
$attendee = new Attendee; $attendee = new Attendee();
$attendee->first_name = $attendee_first_name; $attendee->first_name = $attendee_first_name;
$attendee->last_name = $attendee_last_name; $attendee->last_name = $attendee_last_name;
$attendee->email = $attendee_email; $attendee->email = $attendee_email;
@ -174,7 +164,7 @@ class EventAttendeesController extends MyBaseController {
$attendee->order_id = $order->id; $attendee->order_id = $order->id;
$attendee->ticket_id = $ticket_id; $attendee->ticket_id = $ticket_id;
$attendee->account_id = Auth::user()->account_id; $attendee->account_id = Auth::user()->account_id;
$attendee->reference = $order->order_reference . '-1'; $attendee->reference = $order->order_reference.'-1';
$attendee->save(); $attendee->save();
if ($email_attendee == '1') { if ($email_attendee == '1') {
@ -183,63 +173,63 @@ class EventAttendeesController extends MyBaseController {
Session::flash('message', 'Attendee Successfully Created'); Session::flash('message', 'Attendee Successfully Created');
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $attendee->id, 'id' => $attendee->id,
'redirectUrl' => route('showEventAttendees', array( 'redirectUrl' => route('showEventAttendees', [
'event_id' => $event_id 'event_id' => $event_id,
)) ]),
)); ]);
} }
public function showPrintAttendees($event_id) { public function showPrintAttendees($event_id)
{
$data['event'] = Event::scope()->find($event_id); $data['event'] = Event::scope()->find($event_id);
$data['attendees'] = $data['event']->attendees()->withoutCancelled()->orderBy('first_name')->get(); $data['attendees'] = $data['event']->attendees()->withoutCancelled()->orderBy('first_name')->get();
return View::make('ManageEvent.PrintAttendees', $data); return View::make('ManageEvent.PrintAttendees', $data);
} }
public function showMessageAttendee($attendee_id) { public function showMessageAttendee($attendee_id)
{
$attendee = Attendee::scope()->findOrFail($attendee_id); $attendee = Attendee::scope()->findOrFail($attendee_id);
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'event' => $attendee->event, 'event' => $attendee->event,
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
return View::make('ManageEvent.Modals.MessageAttendee', $data); return View::make('ManageEvent.Modals.MessageAttendee', $data);
} }
public function postMessageAttendee($attendee_id) { public function postMessageAttendee($attendee_id)
{
$rules = [ $rules = [
'subject' => 'required', 'subject' => 'required',
'message' => 'required' 'message' => 'required',
]; ];
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$attendee = Attendee::scope()->findOrFail($attendee_id); $attendee = Attendee::scope()->findOrFail($attendee_id);
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'message_content' => Input::get('message'), 'message_content' => Input::get('message'),
'subject' => Input::get('subject'), 'subject' => Input::get('subject'),
'event' => $attendee->event, 'event' => $attendee->event,
'email_logo' => $attendee->event->organiser->full_logo_path '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) $message->to($attendee->email, $attendee->full_name)
->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name)
->replyTo($attendee->event->organiser->email, $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? */ /* Could bcc in the above? */
if (Input::get('send_copy') == '1') { 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) $message->to($attendee->event->organiser->email, $attendee->event->organiser->name)
->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name)
->replyTo($attendee->event->organiser->email, $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([
'status' => 'success',
'message' => 'Message Successfully Sent',
]);
return Response::json(array(
'status' => 'success',
'message' => 'Message Successfully Sent'
));
} }
public function showMessageAttendees($event_id) { public function showMessageAttendees($event_id)
{
$data = [ $data = [
'event' => Event::scope()->find($event_id), 'event' => Event::scope()->find($event_id),
'modal_id' => Input::get('modal_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); return View::make('ManageEvent.Modals.MessageAttendees', $data);
} }
public function postMessageAttendees($event_id) { public function postMessageAttendees($event_id)
{
$rules = [ $rules = [
'subject' => 'required', 'subject' => 'required',
'message' => 'required', 'message' => 'required',
'recipients' => 'required' 'recipients' => 'required',
]; ];
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$message = Message::createNew(); $message = Message::createNew();
@ -305,15 +291,15 @@ class EventAttendeesController extends MyBaseController {
* Add to the queue * Add to the queue
*/ */
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Message Successfully Sent' 'message' => 'Message Successfully Sent',
)); ]);
} }
public function showExportAttendees($event_id, $export_as = 'xls') { 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::create('attendees-as-of-'.date('d-m-Y-g.i.a'), function ($excel) use ($event_id) {
$excel->setTitle('Attendees List'); $excel->setTitle('Attendees List');
@ -321,7 +307,7 @@ class EventAttendeesController extends MyBaseController {
$excel->setCreator(config('attendize.app_name')) $excel->setCreator(config('attendize.app_name'))
->setCompany(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); DB::connection()->setFetchMode(\PDO::FETCH_ASSOC);
$data = DB::table('attendees') $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(); '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`")) //DB::raw("(CASE WHEN UNIX_TIMESTAMP(`attendees.arrival_time`) = 0 THEN '---' ELSE 'd' END) AS `attendees.arrival_time`"))
$sheet->fromArray($data); $sheet->fromArray($data);
$sheet->row(1, array( $sheet->row(1, [
'First Name', 'Last Name', 'Email', 'Ticket Reference', 'Order Reference', 'Ticket Type', 'Purchase Date', 'Has Arrived', 'Arrival Time' 'First Name', 'Last Name', 'Email', 'Ticket Reference', 'Order Reference', 'Ticket Type', 'Purchase Date', 'Has Arrived', 'Arrival Time',
)); ]);
// Set gray background on first row // Set gray background on first row
$sheet->row(1, function($row) { $sheet->row(1, function ($row) {
$row->setBackground('#f5f5f5'); $row->setBackground('#f5f5f5');
}); });
}); });
})->export($export_as); })->export($export_as);
} }
public function showEditAttendee($event_id, $attendee_id) { public function showEditAttendee($event_id, $attendee_id)
{
$attendee = Attendee::scope()->findOrFail($attendee_id); $attendee = Attendee::scope()->findOrFail($attendee_id);
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'event' => $attendee->event, 'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'), 'tickets' => $attendee->event->tickets->lists('title', 'id'),
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
return View::make('ManageEvent.Modals.EditAttendee', $data); return View::make('ManageEvent.Modals.EditAttendee', $data);
} }
public function postEditAttendee($event_id, $attendee_id) { public function postEditAttendee($event_id, $attendee_id)
{
$rules = [ $rules = [
'first_name' => 'required', 'first_name' => 'required',
'ticket_id' => 'required|exists:tickets,id,account_id,' . Auth::user()->account_id, 'ticket_id' => 'required|exists:tickets,id,account_id,'.Auth::user()->account_id,
'email' => 'required|email' 'email' => 'required|email',
]; ];
$messages = [ $messages = [
'ticket_id.exists' => 'The ticket you have selected does not exist', 'ticket_id.exists' => 'The ticket you have selected does not exist',
'ticket_id.required' => 'The ticket field is required. ' 'ticket_id.required' => 'The ticket field is required. ',
]; ];
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$attendee = Attendee::scope()->findOrFail($attendee_id); $attendee = Attendee::scope()->findOrFail($attendee_id);
@ -397,28 +379,30 @@ class EventAttendeesController extends MyBaseController {
$attendee->ticket_id = Input::get('ticket_id'); $attendee->ticket_id = Input::get('ticket_id');
$attendee->save(); $attendee->save();
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $attendee->id, 'id' => $attendee->id,
'message' => 'Refreshing...', 'message' => 'Refreshing...',
'redirectUrl' => '' 'redirectUrl' => '',
)); ]);
} }
public function showCancelAttendee($event_id, $attendee_id) { public function showCancelAttendee($event_id, $attendee_id)
{
$attendee = Attendee::scope()->findOrFail($attendee_id); $attendee = Attendee::scope()->findOrFail($attendee_id);
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'event' => $attendee->event, 'event' => $attendee->event,
'tickets' => $attendee->event->tickets->lists('title', 'id'), 'tickets' => $attendee->event->tickets->lists('title', 'id'),
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
return View::make('ManageEvent.Modals.CancelAttendee', $data); 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 = Attendee::scope()->findOrFail($attendee_id);
$attendee->ticket->decrement('quantity_sold'); $attendee->ticket->decrement('quantity_sold');
@ -426,12 +410,12 @@ class EventAttendeesController extends MyBaseController {
$attendee->save(); $attendee->save();
$data = [ $data = [
'attendee' => $attendee, 'attendee' => $attendee,
'email_logo' => $attendee->organiser->full_logo_path 'email_logo' => $attendee->organiser->full_logo_path,
]; ];
if (Input::get('notify_attendee') == '1') { 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) $message->to($attendee->email, $attendee->full_name)
->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $attendee->event->organiser->name)
->replyTo($attendee->event->organiser->email, $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'); \Session::flash('message', 'Successfully Cancelled Attenddee');
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $attendee->id, 'id' => $attendee->id,
'message' => 'Refreshing...', 'message' => 'Refreshing...',
'redirectUrl' => '' 'redirectUrl' => '',
)); ]);
} }
} }

View File

@ -1,40 +1,45 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input,
DB,
Response,
View;
use App\Models\Event;
use App\Models\Attendee; use App\Models\Attendee;
use App\Models\Event;
use Carbon\Carbon; use Carbon\Carbon;
use DB;
use Input;
use Response;
use View;
class EventCheckInController extends MyBaseController { class EventCheckInController extends MyBaseController
{
/** /**
* @param $event_id * @param $event_id
*
* @return mixed * @return mixed
*/ */
public function showCheckIn($event_id) { public function showCheckIn($event_id)
{
$data['event'] = Event::scope()->findOrFail($event_id); $data['event'] = Event::scope()->findOrFail($event_id);
$data['attendees'] = $data['event']->attendees; $data['attendees'] = $data['event']->attendees;
return View::make('ManageEvent.CheckIn', $data); return View::make('ManageEvent.CheckIn', $data);
} }
public function postCheckInSearch($event_id) { public function postCheckInSearch($event_id)
{
$searchQuery = Input::get('q'); $searchQuery = Input::get('q');
$attendees = Attendee::scope()->withoutCancelled() $attendees = Attendee::scope()->withoutCancelled()
->join('tickets', 'tickets.id', '=', 'attendees.ticket_id') ->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); $query->where('attendees.event_id', '=', $event_id);
})->where(function($query) use ($searchQuery) { })->where(function ($query) use ($searchQuery) {
$query->orWhere('attendees.first_name', 'like', $searchQuery . '%') $query->orWhere('attendees.first_name', 'like', $searchQuery.'%')
->orWhere(DB::raw("CONCAT_WS(' ', first_name, last_name)"), 'like', $searchQuery . '%') ->orWhere(DB::raw("CONCAT_WS(' ', first_name, last_name)"), 'like', $searchQuery.'%')
//->orWhere('attendees.email', 'like', $searchQuery . '%') //->orWhere('attendees.email', 'like', $searchQuery . '%')
->orWhere('attendees.reference', 'like', $searchQuery . '%') ->orWhere('attendees.reference', 'like', $searchQuery.'%')
->orWhere('attendees.last_name', 'like', $searchQuery . '%'); ->orWhere('attendees.last_name', 'like', $searchQuery.'%');
}) })
->select([ ->select([
'attendees.id', 'attendees.id',
@ -44,7 +49,7 @@ class EventCheckInController extends MyBaseController {
'attendees.reference', 'attendees.reference',
'attendees.arrival_time', 'attendees.arrival_time',
'attendees.has_arrived', 'attendees.has_arrived',
'tickets.title as ticket' 'tickets.title as ticket',
]) ])
->orderBy('attendees.first_name', 'ASC') ->orderBy('attendees.first_name', 'ASC')
->get(); ->get();
@ -52,10 +57,10 @@ class EventCheckInController extends MyBaseController {
return Response::json($attendees); return Response::json($attendees);
} }
public function postCheckInAttendee() { public function postCheckInAttendee()
{
$attendee_id = Input::get('attendee_id'); $attendee_id = Input::get('attendee_id');
$checking = Input::get('checking'); $checking = Input::get('checking');
$attendee = Attendee::scope()->find($attendee_id); $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))) { if ((($checking == 'in') && ($attendee->has_arrived == 1)) || (($checking == 'out') && ($attendee->has_arrived == 0))) {
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'message' => 'Warning: This Attendee Has Already Been Checked ' . (($checking == 'in') ? 'In (at '.$attendee->arrival_time->format('H:i A, F j').')' : 'Out').'!', 'message' => 'Warning: This Attendee Has Already Been Checked '.(($checking == 'in') ? 'In (at '.$attendee->arrival_time->format('H:i A, F j').')' : 'Out').'!',
'checked' => $checking, 'checked' => $checking,
'id' => $attendee->id 'id' => $attendee->id,
]); ]);
} }
@ -76,11 +81,10 @@ class EventCheckInController extends MyBaseController {
$attendee->save(); $attendee->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'checked' => $checking, 'checked' => $checking,
'message' => 'Attendee Successfully Checked ' . (($checking == 'in') ? 'In' : 'Out'), 'message' => 'Attendee Successfully Checked '.(($checking == 'in') ? 'In' : 'Out'),
'id' => $attendee->id 'id' => $attendee->id,
]); ]);
} }
} }

View File

@ -1,37 +1,36 @@
<?php namespace App\Http\Controllers; <?php
use View, namespace App\Http\Controllers;
Input,
Validator, use App;
DB, use App\Attendize\Utils;
Response,
Session,
Request,
Redirect,
Log,
Cookie,
App;
use PDF;
use Bugsnag;
use Stripe,
Stripe_Charge,
Stripe_Customer;
use App\Commands\OrderTicketsCommand; use App\Commands\OrderTicketsCommand;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use App\Models\Event;
use App\Models\Affiliate; use App\Models\Affiliate;
use App\Models\Order;
use App\Models\Ticket;
use App\Models\Attendee; use App\Models\Attendee;
use App\Models\Event;
use App\Models\EventStats; use App\Models\EventStats;
use App\Models\Order;
use App\Models\OrderItem; use App\Models\OrderItem;
use App\Models\ReservedTickets; use App\Models\ReservedTickets;
use App\Attendize\Utils; use App\Models\Ticket;
use Carbon\Carbon;
use Cookie;
use DB;
use Input;
use Log;
use PDF;
use Redirect;
use Request;
use Response;
use Session;
use Stripe;
use Stripe_Charge;
use Stripe_Customer;
use Validator;
use View;
class EventCheckoutController extends Controller class EventCheckoutController extends Controller
{ {
protected $is_embedded; protected $is_embedded;
public function __construct() public function __construct()
@ -59,7 +58,7 @@ class EventCheckoutController extends Controller
ReservedTickets::where('session_id', '=', Session::getId())->delete(); ReservedTickets::where('session_id', '=', Session::getId())->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. * , tot up the price and reserve them to prevent over selling.
*/ */
@ -73,9 +72,7 @@ class EventCheckoutController extends Controller
$quantity_available_validation_rules = []; $quantity_available_validation_rules = [];
foreach ($ticket_ids as $ticket_id) { 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) { if ($current_ticket_quantity < 1) {
continue; continue;
@ -92,21 +89,19 @@ class EventCheckoutController extends Controller
*/ */
$max_per_person = min($ticket_quantity_remaining, $ticket->max_per_person); $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 = [ $quantity_available_validation_messages = [
'ticket_' . $ticket_id . '.max' => 'The maximum number of tickets you can register is ' . $ticket_quantity_remaining, '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.'.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()) { if ($validator->fails()) {
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() '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); $organiser_booking_fee = $organiser_booking_fee + ($current_ticket_quantity * $ticket->organiser_booking_fee);
$tickets[] = [ $tickets[] = [
'ticket' => $ticket, 'ticket' => $ticket,
'qty' => $current_ticket_quantity, 'qty' => $current_ticket_quantity,
'price' => ($current_ticket_quantity * $ticket->price), 'price' => ($current_ticket_quantity * $ticket->price),
'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee), 'booking_fee' => ($current_ticket_quantity * $ticket->booking_fee),
'organiser_booking_fee' => ($current_ticket_quantity * $ticket->organiser_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 * Reserve the tickets in the DB
*/ */
$reservedTickets = new ReservedTickets; $reservedTickets = new ReservedTickets();
$reservedTickets->ticket_id = $ticket_id; $reservedTickets->ticket_id = $ticket_id;
$reservedTickets->event_id = $event_id; $reservedTickets->event_id = $event_id;
$reservedTickets->quantity_reserved = $current_ticket_quantity; $reservedTickets->quantity_reserved = $current_ticket_quantity;
@ -139,68 +134,67 @@ class EventCheckoutController extends Controller
/* /*
* Create our validation rules here * Create our validation rules here
*/ */
$validation_rules['ticket_holder_first_name.' . $i . '.' . $ticket_id] = ['required']; $validation_rules['ticket_holder_first_name.'.$i.'.'.$ticket_id] = ['required'];
$validation_rules['ticket_holder_last_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_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_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_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.'.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_email.'.$i.'.'.$ticket_id.'.email'] = 'Ticket holder '.($i + 1).'\'s email appears to be invalid';
} }
} }
} }
if (empty($tickets)) { if (empty($tickets)) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'message' => 'No tickets selected.' 'message' => 'No tickets selected.',
)); ]);
} }
/* /*
* @todo - Store this in something other than a session? * @todo - Store this in something other than a session?
*/ */
Session::set('ticket_order_' . $event->id, [ Session::set('ticket_order_'.$event->id, [
'validation_rules' => $validation_rules, 'validation_rules' => $validation_rules,
'validation_messages' => $validation_messages, 'validation_messages' => $validation_messages,
'event_id' => $event->id, 'event_id' => $event->id,
'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */ 'tickets' => $tickets, /* probably shouldn't store the whole ticket obj in session */
'total_ticket_quantity' => $total_ticket_quantity, 'total_ticket_quantity' => $total_ticket_quantity,
'order_started' => time(), 'order_started' => time(),
'expires' => $order_expires_time, 'expires' => $order_expires_time,
'reserved_tickets_id' => $reservedTickets->id, 'reserved_tickets_id' => $reservedTickets->id,
'order_total' => $order_total, 'order_total' => $order_total,
'booking_fee' => $booking_fee, 'booking_fee' => $booking_fee,
'organiser_booking_fee' => $organiser_booking_fee, 'organiser_booking_fee' => $organiser_booking_fee,
'total_booking_fee' => $booking_fee + $organiser_booking_fee, 'total_booking_fee' => $booking_fee + $organiser_booking_fee,
'order_requires_payment' => (ceil($order_total) == 0) ? FALSE : TRUE, 'order_requires_payment' => (ceil($order_total) == 0) ? false : true,
'account_id' => $event->account->id, 'account_id' => $event->account->id,
'affiliate_referral' => Cookie::get('affiliate_' . $event_id) 'affiliate_referral' => Cookie::get('affiliate_'.$event_id),
]); ]);
if (Request::ajax()) { if (Request::ajax()) {
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'redirectUrl' => route('showEventCheckout', [ 'redirectUrl' => route('showEventCheckout', [
'event_id' => $event_id, 'event_id' => $event_id,
'is_embedded' => $this->is_embedded 'is_embedded' => $this->is_embedded,
]) . '#order_form' ]).'#order_form',
)); ]);
} }
/* /*
* TODO: We should just show an enable JS message here instead * TODO: We should just show an enable JS message here instead
*/ */
return Redirect::to(route('showEventCheckout', [ return Redirect::to(route('showEventCheckout', [
'event_id' => $event_id 'event_id' => $event_id,
]) . '#order_form'); ]).'#order_form');
} }
public function showEventCheckout($event_id) 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()) { if (!$order_session || $order_session['expires'] < Carbon::now()) {
return Redirect::route('showEventPage', ['event_id' => $event_id]); return Redirect::route('showEventPage', ['event_id' => $event_id]);
@ -210,82 +204,79 @@ class EventCheckoutController extends Controller
//dd($secondsToExpire); //dd($secondsToExpire);
$data = $order_session + [ $data = $order_session + [
'event' => Event::findorFail($order_session['event_id']), 'event' => Event::findorFail($order_session['event_id']),
'secondsToExpire' => $secondsToExpire, 'secondsToExpire' => $secondsToExpire,
'is_embedded' => $this->is_embedded 'is_embedded' => $this->is_embedded,
]; ];
if ($this->is_embedded) { if ($this->is_embedded) {
return View::make('Public.ViewEvent.Embedded.EventPageCheckout', $data); return View::make('Public.ViewEvent.Embedded.EventPageCheckout', $data);
} }
return View::make('Public.ViewEvent.EventPageCheckout', $data); return View::make('Public.ViewEvent.EventPageCheckout', $data);
} }
public function postCreateOrder($event_id) 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); $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; $attendee_increment = 1;
$validation_rules = $ticket_order['validation_rules']; $validation_rules = $ticket_order['validation_rules'];
$validation_messages = $ticket_order['validation_messages']; $validation_messages = $ticket_order['validation_messages'];
if (!$mirror_buyer_info && $event->ask_for_all_attendees_info) { if (!$mirror_buyer_info && $event->ask_for_all_attendees_info) {
$order->rules = $order->rules + $validation_rules; $order->rules = $order->rules + $validation_rules;
$order->messages = $order->messages + $validation_messages; $order->messages = $order->messages + $validation_messages;
} }
if (!$order->validate(Input::all())) { if (!$order->validate(Input::all())) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $order->errors() 'messages' => $order->errors(),
)); ]);
} }
/** /*
* Begin payment attempt before creating the attendees etc. * Begin payment attempt before creating the attendees etc.
* */ * */
if ($ticket_order['order_requires_payment']) { if ($ticket_order['order_requires_payment']) {
try { try {
$stripe_error = false;
$stripe_error = FALSE;
Stripe::setApiKey($event->account->stripe_api_key); Stripe::setApiKey($event->account->stripe_api_key);
$token = Input::get('stripeToken'); $token = Input::get('stripeToken');
$customer = Stripe_Customer::create(array( $customer = Stripe_Customer::create([
'email' => Input::get('order_email'), 'email' => Input::get('order_email'),
'card' => $token, 'card' => $token,
'description' => 'Customer: ' . Input::get('order_email') 'description' => 'Customer: '.Input::get('order_email'),
)); ]);
if (Utils::isAttendize()) { if (Utils::isAttendize()) {
$charge = Stripe_Charge::create(array( $charge = Stripe_Charge::create([
'customer' => $customer->id, 'customer' => $customer->id,
'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100,
'currency' => $event->currency->code, 'currency' => $event->currency->code,
'description' => Input::get('order_email'), 'description' => Input::get('order_email'),
'application_fee' => $ticket_order['booking_fee'] * 100, 'application_fee' => $ticket_order['booking_fee'] * 100,
'description' => 'Order for customer: ' . Input::get('order_email') 'description' => 'Order for customer: '.Input::get('order_email'),
)); ]);
} else { } else {
$charge = Stripe_Charge::create(array( $charge = Stripe_Charge::create([
'customer' => $customer->id, 'customer' => $customer->id,
'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100, 'amount' => ($ticket_order['order_total'] + $ticket_order['organiser_booking_fee']) * 100,
'currency' => $event->currency->code, 'currency' => $event->currency->code,
'description' => Input::get('order_email'), '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; $order->transaction_id = $charge->id;
@ -313,10 +304,10 @@ class EventCheckoutController extends Controller
} }
if ($stripe_error) { if ($stripe_error) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'message' => $stripe_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_stats = EventStats::firstOrNew([
'event_id' => $event_id, 'event_id' => $event_id,
'date' => DB::raw('CURDATE()') 'date' => DB::raw('CURDATE()'),
]); ]);
$event_stats->increment('tickets_sold', $ticket_order['total_ticket_quantity']); $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) * Insert order items (for use in generating invoices)
*/ */
$orderItem = new OrderItem; $orderItem = new OrderItem();
$orderItem->title = $attendee_details['ticket']['title']; $orderItem->title = $attendee_details['ticket']['title'];
$orderItem->quantity = $attendee_details['qty']; $orderItem->quantity = $attendee_details['qty'];
$orderItem->order_id = $order->id; $orderItem->order_id = $order->id;
@ -396,7 +387,7 @@ class EventCheckoutController extends Controller
* Create the attendees * Create the attendees
*/ */
for ($i = 0; $i < $attendee_details['qty']; $i++) { 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->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->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; $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->order_id = $order->id;
$attendee->ticket_id = $attendee_details['ticket']['id']; $attendee->ticket_id = $attendee_details['ticket']['id'];
$attendee->account_id = $event->account->id; $attendee->account_id = $event->account->id;
$attendee->reference = $order->order_reference . '-' . ($attendee_increment); $attendee->reference = $order->order_reference.'-'.($attendee_increment);
$attendee->save(); $attendee->save();
/* /*
* Queue an email to send to each attendee * Queue an email to send to each attendee
*/ */
/* Keep track of total number of attendees */ /* Keep track of total number of attendees */
$attendee_increment++; $attendee_increment++;
} }
@ -428,32 +418,32 @@ class EventCheckoutController extends Controller
ReservedTickets::where('session_id', '=', Session::getId())->delete(); 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 * Queue the PDF creation jobs
*/ */
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'redirectUrl' => route('showOrderDetails', [ 'redirectUrl' => route('showOrderDetails', [
'is_embedded' => $this->is_embedded, 'is_embedded' => $this->is_embedded,
'order_reference' => $order->order_reference 'order_reference' => $order->order_reference,
]) ]),
)); ]);
} }
/** /**
* Show the order details page * Show the order details page.
* *
* @param string $order_reference * @param string $order_reference
*
* @return view * @return view
*/ */
public function showOrderDetails($order_reference) public function showOrderDetails($order_reference)
{ {
$order = Order::where('order_reference', '=', $order_reference)->first(); $order = Order::where('order_reference', '=', $order_reference)->first();
if (!$order) { if (!$order) {
@ -461,26 +451,26 @@ class EventCheckoutController extends Controller
} }
$data = [ $data = [
'order' => $order, 'order' => $order,
'event' => $order->event, 'event' => $order->event,
'tickets' => $order->event->tickets, 'tickets' => $order->event->tickets,
'is_embedded' => $this->is_embedded 'is_embedded' => $this->is_embedded,
]; ];
if ($this->is_embedded) { if ($this->is_embedded) {
return View::make('Public.ViewEvent.Embedded.EventPageViewOrder', $data); return View::make('Public.ViewEvent.Embedded.EventPageViewOrder', $data);
} }
return View::make('Public.ViewEvent.EventPageViewOrder', $data); return View::make('Public.ViewEvent.EventPageViewOrder', $data);
} }
/** /**
* Output order tickets * Output order tickets.
* *
* @param string $order_reference * @param string $order_reference
*/ */
public function showOrderTickets($order_reference) public function showOrderTickets($order_reference)
{ {
$order = Order::where('order_reference', '=', $order_reference)->first(); $order = Order::where('order_reference', '=', $order_reference)->first();
if (!$order) { if (!$order) {
@ -488,10 +478,10 @@ class EventCheckoutController extends Controller
} }
$data = [ $data = [
'order' => $order, 'order' => $order,
'event' => $order->event, 'event' => $order->event,
'tickets' => $order->event->tickets, 'tickets' => $order->event->tickets,
'attendees' => $order->attendees 'attendees' => $order->attendees,
]; ];
if (Input::get('download') == '1') { if (Input::get('download') == '1') {
@ -500,5 +490,4 @@ class EventCheckoutController extends Controller
return View::make('Public.ViewEvent.Partials.PDFTicket', $data); return View::make('Public.ViewEvent.Partials.PDFTicket', $data);
} }
} }

View File

@ -1,43 +1,45 @@
<?php namespace App\Http\Controllers; <?php
use Response, Input, Validator; namespace App\Http\Controllers;
use Auth;
use Image; use App\Models\Event;
use Storage;
use View;
use Carbon\Carbon;
use App\Models\EventImage; use App\Models\EventImage;
use App\Models\Organiser; use App\Models\Organiser;
use App\Models\Event; use Auth;
use Carbon\Carbon;
class EventController extends MyBaseController { use Image;
use Input;
use Response;
public function showCreateEvent() { use Validator;
use View;
class EventController extends MyBaseController
{
public function showCreateEvent()
{
$data = [ $data = [
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
'organisers' => Organiser::scope()->lists('name', 'id'), 'organisers' => Organiser::scope()->lists('name', 'id'),
'organiser_id' => Input::get('organiser_id') ? Input::get('organiser_id') : false 'organiser_id' => Input::get('organiser_id') ? Input::get('organiser_id') : false,
]; ];
return View::make('ManageOrganiser.Modals.CreateEvent', $data); return View::make('ManageOrganiser.Modals.CreateEvent', $data);
} }
public function postCreateEvent() { public function postCreateEvent()
{
$event = Event::createNew(); $event = Event::createNew();
if (!$event->validate(Input::all())) { if (!$event->validate(Input::all())) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $event->errors() 'messages' => $event->errors(),
)); ]);
} }
$event->title = Input::get('title'); $event->title = Input::get('title');
$event->description = strip_tags(Input::get('description')); $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) * Venue location info (Usually autofilled from google maps)
@ -69,32 +71,29 @@ class EventController extends MyBaseController {
$event->location_is_manual = 1; $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->currency_id = Auth::user()->account->currency_id;
//$event->timezone_id = Auth::user()->account->timezone_id; //$event->timezone_id = Auth::user()->account->timezone_id;
if (Input::get('organiser_name')) { if (Input::get('organiser_name')) {
$organiser = Organiser::createNew(false, false, true);
$organiser = Organiser::createNew(FALSE, FALSE, TRUE); $rules = [
'organiser_name' => ['required'],
$rules = array( 'organiser_email' => ['required', 'email'],
'organiser_name' => array('required'), ];
'organiser_email' => array('required', 'email'), $messages = [
); 'organiser_name.required' => 'You must give a name for the event organiser.',
$messages = array( ];
'organiser_name.required' => 'You must give a name for the event organiser.'
);
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$organiser->name = Input::get('organiser_name'); $organiser->name = Input::get('organiser_name');
@ -106,17 +105,16 @@ class EventController extends MyBaseController {
$event->organiser_id = $organiser->id; $event->organiser_id = $organiser->id;
} elseif (Input::get('organiser_id')) { } elseif (Input::get('organiser_id')) {
$event->organiser_id = Input::get('organiser_id'); $event->organiser_id = Input::get('organiser_id');
} else { /* Somethings gone horribly wrong */} } else { /* Somethings gone horribly wrong */
}
$event->save(); $event->save();
if (Input::hasFile('event_image')) { 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'); $file_full_path = $path.'/'.$filename;
$filename = 'event_image-' . md5(time() . $event->id) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension());
$file_full_path = $path . '/' . $filename;
Input::file('event_image')->move($path, $filename); Input::file('event_image')->move($path, $filename);
@ -128,43 +126,41 @@ class EventController extends MyBaseController {
}); });
$img->save($file_full_path); $img->save($file_full_path);
/* Upload to s3 */ /* Upload to s3 */
\Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path));
$eventImage = EventImage::createNew(); $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->event_id = $event->id;
$eventImage->save(); $eventImage->save();
} }
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $event->id, 'id' => $event->id,
'redirectUrl' => route('showEventTickets', array( 'redirectUrl' => route('showEventTickets', [
'event_id' => $event->id, 'event_id' => $event->id,
'first_run' => 'yup' 'first_run' => 'yup',
)) ]),
)); ]);
} }
public function postEditEvent($event_id) { public function postEditEvent($event_id)
{
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
if (!$event->validate(Input::all())) { if (!$event->validate(Input::all())) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $event->errors() 'messages' => $event->errors(),
)); ]);
} }
$event->is_live = Input::get('is_live'); $event->is_live = Input::get('is_live');
$event->title = Input::get('title'); $event->title = Input::get('title');
$event->description = strip_tags(Input::get('description')); $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 * 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') { if (Input::get('remove_current_image') == '1') {
EventImage::where('event_id', '=', $event->id)->delete(); EventImage::where('event_id', '=', $event->id)->delete();
@ -216,12 +210,10 @@ class EventController extends MyBaseController {
$event->save(); $event->save();
if (Input::hasFile('event_image')) { 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'); $file_full_path = $path.'/'.$filename;
$filename = 'event_image-' . md5(time() . $event->id) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension());
$file_full_path = $path . '/' . $filename;
Input::file('event_image')->move($path, $filename); Input::file('event_image')->move($path, $filename);
@ -233,57 +225,51 @@ class EventController extends MyBaseController {
}); });
$img->save($file_full_path); $img->save($file_full_path);
\Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($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::where('event_id', '=', $event->id)->delete();
$eventImage = EventImage::createNew(); $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->event_id = $event->id;
$eventImage->save(); $eventImage->save();
} }
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $event->id, 'id' => $event->id,
'message' => 'Event Successfully Updated', 'message' => 'Event Successfully Updated',
'redirectUrl' => '' 'redirectUrl' => '',
)); ]);
} }
public function postUploadEventImage() { public function postUploadEventImage()
{
if (Input::hasFile('event_image')) { if (Input::hasFile('event_image')) {
$the_file = \File::get(Input::file('event_image')->getRealPath()); $the_file = \File::get(Input::file('event_image')->getRealPath());
$file_name = 'event_details_image-' . md5(microtime()) . '.' . strtolower(Input::file('event_image')->getClientOriginalExtension()); $file_name = 'event_details_image-'.md5(microtime()).'.'.strtolower(Input::file('event_image')->getClientOriginalExtension());
$relative_path_to_file = config('attendize.event_images_path') . '/' . $file_name; $relative_path_to_file = config('attendize.event_images_path').'/'.$file_name;
$full_path_to_file = public_path().'/'.$relative_path_to_file; $full_path_to_file = public_path().'/'.$relative_path_to_file;
$img = Image::make($the_file); $img = Image::make($the_file);
$img->resize(1000, null, function ($constraint) { $img->resize(1000, null, function ($constraint) {
$constraint->aspectRatio(); $constraint->aspectRatio();
$constraint->upsize(); $constraint->upsize();
}); });
$img->save($full_path_to_file); $img->save($full_path_to_file);
if(\Storage::put($file_name, $the_file)) { if (\Storage::put($file_name, $the_file)) {
return Response::json([ return Response::json([
'link' => '/'.$relative_path_to_file 'link' => '/'.$relative_path_to_file,
]); ]);
} }
return Response::json([ return Response::json([
'error' => 'There was a problem uploading your image.' 'error' => 'There was a problem uploading your image.',
]); ]);
} }
} }
} }

View File

@ -1,24 +1,33 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use App\Models\Event; use App\Models\Event;
use Response, Input, File, Image, Validator, View; use File;
use Image;
use Input;
use Response;
use Validator;
use View;
class EventCustomizeController extends MyBaseController { class EventCustomizeController extends MyBaseController
{
public function showCustomize($event_id = '', $tab = '') { public function showCustomize($event_id = '', $tab = '')
{
$data = $this->getEventViewData($event_id, [ $data = $this->getEventViewData($event_id, [
'available_bg_images' => $this->getAvailableBackgroundImages(), 'available_bg_images' => $this->getAvailableBackgroundImages(),
'available_bg_images_thumbs' => $this->getAvailableBackgroundImagesThumbs(), 'available_bg_images_thumbs' => $this->getAvailableBackgroundImagesThumbs(),
'tab' => $tab 'tab' => $tab,
]); ]);
return View::make('ManageEvent.Customize', $data); return View::make('ManageEvent.Customize', $data);
} }
public function getAvailableBackgroundImages() { public function getAvailableBackgroundImages()
{
$images = []; $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) { foreach ($files as $image) {
$images[] = str_replace(public_path(), '', $image); $images[] = str_replace(public_path(), '', $image);
@ -26,12 +35,12 @@ class EventCustomizeController extends MyBaseController {
return $images; return $images;
} }
public function getAvailableBackgroundImagesThumbs() {
public function getAvailableBackgroundImagesThumbs()
{
$images = []; $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) { foreach ($files as $image) {
$images[] = str_replace(public_path(), '', $image); $images[] = str_replace(public_path(), '', $image);
@ -39,17 +48,18 @@ class EventCustomizeController extends MyBaseController {
return $images; return $images;
} }
public function postEditEventSocial($event_id) { public function postEditEventSocial($event_id)
{
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
$rules = [ $rules = [
'social_share_text' => ['max:3000'], 'social_share_text' => ['max:3000'],
'social_show_facebook' => ['boolean'], 'social_show_facebook' => ['boolean'],
'social_show_twitter' => ['boolean'], 'social_show_twitter' => ['boolean'],
'social_show_linkedin' => ['boolean'], 'social_show_linkedin' => ['boolean'],
'social_show_email' => ['boolean'], 'social_show_email' => ['boolean'],
'social_show_googleplus' => ['boolean'] 'social_show_googleplus' => ['boolean'],
]; ];
$messages = [ $messages = [
'social_share_text.max' => 'Please keep the shate text under 3000 characters.', '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); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$event->social_share_text = Input::get('social_share_text'); $event->social_share_text = Input::get('social_share_text');
@ -73,31 +83,32 @@ class EventCustomizeController extends MyBaseController {
$event->save(); $event->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Social Settings Succesfully Upated', 'message' => 'Social Settings Succesfully Upated',
]); ]);
} }
public function postEditEventFees($event_id) { public function postEditEventFees($event_id)
{
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
$rules = [ $rules = [
'organiser_fee_percentage' => ['numeric', 'between:0,100'], 'organiser_fee_percentage' => ['numeric', 'between:0,100'],
'organiser_fee_fixed' => ['numeric', 'between:0,100'] 'organiser_fee_fixed' => ['numeric', 'between:0,100'],
]; ];
$messages = [ $messages = [
'organiser_fee_percentage.numeric' => 'Please enter a value between 0 and 100', '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.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.between' => 'Please enter a value between 0 and 100.',
]; ];
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$event->organiser_fee_percentage = Input::get('organiser_fee_percentage'); $event->organiser_fee_percentage = Input::get('organiser_fee_percentage');
@ -105,12 +116,13 @@ class EventCustomizeController extends MyBaseController {
$event->save(); $event->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Order Page Succesfully Upated', 'message' => 'Order Page Succesfully Upated',
]); ]);
} }
public function postEditEventOrderPage($event_id) { public function postEditEventOrderPage($event_id)
{
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
// Just plain text so no validation needed (hopefully) // Just plain text so no validation needed (hopefully)
@ -120,10 +132,10 @@ class EventCustomizeController extends MyBaseController {
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$event->pre_order_display_message = trim(Input::get('pre_order_display_message')); $event->pre_order_display_message = trim(Input::get('pre_order_display_message'));
@ -132,33 +144,32 @@ class EventCustomizeController extends MyBaseController {
$event->save(); $event->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Order Page Succesfully Upated', 'message' => 'Order Page Succesfully Upated',
]); ]);
} }
public function postEditEventDesign($event_id) {
public function postEditEventDesign($event_id)
{
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
$rules = [ $rules = [
'bg_image_path' => ['mimes:jpeg,jpg,png', 'max:4000'] 'bg_image_path' => ['mimes:jpeg,jpg,png', 'max:4000'],
]; ];
$messages = [ $messages = [
'bg_image_path.mimes' => 'Please ensure you are uploading an image (JPG, PNG, JPEG)', '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); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
if (Input::get('bg_image_path_custom') && Input::get('bg_type') == 'image') { if (Input::get('bg_image_path_custom') && Input::get('bg_type') == 'image') {
$event->bg_image_path = Input::get('bg_image_path_custom'); $event->bg_image_path = Input::get('bg_image_path_custom');
$event->bg_type = 'image'; $event->bg_type = 'image';
@ -173,12 +184,10 @@ class EventCustomizeController extends MyBaseController {
* Not in use for now. * Not in use for now.
*/ */
if (Input::hasFile('bg_image_path') && Input::get('bg_type') == 'custom_image') { 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'); $file_full_path = $path.'/'.$filename;
$filename = 'event_bg-'. md5($event->id) . '.' . strtolower(Input::file('bg_image_path')->getClientOriginalExtension());
$file_full_path = $path . '/' . $filename;
Input::file('bg_image_path')->move($path, $filename); Input::file('bg_image_path')->move($path, $filename);
@ -191,8 +200,7 @@ class EventCustomizeController extends MyBaseController {
$img->save($file_full_path, 75); $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'; $event->bg_type = 'custom_image';
\Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path)); \Storage::put(config('attendize.event_images_path').'/'.$filename, file_get_contents($file_full_path));
@ -201,10 +209,9 @@ class EventCustomizeController extends MyBaseController {
$event->save(); $event->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Event Page Succesfully Upated', 'message' => 'Event Page Succesfully Upated',
'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);' 'runThis' => 'document.getElementById(\'previewIframe\').contentWindow.location.reload(true);',
]); ]);
} }
} }

View File

@ -1,20 +1,24 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use View;
use Carbon\Carbon;
use App\Models\Event; use App\Models\Event;
use App\Models\EventStats; use App\Models\EventStats;
use DateTime, DatePeriod, DateInterval; use Carbon\Carbon;
use DateInterval;
use DatePeriod;
use DateTime;
use View;
class EventDashboardController extends MyBaseController { class EventDashboardController extends MyBaseController
{
public function showDashboard($event_id = false)
function showDashboard($event_id = FALSE) { {
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->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 * 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. * 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')) ->where('date', '>', Carbon::now()->subDays($num_days)->format('Y-m-d'))
->get() ->get()
->toArray(); ->toArray();
$startDate = new DateTime("-$num_days days"); $startDate = new DateTime("-$num_days days");
$dateItter = new DatePeriod( $dateItter = new DatePeriod(
$startDate, new DateInterval('P1D'), $num_days $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; * I have no idea what I was doing here, but it seems to work;
*/ */
$result = array(); $result = [];
$i = 0; $i = 0;
foreach ($dateItter as $date) { foreach ($dateItter as $date) {
$views = 0; $views = 0;
@ -52,23 +56,22 @@ class EventDashboardController extends MyBaseController {
$organiser_fees_volume = $item['organiser_fees_volume']; $organiser_fees_volume = $item['organiser_fees_volume'];
$unique_views = $item['unique_views']; $unique_views = $item['unique_views'];
$tickets_sold = $item['tickets_sold']; $tickets_sold = $item['tickets_sold'];
} }
$i++; $i++;
} }
$result[] = array( $result[] = [
"date" => $date->format('Y-m-d'), 'date' => $date->format('Y-m-d'),
"views" => $views, 'views' => $views,
'unique_views' => $unique_views, 'unique_views' => $unique_views,
'sales_volume' => $sales_volume + $organiser_fees_volume, 'sales_volume' => $sales_volume + $organiser_fees_volume,
'tickets_sold' => $tickets_sold 'tickets_sold' => $tickets_sold,
); ];
} }
$data = [ $data = [
'event' => $event, 'event' => $event,
'chartData' => json_encode($result) 'chartData' => json_encode($result),
]; ];
return View::make('ManageEvent.Dashboard', $data); return View::make('ManageEvent.Dashboard', $data);
@ -76,33 +79,31 @@ class EventDashboardController extends MyBaseController {
/** /**
* @param $chartData * @param $chartData
* @param bool|FALSE $from_date * @param bool|false $from_date
* @param bool|FALSE $toDate * @param bool|false $toDate
*
* @return string * @return string
*/ */
public function generateChartJson($chartData, $from_date = FALSE, $toDate = FALSE) { public function generateChartJson($chartData, $from_date = false, $toDate = false)
{
$data = []; $data = [];
$startdate = '2014-10-1'; $startdate = '2014-10-1';
$enddate = '2014-11-7'; $enddate = '2014-11-7';
$timestamp = strtotime($startdate); $timestamp = strtotime($startdate);
while ($startdate <= $enddate) { while ($startdate <= $enddate) {
$startdate = date('Y-m-d', $timestamp); $startdate = date('Y-m-d', $timestamp);
$data[] = [ $data[] = [
'date' => $startdate, 'date' => $startdate,
'tickets_sold' => rand(0, 7), 'tickets_sold' => rand(0, 7),
'views' => rand(0, 5), 'views' => rand(0, 5),
'unique_views' => rand(0, 5) 'unique_views' => rand(0, 5),
]; ];
$timestamp = strtotime('+1 days', strtotime($startdate)); $timestamp = strtotime('+1 days', strtotime($startdate));
} }
return json_encode($data); return json_encode($data);
} }
} }

View File

@ -2,28 +2,25 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use DB, use App\Models\Attendee;
Response,
Input,
View,
Exception,
Validator,
Log,
Mail;
use Excel;
use Bugsnag;
use Stripe,
Stripe_Charge;
use App\Models\Event; use App\Models\Event;
use App\Models\Order; 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 class EventOrdersController extends MyBaseController
{ {
public function showOrders($event_id = '') public function showOrders($event_id = '')
{ {
$allowed_sorts = ['first_name', 'email', 'order_reference', 'order_status_id', 'created_at']; $allowed_sorts = ['first_name', 'email', 'order_reference', 'order_status_id', 'created_at'];
$searchQuery = Input::get('q'); $searchQuery = Input::get('q');
@ -44,10 +41,10 @@ class EventOrdersController extends MyBaseController
$orders = $event->orders() $orders = $event->orders()
->where(function ($query) use ($searchQuery) { ->where(function ($query) use ($searchQuery) {
$query->where('order_reference', 'like', $searchQuery . '%') $query->where('order_reference', 'like', $searchQuery.'%')
->orWhere('first_name', 'like', $searchQuery . '%') ->orWhere('first_name', 'like', $searchQuery.'%')
->orWhere('email', 'like', $searchQuery . '%') ->orWhere('email', 'like', $searchQuery.'%')
->orWhere('last_name', 'like', $searchQuery . '%'); ->orWhere('last_name', 'like', $searchQuery.'%');
}) })
->orderBy($sort_by, $sort_order) ->orderBy($sort_by, $sort_order)
->paginate(); ->paginate();
@ -56,11 +53,11 @@ class EventOrdersController extends MyBaseController
} }
$data = [ $data = [
'orders' => $orders, 'orders' => $orders,
'event' => $event, 'event' => $event,
'sort_by' => $sort_by, 'sort_by' => $sort_by,
'sort_order' => $sort_order, 'sort_order' => $sort_order,
'q' => $searchQuery ? $searchQuery : '' 'q' => $searchQuery ? $searchQuery : '',
]; ];
return View::make('ManageEvent.Orders', $data); return View::make('ManageEvent.Orders', $data);
@ -68,9 +65,8 @@ class EventOrdersController extends MyBaseController
public function manageOrder($order_id) public function manageOrder($order_id)
{ {
$data = [ $data = [
'order' => Order::scope()->find($order_id), 'order' => Order::scope()->find($order_id),
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
@ -82,10 +78,10 @@ class EventOrdersController extends MyBaseController
$order = Order::scope()->find($order_id); $order = Order::scope()->find($order_id);
$data = [ $data = [
'order' => $order, 'order' => $order,
'event' => $order->event(), 'event' => $order->event(),
'attendees' => $order->attendees()->withoutCancelled()->get(), 'attendees' => $order->attendees()->withoutCancelled()->get(),
'modal_id' => Input::get('modal_id') 'modal_id' => Input::get('modal_id'),
]; ];
return View::make('ManageEvent.Modals.CancelOrder', $data); return View::make('ManageEvent.Modals.CancelOrder', $data);
@ -93,13 +89,13 @@ class EventOrdersController extends MyBaseController
/** /**
* @param $order_id * @param $order_id
*
* @return mixed * @return mixed
*/ */
public function postCancelOrder($order_id) public function postCancelOrder($order_id)
{ {
$rules = [ $rules = [
'refund_amount' => ['numeric'] 'refund_amount' => ['numeric'],
]; ];
$messages = [ $messages = [
'refund_amount.integer' => 'Refund amount must only contain numbers.', 'refund_amount.integer' => 'Refund amount must only contain numbers.',
@ -108,22 +104,20 @@ class EventOrdersController extends MyBaseController
$validator = Validator::make(Input::all(), $rules, $messages); $validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$order = Order::scope()->findOrFail($order_id); $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_type = Input::get('refund_type');
$refund_amount = Input::get('refund_amount'); $refund_amount = Input::get('refund_amount');
$attendees = Input::get('attendees'); $attendees = Input::get('attendees');
$error_message = FALSE; $error_message = false;
if ($refund_order) { if ($refund_order) {
if (!$order->transaction_id) { if (!$order->transaction_id) {
$error_message = 'Sorry, this order cannot be refunded.'; $error_message = 'Sorry, this order cannot be refunded.';
} }
@ -133,20 +127,18 @@ class EventOrdersController extends MyBaseController
} elseif ($order->organiser_amount == 0) { } elseif ($order->organiser_amount == 0) {
$error_message = 'Nothing to refund'; $error_message = 'Nothing to refund';
} elseif ($refund_amount > ($order->organiser_amount - $order->amount_refunded)) { } 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) { if (!$error_message) {
try { try {
Stripe::setApiKey($order->account->stripe_api_key); Stripe::setApiKey($order->account->stripe_api_key);
$charge = Stripe_Charge::retrieve($order->transaction_id); $charge = Stripe_Charge::retrieve($order->transaction_id);
if ($refund_type === 'full') { /* Full refund */ if ($refund_type === 'full') { /* Full refund */
$refund_amount = $order->organiser_amount - $order->amount_refunded; $refund_amount = $order->organiser_amount - $order->amount_refunded;
$refund = $charge->refund([ $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*/ /* Update the event sales volume*/
@ -155,14 +147,11 @@ class EventOrdersController extends MyBaseController
$order->is_refunded = 1; $order->is_refunded = 1;
$order->amount_refunded = $order->organiser_amount; $order->amount_refunded = $order->organiser_amount;
$order->order_status_id = config('attendize.order_refunded'); $order->order_status_id = config('attendize.order_refunded');
} else { /* Partial refund */ } else { /* Partial refund */
$refund = $charge->refund([ $refund = $charge->refund([
'amount' => $refund_amount * 100, 'amount' => $refund_amount * 100,
'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*/ /* Update the event sales volume*/
@ -179,8 +168,6 @@ class EventOrdersController extends MyBaseController
} }
$order->amount_refunded = round($refund->amount_refunded / 100, 2); $order->amount_refunded = round($refund->amount_refunded / 100, 2);
$order->save(); $order->save();
} catch (\Stripe_InvalidRequestError $e) { } catch (\Stripe_InvalidRequestError $e) {
Log::error($e); Log::error($e);
$error_message = 'There has been a problem processing your refund. Please check your information and try again.'; $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) { if ($error_message) {
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => $error_message 'message' => $error_message,
]); ]);
} }
} }
@ -219,11 +206,11 @@ class EventOrdersController extends MyBaseController
} }
\Session::flash('message', \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([ return Response::json([
'status' => 'success', 'status' => 'success',
'redirectUrl' => '' 'redirectUrl' => '',
]); ]);
} }
@ -233,12 +220,11 @@ class EventOrdersController extends MyBaseController
*/ */
public function showExportOrders($event_id, $export_as = 'xls') public function showExportOrders($event_id, $export_as = 'xls')
{ {
$event = Event::scope()->findOrFail($event_id); $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 // Chain the setters
$excel->setCreator(config('attendize.app_name')) $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_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`"), \DB::raw("(CASE WHEN orders.is_partially_refunded = 1 THEN 'YES' ELSE 'NO' END) AS `orders.is_partially_refunded`"),
'orders.amount_refunded', 'orders.amount_refunded',
'orders.created_at' 'orders.created_at',
])->get(); ])->get();
//DB::raw("(CASE WHEN UNIX_TIMESTAMP(`attendees.arrival_time`) = 0 THEN '---' ELSE 'd' END) AS `attendees.arrival_time`")) //DB::raw("(CASE WHEN UNIX_TIMESTAMP(`attendees.arrival_time`) = 0 THEN '---' ELSE 'd' END) AS `attendees.arrival_time`"))
$sheet->fromArray($data); $sheet->fromArray($data);
$sheet->row(1, array( $sheet->row(1, [
'First Name', 'Last Name', 'Email', 'Order Reference', 'Amount', 'Fully Refunded', 'Partially Refunded', 'Amount Refunded', 'Order Date' 'First Name', 'Last Name', 'Email', 'Order Reference', 'Amount', 'Fully Refunded', 'Partially Refunded', 'Amount Refunded', 'Order Date',
)); ]);
// Set gray background on first row // Set gray background on first row
$sheet->row(1, function ($row) { $sheet->row(1, function ($row) {
@ -279,12 +265,11 @@ class EventOrdersController extends MyBaseController
public function showMessageOrder($order_id) public function showMessageOrder($order_id)
{ {
$order = Order::scope()->findOrFail($order_id); $order = Order::scope()->findOrFail($order_id);
$data = [ $data = [
'order' => $order, 'order' => $order,
'event' => $order->event, 'event' => $order->event,
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
@ -293,29 +278,28 @@ class EventOrdersController extends MyBaseController
public function postMessageOrder($order_id) public function postMessageOrder($order_id)
{ {
$rules = [ $rules = [
'subject' => 'required|max:250', 'subject' => 'required|max:250',
'message' => 'required|max:5000' 'message' => 'required|max:5000',
]; ];
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$order = Attendee::scope()->findOrFail($order_id); $order = Attendee::scope()->findOrFail($order_id);
$data = [ $data = [
'order' => $order, 'order' => $order,
'message_content' => Input::get('message'), 'message_content' => Input::get('message'),
'subject' => Input::get('subject'), 'subject' => Input::get('subject'),
'event' => $order->event, 'event' => $order->event,
'email_logo' => $order->event->organiser->full_logo_path 'email_logo' => $order->event->organiser->full_logo_path,
]; ];
Mail::send('Emails.messageOrder', $data, function ($message) use ($order, $data) { Mail::send('Emails.messageOrder', $data, function ($message) use ($order, $data) {
@ -331,15 +315,13 @@ class EventOrdersController extends MyBaseController
$message->to($order->event->organiser->email) $message->to($order->event->organiser->email)
->from(config('attendize.outgoing_email_noreply'), $order->event->organiser->name) ->from(config('attendize.outgoing_email_noreply'), $order->event->organiser->name)
->replyTo($order->event->organiser->email, $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([
return Response::json(array( 'status' => 'success',
'status' => 'success', 'message' => 'Message Successfully Sent',
'message' => 'Message Successfully Sent' ]);
));
} }
} }

View File

@ -1,14 +1,15 @@
<?php namespace App\Http\Controllers; <?php
class EventPromoteController extends MyBaseController { namespace App\Http\Controllers;
public function showPromote($event_id) { class EventPromoteController extends MyBaseController
{
public function showPromote($event_id)
{
$data = [ $data = [
'event' => Event::scope()->find($event_id) 'event' => Event::scope()->find($event_id),
]; ];
return View::make('ManageEvent.Promote', $data); return View::make('ManageEvent.Promote', $data);
} }
} }

View File

@ -1,49 +1,43 @@
<?php namespace App\Http\Controllers; <?php
class EventTicketQuestionsController extends MyBaseController { namespace App\Http\Controllers;
class EventTicketQuestionsController extends MyBaseController
public function showQuestions($event_id) { {
public function showQuestions($event_id)
{
$data = [ $data = [
'event' => Event::scope()->findOrFail($event_id), 'event' => Event::scope()->findOrFail($event_id),
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
'question_types' => QuestionType::all() 'question_types' => QuestionType::all(),
]; ];
return View::make('ManageEvent.Modals.ViewQuestions', $data); return View::make('ManageEvent.Modals.ViewQuestions', $data);
} }
public function postCreateQuestion($event_id)
public function postCreateQuestion($event_id) { {
$event = Event::findOrFail($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->title = Input::get('title');
$question->instructions = Input::get('instructions'); $question->instructions = Input::get('instructions');
$question->options = Input::get('options'); $question->options = Input::get('options');
$question->is_required = Input::get('title'); $question->is_required = Input::get('title');
$question->question_type_id = Input::get('question_type_id'); $question->question_type_id = Input::get('question_type_id');
$question->save(); $question->save();
$ticket_ids = Input::get('tickets'); $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); Ticket::scope()->find($ticket_id)->questions()->attach($question->id);
} }
$event->questions()->attach($question->id); $event->questions()->attach($question->id);
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Successfully Created Question' 'message' => 'Successfully Created Question',
]); ]);
} }
} }

View File

@ -1,76 +1,79 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use Input, View, Response, Log;
use App\Models\Event; use App\Models\Event;
use App\Models\Ticket; use App\Models\Ticket;
use Carbon\Carbon;
use Input;
use Log;
use Response;
use View;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
class EventTicketsController extends MyBaseController { class EventTicketsController extends MyBaseController
{
public function showTickets($event_id) { public function showTickets($event_id)
{
$allowed_sorts = ['created_at', 'quantity_sold', 'sales_volume', 'title']; $allowed_sorts = ['created_at', 'quantity_sold', 'sales_volume', 'title'];
$searchQuery = Input::get('q'); $searchQuery = Input::get('q');
$sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'created_at'); $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'created_at');
$event = Event::scope()->findOrFail($event_id); $event = Event::scope()->findOrFail($event_id);
$tickets = $searchQuery $tickets = $searchQuery
? $event->tickets()->where('title', 'like', '%' . $searchQuery . '%')->orderBy($sort_by, 'desc')->paginate(10) ? $event->tickets()->where('title', 'like', '%'.$searchQuery.'%')->orderBy($sort_by, 'desc')->paginate(10)
: $event->tickets()->orderBy($sort_by, 'desc')->paginate(10); : $event->tickets()->orderBy($sort_by, 'desc')->paginate(10);
$data = [ $data = [
'event' => $event, 'event' => $event,
'tickets' => $tickets, 'tickets' => $tickets,
'sort_by' => $sort_by, 'sort_by' => $sort_by,
'q' => $searchQuery ? $searchQuery : '' 'q' => $searchQuery ? $searchQuery : '',
]; ];
return View::make('ManageEvent.Tickets', $data); return View::make('ManageEvent.Tickets', $data);
} }
public function showEditTicket($event_id, $ticket_id) { public function showEditTicket($event_id, $ticket_id)
{
$data = [ $data = [
'event' => Event::scope()->find($event_id), 'event' => Event::scope()->find($event_id),
'ticket' => Ticket::scope()->find($ticket_id), 'ticket' => Ticket::scope()->find($ticket_id),
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
]; ];
return View::make('ManageEvent.Modals.EditTicket', $data); return View::make('ManageEvent.Modals.EditTicket', $data);
} }
public function showCreateTicket($event_id) { public function showCreateTicket($event_id)
return View::make('ManageEvent.Modals.CreateTicket', array( {
return View::make('ManageEvent.Modals.CreateTicket', [
'modal_id' => Input::get('modal_id'), '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(); $ticket = Ticket::createNew();
if (!$ticket->validate(Input::all())) { if (!$ticket->validate(Input::all())) {
return Response::json([
return Response::json(array( 'status' => 'error',
'status' => 'error', 'messages' => $ticket->errors(),
'messages' => $ticket->errors() ]);
));
} }
$ticket->event_id = $event_id; $ticket->event_id = $event_id;
$ticket->title = Input::get('title'); $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->start_sale_date = Input::get('start_sale_date') ? Carbon::createFromFormat('d-m-Y H:i', Input::get('start_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->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->price = Input::get('price');
$ticket->min_per_person = Input::get('min_per_person'); $ticket->min_per_person = Input::get('min_per_person');
$ticket->max_per_person = Input::get('max_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'); \Session::flash('message', 'Successfully Created Ticket');
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $ticket->id, 'id' => $ticket->id,
'message' => 'Refreshing...', 'message' => 'Refreshing...',
'redirectUrl' => route('showEventTickets', array( 'redirectUrl' => route('showEventTickets', [
'event_id' => $event_id 'event_id' => $event_id,
)) ]),
)); ]);
} }
public function postPauseTicket() { public function postPauseTicket()
{
$ticket_id = Input::get('ticket_id'); $ticket_id = Input::get('ticket_id');
$ticket = Ticket::scope()->find($ticket_id); $ticket = Ticket::scope()->find($ticket_id);
$ticket->is_paused = ($ticket->is_paused == 1) ? 0 : 1; $ticket->is_paused = ($ticket->is_paused == 1) ? 0 : 1;
if ($ticket->save()) { if ($ticket->save()) {
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Ticket Successfully Updated', 'message' => 'Ticket Successfully Updated',
'id' => $ticket->id 'id' => $ticket->id,
]); ]);
} }
Log::error('Ticket Failed to pause/resume', [ Log::error('Ticket Failed to pause/resume', [
'ticket' => $ticket 'ticket' => $ticket,
]); ]);
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'id' => $ticket->id, 'id' => $ticket->id,
'message' => 'Whoops!, looks like something went wrong. Please try again.' 'message' => 'Whoops!, looks like something went wrong. Please try again.',
]); ]);
} }
public function postDeleteTicket() {
public function postDeleteTicket()
{
$ticket_id = Input::get('ticket_id'); $ticket_id = Input::get('ticket_id');
$ticket = Ticket::scope()->find($ticket_id); $ticket = Ticket::scope()->find($ticket_id);
if ($ticket->quantity_sold > 0) { if ($ticket->quantity_sold > 0) {
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'message' => 'Sorry, you can\'t delete this ticket as some have already been sold', 'message' => 'Sorry, you can\'t delete this ticket as some have already been sold',
'id' => $ticket->id 'id' => $ticket->id,
]); ]);
} }
if ($ticket->delete()) { if ($ticket->delete()) {
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Ticket Successfully Deleted', 'message' => 'Ticket Successfully Deleted',
'id' => $ticket->id 'id' => $ticket->id,
]); ]);
} }
Log::error('Ticket Failed to delete', [ Log::error('Ticket Failed to delete', [
'ticket' => $ticket 'ticket' => $ticket,
]); ]);
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'id' => $ticket->id, 'id' => $ticket->id,
'message' => 'Whoops!, looks like something went wrong. Please try again.' '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); $ticket = Ticket::findOrFail($ticket_id);
/* /*
* Override some vaidation rules * 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.'; $validation_messages['quantity_available.min'] = 'Quantity available can\'t be less the amount sold or reserved.';
$ticket->rules = $validation_rules + $ticket->rules; $ticket->rules = $validation_rules + $ticket->rules;
$ticket->messages = $validation_messages + $ticket->messages; $ticket->messages = $validation_messages + $ticket->messages;
if (!$ticket->validate(Input::all())) {
return Response::json(array( if (!$ticket->validate(Input::all())) {
'status' => 'error', return Response::json([
'messages' => $ticket->errors() 'status' => 'error',
)); 'messages' => $ticket->errors(),
]);
} }
$ticket->title = Input::get('title'); $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->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->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->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->description = Input::get('description');
$ticket->min_per_person = Input::get('min_per_person'); $ticket->min_per_person = Input::get('min_per_person');
$ticket->max_per_person = Input::get('max_per_person'); $ticket->max_per_person = Input::get('max_per_person');
$ticket->save(); $ticket->save();
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $ticket->id, 'id' => $ticket->id,
'message' => 'Refreshing...', 'message' => 'Refreshing...',
'redirectUrl' => route('showEventTickets', array( 'redirectUrl' => route('showEventTickets', [
'event_id' => $event_id 'event_id' => $event_id,
)) ]),
)); ]);
} }
} }

View File

@ -1,35 +1,38 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use Input, View, Cookie, Mail, Validator, Response, Auth;
use App\Http\Controllers\Controller;
use App\Models\Event;
use App\Models\Affiliate; use App\Models\Affiliate;
use App\Models\Event;
use App\Models\EventStats; use App\Models\EventStats;
use Auth;
use Cookie;
use Input;
use Mail;
use Response;
use Validator;
use View;
class EventViewController extends Controller class EventViewController extends Controller
{ {
public function showEventHome($event_id, $slug = '', $preview = false)
public function showEventHome($event_id, $slug = '', $preview = FALSE)
{ {
$event = Event::findOrFail($event_id); $event = Event::findOrFail($event_id);
if(!Auth::check() && !$event->is_live) { if (!Auth::check() && !$event->is_live) {
return View::make('Public.ViewEvent.EventNotLivePage'); return View::make('Public.ViewEvent.EventNotLivePage');
} }
$data = [ $data = [
'event' => $event, 'event' => $event,
'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(),
'is_embedded' => 0 'is_embedded' => 0,
]; ];
/* /*
* Don't record stats if we're previewing the event page from the backend or if we own the event. * Don't record stats if we're previewing the event page from the backend or if we own the event.
*/ */
if (!$preview || !Auth::check()) { if (!$preview || !Auth::check()) {
$event_stats = new EventStats();
$event_stats = new EventStats;
$event_stats->updateViewCount($event_id); $event_stats->updateViewCount($event_id);
} }
@ -37,13 +40,12 @@ class EventViewController extends Controller
* See if there is an affiliate referral in the URL * See if there is an affiliate referral in the URL
*/ */
if ($affiliate_ref = \Input::get('ref')) { if ($affiliate_ref = \Input::get('ref')) {
$affiliate_ref = preg_replace("/\W|_/", '', $affiliate_ref); $affiliate_ref = preg_replace("/\W|_/", '', $affiliate_ref);
if ($affiliate_ref) { if ($affiliate_ref) {
$affiliate = Affiliate::firstOrNew([ $affiliate = Affiliate::firstOrNew([
'name' => Input::get('ref'), 'name' => Input::get('ref'),
'event_id' => $event_id, 'event_id' => $event_id,
'account_id' => $event->account_id, 'account_id' => $event->account_id,
]); ]);
@ -51,7 +53,7 @@ class EventViewController extends Controller
$affiliate->save(); $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) public function showEventHomePreview($event_id)
{ {
return showEventHome($event_id, TRUE); return showEventHome($event_id, true);
} }
public function postContactOrganiser($event_id) public function postContactOrganiser($event_id)
{ {
$rules = [ $rules = [
'name' => 'required', 'name' => 'required',
'email' => ['required', 'email'], 'email' => ['required', 'email'],
'message' => ['required'] 'message' => ['required'],
]; ];
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) { if ($validator->fails()) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validator->messages()->toArray() 'messages' => $validator->messages()->toArray(),
)); ]);
} }
$event = Event::findOrFail($event_id); $event = Event::findOrFail($event_id);
$data = [ $data = [
'sender_name' => Input::get('name'), 'sender_name' => Input::get('name'),
'sender_email' => Input::get('email'), 'sender_email' => Input::get('email'),
'message_content' => strip_tags(Input::get('message')), 'message_content' => strip_tags(Input::get('message')),
'event' => $event 'event' => $event,
]; ];
Mail::send('Emails.messageOrganiser', $data, function ($message) use ($event, $data) { Mail::send('Emails.messageOrganiser', $data, function ($message) use ($event, $data) {
$message->to($event->organiser->email, $event->organiser->name) $message->to($event->organiser->email, $event->organiser->name)
->from(config('attendize.outgoing_email_noreply'), $data['sender_name']) ->from(config('attendize.outgoing_email_noreply'), $data['sender_name'])
->replyTo($data['sender_email'], $data['sender_name']) ->replyTo($data['sender_email'], $data['sender_name'])
->subject('Message Regarding: ' . $event->title); ->subject('Message Regarding: '.$event->title);
}); });
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Message Successfully Sent' 'message' => 'Message Successfully Sent',
)); ]);
} }
} }

View File

@ -1,23 +1,22 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use View;
use App\Http\Controllers\Controller;
use App\Models\Event; use App\Models\Event;
use View;
class EventViewEmbeddedController extends Controller
class EventViewEmbeddedController extends Controller { {
public function showEmbeddedEvent($event_id)
public function showEmbeddedEvent($event_id) { {
$event = Event::findOrFail($event_id); $event = Event::findOrFail($event_id);
$data = [ $data = [
'event' => $event, 'event' => $event,
'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(), 'tickets' => $event->tickets()->orderBy('created_at', 'desc')->get(),
'is_embedded' => '1' 'is_embedded' => '1',
]; ];
return View::make('Public.ViewEvent.Embedded.EventPage', $data); return View::make('Public.ViewEvent.Embedded.EventPage', $data);
} }
} }

View File

@ -1,10 +1,11 @@
<?php namespace App\Http\Controllers; <?php
use App\Http\Controllers\Controller; namespace App\Http\Controllers;
class ImageController extends Controller { class ImageController extends Controller
{
public function generateThumbnail($image_src, $width = FALSE, $height = false, $quality = 90) { public function generateThumbnail($image_src, $width = false, $height = false, $quality = 90)
{
$img = Image::make('public/foo.jpg'); $img = Image::make('public/foo.jpg');
$img->resize(320, 240); $img->resize(320, 240);
@ -13,5 +14,4 @@ class ImageController extends Controller {
$img->save('public/bar.jpg'); $img->save('public/bar.jpg');
} }
} }

View File

@ -1,25 +1,23 @@
<?php namespace App\Http\Controllers; <?php
use View; namespace App\Http\Controllers;
use Response;
use App\Models\Timezone;
use Artisan;
use Config; use Config;
use DB;
use Input; use Input;
use Redirect; use Redirect;
use Artisan; use Response;
use DB; use View;
use File;
use App\Http\Controllers\Controller;
use App\Models\Timezone;
class InstallerController extends Controller class InstallerController extends Controller
{ {
public function __construct() public function __construct()
{ {
if(file_exists(base_path('installed'))) { if (file_exists(base_path('installed'))) {
abort(403, 'Unauthorized action.'); abort(403, 'Unauthorized action.');
} }
} }
public function showInstaller() public function showInstaller()
@ -29,14 +27,14 @@ class InstallerController extends Controller
storage_path('framework'), storage_path('framework'),
storage_path('logs'), storage_path('logs'),
public_path('user_content'), public_path('user_content'),
base_path('.env') base_path('.env'),
]; ];
$data['requirements'] = [ $data['requirements'] = [
'openssl', 'openssl',
'pdo', 'pdo',
'mbstring', 'mbstring',
'fileinfo', 'fileinfo',
'tokenizer' 'tokenizer',
]; ];
return View::make('Installer.Installer', $data); return View::make('Installer.Installer', $data);
@ -65,78 +63,74 @@ class InstallerController extends Controller
$app_key = str_random(16); $app_key = str_random(16);
$version = file_get_contents(base_path('VERSION')); $version = file_get_contents(base_path('VERSION'));
if (Input::get('test') === 'db') { if (Input::get('test') === 'db') {
$is_db_valid = self::testDatabase($database); $is_db_valid = self::testDatabase($database);
if ($is_db_valid === 'yes') { if ($is_db_valid === 'yes') {
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Success, Your connection works!', 'message' => 'Success, Your connection works!',
'test' => 1 'test' => 1,
]); ]);
} }
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'message' => 'Unable to connect! Please check your settings', 'message' => 'Unable to connect! Please check your settings',
'test' => 1 'test' => 1,
]); ]);
} }
$config = "APP_ENV=production\n".
$config = "APP_ENV=production\n" . "APP_DEBUG=false\n".
"APP_DEBUG=false\n" . "APP_URL={$app_url}\n".
"APP_URL={$app_url}\n" . "APP_KEY={$app_key}\n\n".
"APP_KEY={$app_key}\n\n" . "DB_TYPE=mysql\n".
"DB_TYPE=mysql\n" . "DB_HOST={$database['host']}\n".
"DB_HOST={$database['host']}\n" . "DB_DATABASE={$database['name']}\n".
"DB_DATABASE={$database['name']}\n" . "DB_USERNAME={$database['username']}\n".
"DB_USERNAME={$database['username']}\n" . "DB_PASSWORD={$database['password']}\n\n".
"DB_PASSWORD={$database['password']}\n\n" . "MAIL_DRIVER={$mail['driver']}\n".
"MAIL_DRIVER={$mail['driver']}\n" . "MAIL_PORT={$mail['port']}\n".
"MAIL_PORT={$mail['port']}\n" . "MAIL_ENCRYPTION={$mail['encryption']}\n".
"MAIL_ENCRYPTION={$mail['encryption']}\n" . "MAIL_HOST={$mail['host']}\n".
"MAIL_HOST={$mail['host']}\n" . "MAIL_USERNAME={$mail['username']}\n".
"MAIL_USERNAME={$mail['username']}\n" . "MAIL_FROM_NAME={$mail['from_name']}\n".
"MAIL_FROM_NAME={$mail['from_name']}\n" . "MAIL_FROM_ADDRESS={$mail['from_address']}\n".
"MAIL_FROM_ADDRESS={$mail['from_address']}\n" .
"MAIL_PASSWORD={$mail['password']}\n\n"; "MAIL_PASSWORD={$mail['password']}\n\n";
$fp = fopen(base_path()."/.env", 'w'); $fp = fopen(base_path().'/.env', 'w');
fwrite($fp, $config); fwrite($fp, $config);
fclose($fp); fclose($fp);
Config::set('database.default', $database['type']); Config::set('database.default', $database['type']);
Config::set("database.connections.mysql.host", $database['host']); Config::set('database.connections.mysql.host', $database['host']);
Config::set("database.connections.mysql.database", $database['name']); Config::set('database.connections.mysql.database', $database['name']);
Config::set("database.connections.mysql.username", $database['username']); Config::set('database.connections.mysql.username', $database['username']);
Config::set("database.connections.mysql.password", $database['password']); Config::set('database.connections.mysql.password', $database['password']);
DB::reconnect(); DB::reconnect();
Artisan::call('migrate', array('--force' => true)); Artisan::call('migrate', ['--force' => true]);
if (Timezone::count() == 0) { 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); fwrite($fp, $version);
fclose($fp); fclose($fp);
return Redirect::route('showSignup',['first_run' => 'yup']); return Redirect::route('showSignup', ['first_run' => 'yup']);
} }
private function testDatabase($database) private function testDatabase($database)
{ {
Config::set('database.default', $database['type']); Config::set('database.default', $database['type']);
Config::set("database.connections.mysql.host", $database['host']); Config::set('database.connections.mysql.host', $database['host']);
Config::set("database.connections.mysql.database", $database['name']); Config::set('database.connections.mysql.database', $database['name']);
Config::set("database.connections.mysql.username", $database['username']); Config::set('database.connections.mysql.username', $database['username']);
Config::set("database.connections.mysql.password", $database['password']); Config::set('database.connections.mysql.password', $database['password']);
try { try {
DB::reconnect(); DB::reconnect();
@ -144,8 +138,7 @@ class InstallerController extends Controller
} catch (Exception $e) { } catch (Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
return $success; return $success;
} }
}
}

View File

@ -2,35 +2,34 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input,
Response,
View,
Auth;
use HttpClient;
use App\Models\Account; use App\Models\Account;
use App\Models\Timezone;
use App\Models\Currency; use App\Models\Currency;
use App\Models\Timezone;
use App\Models\User; use App\Models\User;
use Auth;
use HttpClient;
use Input;
use Response;
use View;
class ManageAccountController extends MyBaseController
class ManageAccountController extends MyBaseController { {
public function showEditAccount()
public function showEditAccount() { {
$data = [ $data = [
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
'account' => Account::find(Auth::user()->account_id), 'account' => Account::find(Auth::user()->account_id),
'timezones' => Timezone::lists('location', 'id'), 'timezones' => Timezone::lists('location', 'id'),
'currencies' => Currency::lists('title', 'id') 'currencies' => Currency::lists('title', 'id'),
]; ];
return View::make('ManageAccount.Modals.EditAccount', $data); 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')) { if (Input::get('error') || !Input::get('code')) {
//BugSnag::notifyError('Error Connecting to Stripe', Input::get('error')); //BugSnag::notifyError('Error Connecting to Stripe', Input::get('error'));
\Session::flash('message', $error_message); \Session::flash('message', $error_message);
@ -39,26 +38,26 @@ class ManageAccountController extends MyBaseController {
} }
$request = [ $request = [
'url' => 'https://connect.stripe.com/oauth/token', 'url' => 'https://connect.stripe.com/oauth/token',
'params' => [ 'params' => [
'client_secret' => STRIPE_SECRET_KEY, //sk_test_iXk2Ky0DlhIcTcKMvsDa8iKI', 'client_secret' => STRIPE_SECRET_KEY, //sk_test_iXk2Ky0DlhIcTcKMvsDa8iKI',
'code' => Input::get('code'), 'code' => Input::get('code'),
'grant_type' => 'authorization_code' 'grant_type' => 'authorization_code',
] ],
]; ];
$response = HttpClient::post($request); $response = HttpClient::post($request);
$content = $response->json(); $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')); //BugSnag::notifyError('Error Connecting to Stripe', Input::get('error'));
\Session::flash('message', $error_message); \Session::flash('message', $error_message);
return redirect()->route('showEventsDashboard'); return redirect()->route('showEventsDashboard');
} }
$account = Account::find(\Auth::user()->account_id); $account = Account::find(\Auth::user()->account_id);
$account->stripe_access_token = $content->access_token; $account->stripe_access_token = $content->access_token;
$account->stripe_refresh_token = $content->refresh_token; $account->stripe_refresh_token = $content->refresh_token;
@ -66,19 +65,20 @@ class ManageAccountController extends MyBaseController {
$account->stripe_data_raw = json_encode($content); $account->stripe_data_raw = json_encode($content);
$account->save(); $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'); return redirect()->route('showEventsDashboard');
} }
public function postEditAccount() { public function postEditAccount()
{
$account = Account::find(Auth::user()->account_id); $account = Account::find(Auth::user()->account_id);
if (!$account->validate(Input::all())) { if (!$account->validate(Input::all())) {
return Response::json([
return Response::json(array( 'status' => 'error',
'status' => 'error', 'messages' => $account->errors(),
'messages' => $account->errors() ]);
));
} }
$account->first_name = Input::get('first_name'); $account->first_name = Input::get('first_name');
@ -88,14 +88,15 @@ class ManageAccountController extends MyBaseController {
$account->currency_id = Input::get('currency_id'); $account->currency_id = Input::get('currency_id');
$account->save(); $account->save();
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $account->id, 'id' => $account->id,
'message' => 'Account Successfully Updated' 'message' => 'Account Successfully Updated',
)); ]);
} }
public function postEditAccountPayment() { public function postEditAccountPayment()
{
$account = Account::find(Auth::user()->account_id); $account = Account::find(Auth::user()->account_id);
$account->stripe_publishable_key = Input::get('stripe_publishable_key'); $account->stripe_publishable_key = Input::get('stripe_publishable_key');
@ -103,58 +104,56 @@ class ManageAccountController extends MyBaseController {
$account->save(); $account->save();
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'id' => $account->id, 'id' => $account->id,
'message' => 'Payment Information Successfully Updated' 'message' => 'Payment Information Successfully Updated',
)); ]);
} }
public function postInviteUser() { public function postInviteUser()
$rules = array( {
'email' => array('required', 'email', 'unique:users,email,NULL,id,account_id,'.Auth::user()->account_id), $rules = [
); 'email' => ['required', 'email', 'unique:users,email,NULL,id,account_id,'.Auth::user()->account_id],
];
$messages = array(
'email.email' => 'Please enter a valid E-mail address.', $messages = [
'email.required' => 'E-mail address is required.', 'email.email' => 'Please enter a valid E-mail address.',
'email.unique' => 'E-mail already in use for this account.', 'email.required' => 'E-mail address is required.',
); 'email.unique' => 'E-mail already in use for this account.',
];
$validation = \Validator::make(Input::all(), $rules, $messages);
$validation = \Validator::make(Input::all(), $rules, $messages);
if ($validation->fails()) {
return \Response::json([ if ($validation->fails()) {
'status' => 'error', return \Response::json([
'messages'=> $validation->messages()->toArray() 'status' => 'error',
]); 'messages' => $validation->messages()->toArray(),
} ]);
}
$temp_password = str_random(8); $temp_password = str_random(8);
$user = new User; $user = new User();
$user->email = Input::get('email'); $user->email = Input::get('email');
$user->password = \Hash::make($temp_password); $user->password = \Hash::make($temp_password);
$user->account_id = Auth::user()->account_id; $user->account_id = Auth::user()->account_id;
$user->save(); $user->save();
$data = [ $data = [
'user' => $user, 'user' => $user,
'temp_password' => $temp_password, '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) $message->to($data['user']->email)
->subject($data['inviter']->first_name.' '.$data['inviter']->last_name.' added you to an Attendize Ticketing account.'); ->subject($data['inviter']->first_name.' '.$data['inviter']->last_name.' added you to an Attendize Ticketing account.');
}); });
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message'=> 'Success! <b>'.$user->email.'</b> has been sent further instructions.' 'message' => 'Success! <b>'.$user->email.'</b> has been sent further instructions.',
]); ]);
} }
} }

View File

@ -1,14 +1,14 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use App\Models\Event; use App\Models\Event;
use App\Http\Controllers\Controller;
use App\Attendize\Utils;
use App\Models\Organiser; use App\Models\Organiser;
use View; use View;
class MyBaseController extends Controller { class MyBaseController extends Controller
{
public function __construct() public function __construct()
{ {
View::share('organisers', Organiser::scope()->get()); View::share('organisers', Organiser::scope()->get());
@ -19,7 +19,8 @@ class MyBaseController extends Controller {
* *
* @return void * @return void
*/ */
protected function setupLayout() { protected function setupLayout()
{
if (!is_null($this->layout)) { if (!is_null($this->layout)) {
$this->layout = View::make($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. * 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 * @param array $additional_data
*
* @return arrau * @return arrau
*/ */
public function getEventViewData($event_id, $additional_data = array()) { public function getEventViewData($event_id, $additional_data = [])
return array_merge(array( {
'event' => Event::scope()->findOrFail($event_id) return array_merge([
) 'event' => Event::scope()->findOrFail($event_id),
, $additional_data); ], $additional_data);
} }
} }

View File

@ -2,80 +2,77 @@
namespace App\Http\Controllers; 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\Event;
use App\Models\Organiser; use App\Models\Organiser;
use Image;
use Input;
use Response;
use View;
class OrganiserController extends MyBaseController { class OrganiserController extends MyBaseController
{
public function showSelectOragniser() { public function showSelectOragniser()
{
return View::make('ManageOrganiser.SelectOrganiser'); return View::make('ManageOrganiser.SelectOrganiser');
} }
public function showOrganiserDashboard($organiser_id = FALSE) { public function showOrganiserDashboard($organiser_id = false)
{
$allowed_sorts = ['created_at', 'start_date', 'end_date', 'title']; $allowed_sorts = ['created_at', 'start_date', 'end_date', 'title'];
$searchQuery = Input::get('q'); $searchQuery = Input::get('q');
//$sort_order = Input::get('sort_order') == 'asc' ? 'asc' : 'desc'; //$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'); $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'start_date');
$events = $searchQuery $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); : Event::scope()->where('organiser_id', '=', $organiser_id)->orderBy($sort_by, 'desc')->paginate(12);
$data = [ $data = [
'events' => $events, 'events' => $events,
'organisers' => Organiser::scope()->orderBy('name')->get(), 'organisers' => Organiser::scope()->orderBy('name')->get(),
'current_organiser' => Organiser::scope()->find($organiser_id), 'current_organiser' => Organiser::scope()->find($organiser_id),
'q' => $searchQuery ? $searchQuery : '', //Redundant 'q' => $searchQuery ? $searchQuery : '', //Redundant
'search' => [ 'search' => [
'q' => $searchQuery ? $searchQuery : '', 'q' => $searchQuery ? $searchQuery : '',
'sort_by' => $sort_by, 'sort_by' => $sort_by,
'showPast' => Input::get('past') 'showPast' => Input::get('past'),
] ],
]; ];
return View::make('ManageEvents.OrganiserDashboard', $data); return View::make('ManageEvents.OrganiserDashboard', $data);
} }
public function showEditOrganiser($organiser_id)
public function showEditOrganiser($organiser_id) { {
$organiser = Organiser::scope()->findOrfail($organiser_id); $organiser = Organiser::scope()->findOrfail($organiser_id);
return View::make('ManageEvents.Modals.EditOrganiser', [ return View::make('ManageEvents.Modals.EditOrganiser', [
'modal_id' => Input::get('modal_id'), 'modal_id' => Input::get('modal_id'),
'organiser' => $organiser 'organiser' => $organiser,
]); ]);
} }
public function showCreateOrganiser() { public function showCreateOrganiser()
{
return View::make('ManageOrganiser.CreateOrganiser', [ return View::make('ManageOrganiser.CreateOrganiser', [
'modal_id' => 'createOrganiser' 'modal_id' => 'createOrganiser',
]); ]);
return View::make('ManageEvents.Modals.CreateOrganiser', [ return View::make('ManageEvents.Modals.CreateOrganiser', [
'modal_id' => Input::get('modal_id') 'modal_id' => Input::get('modal_id'),
]); ]);
} }
public function postCreateOrganiser() { public function postCreateOrganiser()
$organiser = Organiser::createNew(FALSE, FALSE, TRUE); {
$organiser = Organiser::createNew(false, false, true);
if (!$organiser->validate(Input::all())) { if (!$organiser->validate(Input::all())) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $organiser->errors() 'messages' => $organiser->errors(),
)); ]);
} }
$organiser->name = Input::get('name'); $organiser->name = Input::get('name');
@ -83,14 +80,13 @@ class OrganiserController extends MyBaseController {
$organiser->email = Input::get('email'); $organiser->email = Input::get('email');
$organiser->facebook = Input::get('facebook'); $organiser->facebook = Input::get('facebook');
$organiser->twitter = Input::get('twitter'); $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')) { 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'); $file_full_path = $path.'/'.$filename;
$filename = 'organiser_logo-' . $organiser->id . '.' . strtolower(Input::file('organiser_logo')->getClientOriginalExtension());
$file_full_path = $path . '/' . $filename;
Input::file('organiser_logo')->move($path, $filename); Input::file('organiser_logo')->move($path, $filename);
@ -102,26 +98,21 @@ class OrganiserController extends MyBaseController {
}); });
$img->save($file_full_path); $img->save($file_full_path);
if(file_exists($file_full_path)) { if (file_exists($file_full_path)) {
$organiser->logo_path = config('attendize.organiser_images_path') . '/' . $filename; $organiser->logo_path = config('attendize.organiser_images_path').'/'.$filename;
} }
} }
$organiser->save(); $organiser->save();
\Session::flash('message', 'Successfully Created Organiser'); \Session::flash('message', 'Successfully Created Organiser');
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Refreshing..', 'message' => 'Refreshing..',
'redirectUrl' => route('showOrganiserDashboard', [ 'redirectUrl' => route('showOrganiserDashboard', [
'organiser_id' => $organiser->id 'organiser_id' => $organiser->id,
]) ]),
)); ]);
} }
} }

View File

@ -1,35 +1,35 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use Input;
use View;
use Session;
use Response;
use File;
use Storage;
use Image;
use App\Models\Organiser; use App\Models\Organiser;
use App\Models\Event; use File;
use Image;
use Input;
use Response;
use Session;
use View;
class OrganiserCustomizeController extends MyBaseController class OrganiserCustomizeController extends MyBaseController
{ {
public function showCustomize($organiser_id)
public function showCustomize($organiser_id) { {
$data = [ $data = [
'organiser' => Organiser::scope()->findOrFail($organiser_id) 'organiser' => Organiser::scope()->findOrFail($organiser_id),
]; ];
return View::make('ManageOrganiser.Customize', $data); return View::make('ManageOrganiser.Customize', $data);
} }
public function postEditOrganiser($organiser_id) { public function postEditOrganiser($organiser_id)
{
$organiser = Organiser::scope()->find($organiser_id); $organiser = Organiser::scope()->find($organiser_id);
if (!$organiser->validate(Input::all())) { if (!$organiser->validate(Input::all())) {
return Response::json(array( return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $organiser->errors() 'messages' => $organiser->errors(),
)); ]);
} }
$organiser->name = Input::get('name'); $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 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; $organiser->is_email_confirmed = 0;
} }
@ -49,12 +49,11 @@ class OrganiserCustomizeController extends MyBaseController
$organiser->logo_path = ''; $organiser->logo_path = '';
} }
if (Input::hasFile('organiser_logo') ) { if (Input::hasFile('organiser_logo')) {
$the_file = \File::get(Input::file('organiser_logo')->getRealPath()); $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; $full_path_to_file = public_path().'/'.$relative_path_to_file;
$img = Image::make($the_file); $img = Image::make($the_file);
@ -66,23 +65,20 @@ class OrganiserCustomizeController extends MyBaseController
$img->save($full_path_to_file); $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->logo_path = $relative_path_to_file;
} }
} }
$organiser->save(); $organiser->save();
Session::flash('message', 'Successfully Updated Organiser'); Session::flash('message', 'Successfully Updated Organiser');
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'redirectUrl' => route('showOrganiserCustomize', [ 'redirectUrl' => route('showOrganiserCustomize', [
'organiser_id' => $organiser->id 'organiser_id' => $organiser->id,
]) ]),
)); ]);
} }
}
}

View File

@ -1,34 +1,28 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use App\Models\Organiser; use App\Models\Organiser;
use App\Models\Event;
use App\Models\Attendee;
use View;
use Carbon\Carbon; use Carbon\Carbon;
use Input; use View;
class OrganiserDashboardController extends MyBaseController class OrganiserDashboardController extends MyBaseController
{ {
public function showDashboard($organiser_id) public function showDashboard($organiser_id)
{ {
$organiser = Organiser::scope()->findOrFail($organiser_id); $organiser = Organiser::scope()->findOrFail($organiser_id);
$upcoming_events = $organiser->events()->where('end_date', '>=', Carbon::now())->get(); $upcoming_events = $organiser->events()->where('end_date', '>=', Carbon::now())->get();
$data = [ $data = [
'organiser' => $organiser, 'organiser' => $organiser,
'upcoming_events' => $upcoming_events, 'upcoming_events' => $upcoming_events,
'search' => [ 'search' => [
'sort_by' => 's', 'sort_by' => 's',
'q' => '' 'q' => '',
], ],
'q'=> 'dd' 'q' => 'dd',
]; ];
return View::make('ManageOrganiser.Dashboard', $data); return View::make('ManageOrganiser.Dashboard', $data);
} }
}
}

View File

@ -1,15 +1,16 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use App\Models\Event;
use App\Models\Organiser;
use Input; use Input;
use View; use View;
use App\Models\Organiser;
use App\Models\Event;
class OrganiserEventsController extends MyBaseController class OrganiserEventsController extends MyBaseController
{ {
public function showEvents($organiser_id)
public function showEvents($organiser_id) { {
$organiser = Organiser::scope()->findOrfail($organiser_id); $organiser = Organiser::scope()->findOrfail($organiser_id);
$allowed_sorts = ['created_at', 'start_date', 'end_date', 'title']; $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'); $sort_by = (in_array(Input::get('sort_by'), $allowed_sorts) ? Input::get('sort_by') : 'start_date');
$events = $searchQuery $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); : Event::scope()->where('organiser_id', '=', $organiser_id)->orderBy($sort_by, 'desc')->paginate(12);
$data = [ $data = [
'events' => $events, 'events' => $events,
'organiser' => $organiser, 'organiser' => $organiser,
'search' => [ 'search' => [
'q' => $searchQuery ? $searchQuery : '', 'q' => $searchQuery ? $searchQuery : '',
'sort_by' => Input::get('sort_by') ? Input::get('sort_by') : '', 'sort_by' => Input::get('sort_by') ? Input::get('sort_by') : '',
'showPast' => Input::get('past') 'showPast' => Input::get('past'),
] ],
]; ];
return View::make('ManageOrganiser.Events', $data); return View::make('ManageOrganiser.Events', $data);
} }
}
}

View File

@ -1,27 +1,27 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use View;
use App\Http\Controllers\Controller;
use App\Models\Organiser; use App\Models\Organiser;
use View;
class OrganiserViewController extends Controller
class OrganiserViewController extends Controller { {
public function showOrganiserHome($organiser_id, $slug = '', $preview = false)
public function showOrganiserHome($organiser_id, $slug='', $preview = FALSE) { {
$organiser = Organiser::findOrFail($organiser_id); $organiser = Organiser::findOrFail($organiser_id);
$data = [ $data = [
'organiser' => $organiser, 'organiser' => $organiser,
'tickets' => $organiser->events()->orderBy('created_at', 'desc')->get(), 'tickets' => $organiser->events()->orderBy('created_at', 'desc')->get(),
'is_embedded' => 0 'is_embedded' => 0,
]; ];
return View::make('Public.ViewOrganiser.OrganiserPage', $data); return View::make('Public.ViewOrganiser.OrganiserPage', $data);
} }
public function showEventHomePreview($event_id) { public function showEventHomePreview($event_id)
return showEventHome($event_id, TRUE); {
return showEventHome($event_id, true);
} }
} }

View File

@ -2,14 +2,12 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker; use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Http\Request;
class RemindersController extends Controller {
class RemindersController extends Controller
{
/** /**
* The Guard implementation. * The Guard implementation.
* *
@ -24,7 +22,8 @@ class RemindersController extends Controller {
*/ */
protected $passwords; protected $passwords;
public function __construct(Guard $auth, PasswordBroker $passwords) { public function __construct(Guard $auth, PasswordBroker $passwords)
{
$this->auth = $auth; $this->auth = $auth;
$this->passwords = $passwords; $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. * Get the e-mail subject line to be used for the reset link email.
* *
* @return string * @return string
*/ */
protected function getEmailSubject() protected function getEmailSubject()
{ {
return isset($this->subject) ? $this->subject : 'Your Password Reset Link'; return isset($this->subject) ? $this->subject : 'Your Password Reset Link';
} }
/** /**
* Display the password reminder view. * Display the password reminder view.
* *
* @return Response * @return Response
*/ */
public function getRemind() { public function getRemind()
{
return \View::make('Public.LoginAndRegister.ForgotPassword'); return \View::make('Public.LoginAndRegister.ForgotPassword');
} }
@ -55,11 +55,11 @@ class RemindersController extends Controller {
* *
* @return Response * @return Response
*/ */
public function postRemind(Request $request) { public function postRemind(Request $request)
{
$this->validate($request, ['email' => 'required']); $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()); $m->subject($this->getEmailSubject());
}); });
@ -75,12 +75,15 @@ class RemindersController extends Controller {
/** /**
* Display the password reset view for the given token. * Display the password reset view for the given token.
* *
* @param string $token * @param string $token
*
* @return Response * @return Response
*/ */
public function getReset($token = null) { public function getReset($token = null)
if (is_null($token)) {
if (is_null($token)) {
\App::abort(404); \App::abort(404);
}
return \View::make('Public.LoginAndRegister.ResetPassword')->with('token', $token); return \View::make('Public.LoginAndRegister.ResetPassword')->with('token', $token);
} }
@ -90,10 +93,11 @@ class RemindersController extends Controller {
* *
* @return Response * @return Response
*/ */
public function postReset(Request $request) { public function postReset(Request $request)
{
$this->validate($request, [ $this->validate($request, [
'token' => 'required', 'token' => 'required',
'email' => 'required', 'email' => 'required',
'password' => 'required|confirmed', 'password' => 'required|confirmed',
]); ]);
@ -101,7 +105,7 @@ class RemindersController extends Controller {
'email', 'password', 'password_confirmation', 'token' '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->password = bcrypt($password);
$user->save(); $user->save();
@ -112,6 +116,7 @@ class RemindersController extends Controller {
switch ($response) { switch ($response) {
case PasswordBroker::PASSWORD_RESET: case PasswordBroker::PASSWORD_RESET:
\Session::flash('message', 'Password Successfully Reset'); \Session::flash('message', 'Password Successfully Reset');
return redirect(route('login')); return redirect(route('login'));
default: default:
@ -120,5 +125,4 @@ class RemindersController extends Controller {
->withErrors(['email' => trans($response)]); ->withErrors(['email' => trans($response)]);
} }
} }
} }

View File

@ -2,49 +2,47 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input,
Response,
Auth,
Validator;
use App\Http\Controllers\Controller;
use App\Models\User; use App\Models\User;
use Auth;
use Input;
use Response;
class UserController extends Controller { class UserController extends Controller
{
public function showEditUser() { public function showEditUser()
{
$data = [ $data = [
'user' => \Auth::user(), 'user' => \Auth::user(),
'modal_id' => \Input::get('modal_id') 'modal_id' => \Input::get('modal_id'),
]; ];
return \View::make('ManageUser.Modals.EditUser', $data); return \View::make('ManageUser.Modals.EditUser', $data);
} }
public function postEditUser() { public function postEditUser()
{
$rules = array( $rules = [
'email' => ['required', 'email', 'exists:users,email,account_id,' . Auth::user()->account_id], 'email' => ['required', 'email', 'exists:users,email,account_id,'.Auth::user()->account_id],
'new_password' => ['min:5', 'confirmed', 'required_with:password'], 'new_password' => ['min:5', 'confirmed', 'required_with:password'],
'password' => 'passcheck', 'password' => 'passcheck',
'first_name' => ['required'], 'first_name' => ['required'],
'last_name' => ['required'] 'last_name' => ['required'],
); ];
$messages = [ $messages = [
'email.email' => 'Please enter a valid E-mail address.', 'email.email' => 'Please enter a valid E-mail address.',
'email.required' => 'E-mail address is required.', 'email.required' => 'E-mail address is required.',
'password.passcheck' => 'This password is incorrect.', 'password.passcheck' => 'This password is incorrect.',
'email.exists' => 'This E-mail has is already in use.', 'email.exists' => 'This E-mail has is already in use.',
'first_name.required' => 'Please enter your first name.' 'first_name.required' => 'Please enter your first name.',
]; ];
$validation = \Validator::make(Input::all(), $rules, $messages); $validation = \Validator::make(Input::all(), $rules, $messages);
if ($validation->fails()) { if ($validation->fails()) {
return Response::json([ return Response::json([
'status' => 'error', 'status' => 'error',
'messages' => $validation->messages()->toArray() 'messages' => $validation->messages()->toArray(),
]); ]);
} }
@ -57,15 +55,12 @@ class UserController extends Controller {
$user->first_name = Input::get('first_name'); $user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name'); $user->last_name = Input::get('last_name');
//$user->email = Input::get('email'); //$user->email = Input::get('email');
$user->save(); $user->save();
return Response::json([ return Response::json([
'status' => 'success', 'status' => 'success',
'message' => 'Successfully Edited User' 'message' => 'Successfully Edited User',
]); ]);
} }
} }

View File

@ -2,57 +2,55 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller; use Auth;
use Request, use Illuminate\Contracts\Auth\Guard;
View, use Input;
Auth, use Redirect;
Input, use Request;
Redirect; use View;
use \Illuminate\Contracts\Auth\Guard;
class UserLoginController extends Controller {
class UserLoginController extends Controller
{
protected $auth; protected $auth;
public function __construct(Guard $auth) { public function __construct(Guard $auth)
{
$this->auth = $auth; $this->auth = $auth;
$this->middleware('guest'); $this->middleware('guest');
} }
public function showLogin() { public function showLogin()
{
/* /*
* If there's an ajax request to the login page assume the person has been * If there's an ajax request to the login page assume the person has been
* logged out and redirect them to the login page * logged out and redirect them to the login page
*/ */
if (Request::ajax()) { if (Request::ajax()) {
return Response::json(array( return Response::json([
'status' => 'success', 'status' => 'success',
'redirectUrl' => route('login') 'redirectUrl' => route('login'),
)); ]);
} }
return View::make('Public.LoginAndRegister.Login'); return View::make('Public.LoginAndRegister.Login');
} }
/** /**
* Handle the login * Handle the login.
* *
* @return void * @return void
*/ */
public function postLogin() { public function postLogin()
{
$email = Input::get('email'); $email = Input::get('email');
$password = Input::get('password'); $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(route('showSelectOrganiser'));
} }
return Redirect::to('login?failed=yup')->with('message', 'Your username/password combination was incorrect') return Redirect::to('login?failed=yup')->with('message', 'Your username/password combination was incorrect')
->withInput(); ->withInput();
} }
} }

View File

@ -2,21 +2,22 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Routing\Controller;
class UserLogoutController extends Controller { class UserLogoutController extends Controller
{
protected $auth; protected $auth;
public function __construct(Guard $auth) { public function __construct(Guard $auth)
{
$this->auth = $auth; $this->auth = $auth;
} }
public function doLogout()
public function doLogout() { {
$this->auth->logout(); $this->auth->logout();
return \Redirect::to('/?logged_out=yup'); return \Redirect::to('/?logged_out=yup');
} }
}
}

View File

@ -1,106 +1,106 @@
<?php namespace App\Http\Controllers; <?php
namespace App\Http\Controllers;
use Mail;
use Session;
use Validator;
use Redirect;
use Hash;
use Auth;
use Input;
use View;
use App\Attendize\Utils; use App\Attendize\Utils;
use Illuminate\Contracts\Auth\Guard;
use App\Models\Account; use App\Models\Account;
use App\Models\User; use App\Models\User;
use Auth;
use Hash;
use Illuminate\Contracts\Auth\Guard;
use Input;
use Mail;
use Redirect;
use Session;
use Validator;
use View;
class UserSignupController extends Controller { class UserSignupController extends Controller
{
protected $auth; protected $auth;
public function __construct(Guard $auth) {
if(Account::count() > 0 && !Utils::isAttendize()) { public function __construct(Guard $auth)
{
if (Account::count() > 0 && !Utils::isAttendize()) {
return Redirect::route('login'); return Redirect::route('login');
} }
$this->auth = $auth; $this->auth = $auth;
$this->middleware('guest'); $this->middleware('guest');
} }
public function showSignup() {
public function showSignup()
{
return View::make('Public.LoginAndRegister.Signup'); return View::make('Public.LoginAndRegister.Signup');
} }
/** /**
* Creates an account * Creates an account.
* *
* @return void * @return void
*/ */
public function postSignup() { public function postSignup()
$rules = array( {
'email' => array('required', 'email', 'unique:users'), $rules = [
'password' => array('required', 'min:5', 'confirmed'), 'email' => ['required', 'email', 'unique:users'],
'first_name' => array('required'), 'password' => ['required', 'min:5', 'confirmed'],
'terms_agreed' => Utils::isAttendize() ? array('required') : '' 'first_name' => ['required'],
); 'terms_agreed' => Utils::isAttendize() ? ['required'] : '',
];
$messages = array( $messages = [
'email.email' => 'Please enter a valid E-mail address.', 'email.email' => 'Please enter a valid E-mail address.',
'email.required' => 'E-mail address is required.', 'email.required' => 'E-mail address is required.',
'password.required' => 'Password is required.', 'password.required' => 'Password is required.',
'password.min' => 'Your password is too short! Min 5 symbols.', 'password.min' => 'Your password is too short! Min 5 symbols.',
'email.unique' => 'This E-mail has already been taken.', 'email.unique' => 'This E-mail has already been taken.',
'first_name.required' => 'Please enter your first name.', 'first_name.required' => 'Please enter your first name.',
'terms_agreed.required' => 'Please agree to our Terms of Service.' '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()) { if ($validation->fails()) {
return Redirect::to('signup')->withInput()->withErrors($validation); return Redirect::to('signup')->withInput()->withErrors($validation);
} }
$account = new Account; $account = new Account();
$account->email = Input::get('email'); $account->email = Input::get('email');
$account->first_name = Input::get('first_name'); $account->first_name = Input::get('first_name');
$account->last_name = Input::get('last_name'); $account->last_name = Input::get('last_name');
$account->currency_id = config('attendize.default_currency'); $account->currency_id = config('attendize.default_currency');
$account->timezone_id = config('attendize.default_timezone'); $account->timezone_id = config('attendize.default_timezone');
$account->save(); $account->save();
$user = new User; $user = new User();
$user->email = Input::get('email'); $user->email = Input::get('email');
$user->first_name = Input::get('first_name'); $user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name'); $user->last_name = Input::get('last_name');
$user->password = Hash::make(Input::get('password')); $user->password = Hash::make(Input::get('password'));
$user->account_id = $account->id; $user->account_id = $account->id;
$user->is_parent = 1; $user->is_parent = 1;
$user->is_registered = 1; $user->is_registered = 1;
$user->save(); $user->save();
if (Utils::isAttendize()) {
if(Utils::isAttendize()) { Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function ($message) {
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')) $message->to(Input::get('email'), Input::get('first_name'))
->subject('Thank you for registering for Attendize'); ->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(); $user = User::whereConfirmationCode($confirmation_code)->first();
if ( ! $user) if (!$user) {
{
return \View::make('Public.Errors.Generic', [ 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->confirmation_code = null;
$user->save(); $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); //$this->auth->login($user);
return Redirect::route('login'); return Redirect::route('login');
} }
private function validateEmail($data) private function validateEmail($data)
{ {
$rules = [ $rules = [
'email' => 'required|email|unique:users' 'email' => 'required|email|unique:users',
]; ];
return Validator::make($data, $rules); return Validator::make($data, $rules);
} }
} }

View File

@ -1,35 +1,36 @@
<?php namespace App\Http; <?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel; use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel { class Kernel extends HttpKernel
{
/** /**
* The application's global HTTP middleware stack. * The application's global HTTP middleware stack.
* *
* @var array * @var array
*/ */
protected $middleware = [ protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode', 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession', 'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession', 'Illuminate\View\Middleware\ShareErrorsFromSession',
'App\Http\Middleware\VerifyCsrfToken', 'App\Http\Middleware\VerifyCsrfToken',
'App\Http\Middleware\GeneralChecks' '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'
];
/**
* 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',
];
} }

View File

@ -1,50 +1,49 @@
<?php namespace App\Http\Middleware; <?php
namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class Authenticate { class Authenticate
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/** /**
* The Guard implementation. * Create a new filter instance.
* *
* @var Guard * @param Guard $auth
*/ *
protected $auth; * @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/** /**
* Create a new filter instance. * Handle an incoming request.
* *
* @param Guard $auth * @param \Illuminate\Http\Request $request
* @return void * @param \Closure $next
*/ *
public function __construct(Guard $auth) * @return mixed
{ */
$this->auth = $auth; public function handle($request, Closure $next)
} {
if ($this->auth->guest()) {
/** if ($request->ajax()) {
* Handle an incoming request. return response('Unauthorized.', 401);
* } else {
* @param \Illuminate\Http\Request $request return redirect()->guest('login');
* @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);
}
return $next($request);
}
} }

View File

@ -1,23 +1,25 @@
<?php namespace app\Http\Middleware; <?php
namespace app\Http\Middleware;
use App\Attendize\Utils;
use Closure; use Closure;
use Redirect; use Redirect;
use Request; use Request;
use App\Models\OrderStatus;
use App\Attendize\Utils;
class CheckInstalled class CheckInstalled
{ {
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if(!file_exists(base_path('installed')) && !Utils::isAttendize()) { if (!file_exists(base_path('installed')) && !Utils::isAttendize()) {
return Redirect::to('install'); return Redirect::to('install');
} }
@ -25,4 +27,4 @@ class CheckInstalled
return $response; return $response;
} }
} }

View File

@ -1,24 +1,20 @@
<?php namespace app\Http\Middleware; <?php
namespace app\Http\Middleware;
use Request;
use Closure;
use Utils;
use App;
use Auth;
use Input;
use Redirect;
use Cache;
use Session;
use File;
use App\Models\Organiser; use App\Models\Organiser;
use Closure;
use Redirect;
use Request;
class FirstRunMiddleware class FirstRunMiddleware
{ {
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
@ -30,11 +26,11 @@ class FirstRunMiddleware
*/ */
if (Organiser::scope()->count() === 0 && !($request->route()->getName() == 'showCreateOrganiser') && !($request->route()->getName() == 'postCreateOrganiser')) { if (Organiser::scope()->count() === 0 && !($request->route()->getName() == 'showCreateOrganiser') && !($request->route()->getName() == 'postCreateOrganiser')) {
return redirect(route('showCreateOrganiser', [ return redirect(route('showCreateOrganiser', [
'first_run' => '1' 'first_run' => '1',
])); ]));
} elseif (Organiser::scope()->count() === 1 && ($request->route()->getName() == 'showSelectOrganiser')) { } elseif (Organiser::scope()->count() === 1 && ($request->route()->getName() == 'showSelectOrganiser')) {
return redirect(route('showOrganiserDashboard', [ return redirect(route('showOrganiserDashboard', [
'organiser_id' => Organiser::scope()->first()->id 'organiser_id' => Organiser::scope()->first()->id,
])); ]));
} }
@ -42,4 +38,4 @@ class FirstRunMiddleware
return $response; return $response;
} }
} }

View File

@ -1,15 +1,17 @@
<?php namespace app\Http\Middleware; <?php
namespace app\Http\Middleware;
use Closure; use Closure;
use App;
class GeneralChecks class GeneralChecks
{ {
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
*
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
@ -17,11 +19,11 @@ class GeneralChecks
// Show message to IE 8 and before users // Show message to IE 8 and before users
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) { if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) {
Session::flash('message', "Please update your browser. This application requires a modern browser."); Session::flash('message', 'Please update your browser. This application requires a modern browser.');
} }
$response = $next($request); $response = $next($request);
return $response; return $response;
} }
} }

View File

@ -1,44 +1,46 @@
<?php namespace App\Http\Middleware; <?php
namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
class RedirectIfAuthenticated { class RedirectIfAuthenticated
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/** /**
* The Guard implementation. * Create a new filter instance.
* *
* @var Guard * @param Guard $auth
*/ *
protected $auth; * @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/** /**
* Create a new filter instance. * Handle an incoming request.
* *
* @param Guard $auth * @param \Illuminate\Http\Request $request
* @return void * @param \Closure $next
*/ *
public function __construct(Guard $auth) * @return mixed
{ */
$this->auth = $auth; public function handle($request, Closure $next)
} {
if ($this->auth->check()) {
/** return new RedirectResponse(route('showSelectOrganiser'));
* 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);
}
return $next($request);
}
} }

View File

@ -1,25 +1,26 @@
<?php namespace App\Http\Middleware; <?php
namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier { class VerifyCsrfToken extends BaseVerifier
{
protected $except = [
protected $except = [ 'install/*',
'install/*', ];
];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return parent::handle($request, $next);
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
return parent::handle($request, $next);
}
} }

View File

@ -1,9 +1,10 @@
<?php namespace App\Http\Requests; <?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest { abstract class Request extends FormRequest
{
// //
} }

View File

@ -15,41 +15,38 @@
* Installer * Installer
*/ */
Route::get('install', [ Route::get('install', [
'as' => 'showInstaller', 'as' => 'showInstaller',
'uses' => 'InstallerController@showInstaller' 'uses' => 'InstallerController@showInstaller',
]); ]);
Route::post('install', [ Route::post('install', [
'as' => 'postInstaller', 'as' => 'postInstaller',
'uses' => 'InstallerController@postInstaller' 'uses' => 'InstallerController@postInstaller',
]); ]);
/* /*
* Stripe connect return * Stripe connect return
*/ */
Route::any('payment/return/stripe', [ Route::any('payment/return/stripe', [
'as' => 'showStripeReturn', 'as' => 'showStripeReturn',
'uses' => 'ManageAccountController@showStripeReturn' 'uses' => 'ManageAccountController@showStripeReturn',
]); ]);
/* /*
* Logout * Logout
*/ */
Route::any('/logout', [ Route::any('/logout', [
'uses' => 'UserLogoutController@doLogout', 'uses' => 'UserLogoutController@doLogout',
'as' => 'logout' 'as' => 'logout',
]); ]);
Route::group(['middleware' => ['installed']], function () {
Route::group(array('middleware' => ['installed']), function() {
/* /*
* Login * Login
*/ */
Route::get('/login', [ Route::get('/login', [
'as' => 'login', 'as' => 'login',
'uses' => 'UserLoginController@showLogin' 'uses' => 'UserLoginController@showLogin',
]); ]);
Route::post('/login', 'UserLoginController@postLogin'); Route::post('/login', 'UserLoginController@postLogin');
@ -57,36 +54,34 @@ Route::group(array('middleware' => ['installed']), function() {
* Forgot password * Forgot password
*/ */
Route::get('login/forgot-password', [ Route::get('login/forgot-password', [
'as' => 'forgotPassword', 'as' => 'forgotPassword',
'uses' => 'RemindersController@getRemind' 'uses' => 'RemindersController@getRemind',
]); ]);
Route::post('login/forgot-password', [ Route::post('login/forgot-password', [
'as' => 'postForgotPassword', 'as' => 'postForgotPassword',
'uses' => 'RemindersController@postRemind' 'uses' => 'RemindersController@postRemind',
]); ]);
/* /*
* Reset Password * Reset Password
*/ */
Route::get('login/reset-password/{token}', [ Route::get('login/reset-password/{token}', [
'as' => 'showResetPassword', 'as' => 'showResetPassword',
'uses' => 'RemindersController@getReset' 'uses' => 'RemindersController@getReset',
]); ]);
Route::post('login/reset-password', [ Route::post('login/reset-password', [
'as' => 'postResetPassword', 'as' => 'postResetPassword',
'uses' => 'RemindersController@postReset' 'uses' => 'RemindersController@postReset',
]); ]);
/* /*
* Registration / Account creation * Registration / Account creation
*/ */
Route::get('/signup', [ Route::get('/signup', [
'uses' => 'UserSignupController@showSignup', 'uses' => 'UserSignupController@showSignup',
'as' => 'showSignup' 'as' => 'showSignup',
]); ]);
Route::post('/signup', 'UserSignupController@postSignup'); Route::post('/signup', 'UserSignupController@postSignup');
@ -94,155 +89,147 @@ Route::group(array('middleware' => ['installed']), function() {
* Confirm Email * Confirm Email
*/ */
Route::get('signup/confirm_email/{confirmation_code}', [ Route::get('signup/confirm_email/{confirmation_code}', [
'as' => 'confirmEmail', 'as' => 'confirmEmail',
'uses' => 'UserSignupController@confirmEmail' 'uses' => 'UserSignupController@confirmEmail',
]); ]);
}); });
/* /*
* Public organiser page routes * Public organiser page routes
*/ */
Route::group(['prefix' => 'o'], function() { Route::group(['prefix' => 'o'], function () {
Route::get('/{organiser_id}/{organier_slug?}', [
'as' => 'showOrganiserHome',
'uses' => 'OrganiserViewController@showOrganiserHome'
]);
});
Route::get('/{organiser_id}/{organier_slug?}', [
'as' => 'showOrganiserHome',
'uses' => 'OrganiserViewController@showOrganiserHome',
]);
});
/* /*
* Public event page routes * Public event page routes
*/ */
Route::group(array('prefix' => 'e'), function() { Route::group(['prefix' => 'e'], function () {
/* /*
* Embedded events * Embedded events
*/ */
Route::get('/{event_id}/embed', [ Route::get('/{event_id}/embed', [
'as' => 'showEmbeddedEventPage', 'as' => 'showEmbeddedEventPage',
'uses' => 'EventViewEmbeddedController@showEmbeddedEvent' 'uses' => 'EventViewEmbeddedController@showEmbeddedEvent',
]); ]);
Route::get('/{event_id}/{event_slug?}', [ Route::get('/{event_id}/{event_slug?}', [
'as' => 'showEventPage', 'as' => 'showEventPage',
'uses' => 'EventViewController@showEventHome' 'uses' => 'EventViewController@showEventHome',
]); ]);
Route::post('/{event_id}/contact_organiser', [ Route::post('/{event_id}/contact_organiser', [
'as' => 'postContactOrganiser', 'as' => 'postContactOrganiser',
'uses' => 'EventViewController@postContactOrganiser' 'uses' => 'EventViewController@postContactOrganiser',
]); ]);
/* /*
* Used for previewing designs in the backend. Doesn't log page views etc. * Used for previewing designs in the backend. Doesn't log page views etc.
*/ */
Route::get('/{event_id}/preview', [ Route::get('/{event_id}/preview', [
'as' => 'showEventPagePreview', 'as' => 'showEventPagePreview',
'uses' => 'EventViewController@showEventHomePreview' 'uses' => 'EventViewController@showEventHomePreview',
]); ]);
Route::post('{event_id}/checkout/', [ Route::post('{event_id}/checkout/', [
'as' => 'postValidateTickets', 'as' => 'postValidateTickets',
'uses' => 'EventCheckoutController@postValidateTickets' 'uses' => 'EventCheckoutController@postValidateTickets',
]); ]);
Route::get('{event_id}/checkout/create', [ Route::get('{event_id}/checkout/create', [
'as' => 'showEventCheckout', 'as' => 'showEventCheckout',
'uses' => 'EventCheckoutController@showEventCheckout' 'uses' => 'EventCheckoutController@showEventCheckout',
]); ]);
Route::post('{event_id}/checkout/create', [ Route::post('{event_id}/checkout/create', [
'as' => 'postCreateOrder', 'as' => 'postCreateOrder',
'uses' => 'EventCheckoutController@postCreateOrder' 'uses' => 'EventCheckoutController@postCreateOrder',
]); ]);
}); });
/* /*
* View order * View order
*/ */
Route::get('order/{order_reference}', [ Route::get('order/{order_reference}', [
'as' => 'showOrderDetails', 'as' => 'showOrderDetails',
'uses' => 'EventCheckoutController@showOrderDetails' 'uses' => 'EventCheckoutController@showOrderDetails',
]); ]);
Route::get('order/{order_reference}/tickets', [ Route::get('order/{order_reference}/tickets', [
'as' => 'showOrderTickets', 'as' => 'showOrderTickets',
'uses' => 'EventCheckoutController@showOrderTickets' 'uses' => 'EventCheckoutController@showOrderTickets',
]); ]);
/* /*
* Begin logged in stuff * Begin logged in stuff
*/ */
Route::group(array('middleware' => ['auth', 'first.run']), function() { Route::group(['middleware' => ['auth', 'first.run']], function () {
/* /*
* Edit User * Edit User
*/ */
Route::group(['prefix' => 'user'], function() { Route::group(['prefix' => 'user'], function () {
Route::get('/', [ Route::get('/', [
'as' => 'showEditUser', 'as' => 'showEditUser',
'uses' => 'UserController@showEditUser' 'uses' => 'UserController@showEditUser',
]); ]);
Route::post('/', [ Route::post('/', [
'as' => 'postEditUser', 'as' => 'postEditUser',
'uses' => 'UserController@postEditUser' 'uses' => 'UserController@postEditUser',
]); ]);
}); });
/* /*
* Manage account * Manage account
*/ */
Route::group(array('prefix' => 'account'), function() { Route::group(['prefix' => 'account'], function () {
Route::get('/', [ Route::get('/', [
'as' => 'showEditAccount', 'as' => 'showEditAccount',
'uses' => 'ManageAccountController@showEditAccount' 'uses' => 'ManageAccountController@showEditAccount',
]); ]);
Route::post('/', [ Route::post('/', [
'as' => 'postEditAccount', 'as' => 'postEditAccount',
'uses' => 'ManageAccountController@postEditAccount' 'uses' => 'ManageAccountController@postEditAccount',
]); ]);
Route::post('/edit_payment', [ Route::post('/edit_payment', [
'as' => 'postEditAccountPayment', 'as' => 'postEditAccountPayment',
'uses' => 'ManageAccountController@postEditAccountPayment' 'uses' => 'ManageAccountController@postEditAccountPayment',
]); ]);
Route::post('invite_user', [ Route::post('invite_user', [
'as' => 'postInviteUser', 'as' => 'postInviteUser',
'uses' => 'ManageAccountController@postInviteUser' 'uses' => 'ManageAccountController@postInviteUser',
]); ]);
}); });
Route::get('select_organiser', [ Route::get('select_organiser', [
'as' => 'showSelectOrganiser', 'as' => 'showSelectOrganiser',
'uses' => 'OrganiserController@showSelectOragniser' 'uses' => 'OrganiserController@showSelectOragniser',
]); ]);
/* /*
* New organiser dashboard * New organiser dashboard
*/ */
Route::group(array('prefix' => 'organiser'), function() { Route::group(['prefix' => 'organiser'], function () {
/* /*
* ----------- * -----------
* Organiser Dashboard * Organiser Dashboard
* ----------- * -----------
*/ */
Route::get('{organiser_id}/dashboard', [ Route::get('{organiser_id}/dashboard', [
'as' => 'showOrganiserDashboard', 'as' => 'showOrganiserDashboard',
'uses' => 'OrganiserDashboardController@showDashboard' 'uses' => 'OrganiserDashboardController@showDashboard',
]); ]);
/* /*
@ -251,8 +238,8 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() {
* ----------- * -----------
*/ */
Route::get('{organiser_id}/events', [ Route::get('{organiser_id}/events', [
'as' => 'showOrganiserEvents', 'as' => 'showOrganiserEvents',
'uses' => 'OrganiserEventsController@showEvents' 'uses' => 'OrganiserEventsController@showEvents',
]); ]);
/* /*
* ----------- * -----------
@ -260,17 +247,15 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() {
* ----------- * -----------
*/ */
Route::get('{organiser_id}/customize', [ Route::get('{organiser_id}/customize', [
'as' => 'showOrganiserCustomize', 'as' => 'showOrganiserCustomize',
'uses' => 'OrganiserCustomizeController@showCustomize' 'uses' => 'OrganiserCustomizeController@showCustomize',
]); ]);
}); });
/* /*
* Events dashboard * 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', [ Route::get('/organiser/create', [
'as' => 'showCreateOrganiser', 'as' => 'showCreateOrganiser',
'uses' => 'OrganiserController@showCreateOrganiser' 'uses' => 'OrganiserController@showCreateOrganiser',
]); ]);
Route::post('/organiser/create', [ Route::post('/organiser/create', [
'as' => 'postCreateOrganiser', 'as' => 'postCreateOrganiser',
'uses' => 'OrganiserController@postCreateOrganiser' 'uses' => 'OrganiserController@postCreateOrganiser',
]); ]);
Route::get('/organiser/{organiser_id}', [ Route::get('/organiser/{organiser_id}', [
'as' => 'showOrganiserEventsDashboard', 'as' => 'showOrganiserEventsDashboard',
'uses' => 'OrganiserController@showOrganiserDashboard' 'uses' => 'OrganiserController@showOrganiserDashboard',
]); ]);
Route::get('/organiser/{organiser_id?}', [ Route::get('/organiser/{organiser_id?}', [
'as' => 'showSearchEventsDashboard', 'as' => 'showSearchEventsDashboard',
'uses' => 'OrganiserController@showOrganiserDashboard' 'uses' => 'OrganiserController@showOrganiserDashboard',
]); ]);
Route::get('/organiser/{organiser_id}/edit', [ Route::get('/organiser/{organiser_id}/edit', [
'as' => 'showEditOrganiser', 'as' => 'showEditOrganiser',
'uses' => 'OrganiserController@showEditOrganiser' 'uses' => 'OrganiserController@showEditOrganiser',
]); ]);
Route::post('/organiser/{organiser_id}/edit', [ Route::post('/organiser/{organiser_id}/edit', [
'as' => 'postEditOrganiser', 'as' => 'postEditOrganiser',
'uses' => 'OrganiserCustomizeController@postEditOrganiser' 'uses' => 'OrganiserCustomizeController@postEditOrganiser',
]); ]);
/* /*
* ---------- * ----------
* Create Event * Create Event
* ---------- * ----------
*/ */
Route::get('/create', [ Route::get('/create', [
'as' => 'showCreateEvent', 'as' => 'showCreateEvent',
'uses' => 'EventController@showCreateEvent' 'uses' => 'EventController@showCreateEvent',
]); ]);
Route::post('/create', [ Route::post('/create', [
'as' => 'postCreateEvent', 'as' => 'postCreateEvent',
'uses' => 'EventController@postCreateEvent' 'uses' => 'EventController@postCreateEvent',
]); ]);
}); });
/* /*
* Upoad event images * Upoad event images
*/ */
Route::post('/upload_image', [ Route::post('/upload_image', [
'as' => 'postUploadEventImage', 'as' => 'postUploadEventImage',
'uses' => 'EventController@postUploadEventImage' 'uses' => 'EventController@postUploadEventImage',
]); ]);
/* /*
* Event Management Stuff * Event Management Stuff
*/ */
Route::group(array('prefix' => 'event'), function() { Route::group(['prefix' => 'event'], function () {
/* /*
* ------- * -------
* Dashboard * Dashboard
* ------- * -------
*/ */
Route::get('{event_id}/dashboard/', array( Route::get('{event_id}/dashboard/', [
'as' => 'showEventDashboard', 'as' => 'showEventDashboard',
'uses' => 'EventDashboardController@showDashboard') 'uses' => 'EventDashboardController@showDashboard', ]
); );
Route::get('{event_id}', function($event_id) { Route::get('{event_id}', function ($event_id) {
return Redirect::route('showEventDashboard', [ return Redirect::route('showEventDashboard', [
'event_id' => $event_id 'event_id' => $event_id,
]); ]);
}); });
/** /*
* @todo Move to a controller * @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 = \App\Models\Event::scope()->findOrFail($event_id);
$event->is_live = 1; $event->is_live = 1;
$event->save(); $event->save();
\Session::flash('message', 'Event Successfully Made Live! You can undo this action in event settings page.'); \Session::flash('message', 'Event Successfully Made Live! You can undo this action in event settings page.');
return Redirect::route('showEventDashboard', [ 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 * Tickets
* ------- * -------
*/ */
Route::get('{event_id}/tickets/', array( Route::get('{event_id}/tickets/', [
'as' => 'showEventTickets', 'as' => 'showEventTickets',
'uses' => 'EventTicketsController@showTickets' 'uses' => 'EventTicketsController@showTickets',
)); ]);
Route::get('{event_id}/tickets/edit/{ticket_id}', array( Route::get('{event_id}/tickets/edit/{ticket_id}', [
'as' => 'showEditTicket', 'as' => 'showEditTicket',
'uses' => 'EventTicketsController@showEditTicket' 'uses' => 'EventTicketsController@showEditTicket',
)); ]);
Route::post('{event_id}/tickets/edit/{ticket_id}', array( Route::post('{event_id}/tickets/edit/{ticket_id}', [
'as' => 'postEditTicket', 'as' => 'postEditTicket',
'uses' => 'EventTicketsController@postEditTicket' 'uses' => 'EventTicketsController@postEditTicket',
)); ]);
Route::get('{event_id}/tickets/create', array( Route::get('{event_id}/tickets/create', [
'as' => 'showCreateTicket', 'as' => 'showCreateTicket',
'uses' => 'EventTicketsController@showCreateTicket' 'uses' => 'EventTicketsController@showCreateTicket',
)); ]);
Route::post('{event_id}/tickets/create', array( Route::post('{event_id}/tickets/create', [
'as' => 'postCreateTicket', 'as' => 'postCreateTicket',
'uses' => 'EventTicketsController@postCreateTicket' 'uses' => 'EventTicketsController@postCreateTicket',
)); ]);
Route::post('{event_id}/tickets/delete', array( Route::post('{event_id}/tickets/delete', [
'as' => 'postDeleteTicket', 'as' => 'postDeleteTicket',
'uses' => 'EventTicketsController@postDeleteTicket' 'uses' => 'EventTicketsController@postDeleteTicket',
)); ]);
Route::post('{event_id}/tickets/pause', array( Route::post('{event_id}/tickets/pause', [
'as' => 'postPauseTicket', 'as' => 'postPauseTicket',
'uses' => 'EventTicketsController@postPauseTicket' 'uses' => 'EventTicketsController@postPauseTicket',
)); ]);
/* /*
* Ticket questions * Ticket questions
*/ */
Route::get('{event_id}/tickets/questions', [ Route::get('{event_id}/tickets/questions', [
'as' => 'showTicketQuestions', 'as' => 'showTicketQuestions',
'uses' => 'EventTicketQuestionsController@showQuestions' 'uses' => 'EventTicketQuestionsController@showQuestions',
]); ]);
Route::post('{event_id}/tickets/questions/create', [ Route::post('{event_id}/tickets/questions/create', [
'as' => 'postCreateQuestion', 'as' => 'postCreateQuestion',
'uses' => 'EventTicketQuestionsController@postCreateQuestion' 'uses' => 'EventTicketQuestionsController@postCreateQuestion',
]); ]);
/* /*
* ------- * -------
* Attendees * Attendees
* ------- * -------
*/ */
Route::get('{event_id}/attendees/', array( Route::get('{event_id}/attendees/', [
'as' => 'showEventAttendees', 'as' => 'showEventAttendees',
'uses' => 'EventAttendeesController@showAttendees' 'uses' => 'EventAttendeesController@showAttendees',
)); ]);
Route::get('{event_id}/attendees/message', [ Route::get('{event_id}/attendees/message', [
'as' => 'showMessageAttendees', 'as' => 'showMessageAttendees',
'uses' => 'EventAttendeesController@showMessageAttendees' 'uses' => 'EventAttendeesController@showMessageAttendees',
]); ]);
Route::post('{event_id}/attendees/message', [ Route::post('{event_id}/attendees/message', [
'as' => 'postMessageAttendees', 'as' => 'postMessageAttendees',
'uses' => 'EventAttendeesController@postMessageAttendees' 'uses' => 'EventAttendeesController@postMessageAttendees',
]); ]);
Route::get('{event_id}/attendees/single_message', [ Route::get('{event_id}/attendees/single_message', [
'as' => 'showMessageAttendee', 'as' => 'showMessageAttendee',
'uses' => 'EventAttendeesController@showMessageAttendee' 'uses' => 'EventAttendeesController@showMessageAttendee',
]); ]);
Route::post('{event_id}/attendees/single_message', [ Route::post('{event_id}/attendees/single_message', [
'as' => 'postMessageAttendee', 'as' => 'postMessageAttendee',
'uses' => 'EventAttendeesController@postMessageAttendee' 'uses' => 'EventAttendeesController@postMessageAttendee',
]); ]);
Route::get('{event_id}/attendees/create', [ Route::get('{event_id}/attendees/create', [
'as' => 'showCreateAttendee', 'as' => 'showCreateAttendee',
'uses' => 'EventAttendeesController@showCreateAttendee' 'uses' => 'EventAttendeesController@showCreateAttendee',
]); ]);
Route::post('{event_id}/attendees/create', [ Route::post('{event_id}/attendees/create', [
'as' => 'postCreateAttendee', 'as' => 'postCreateAttendee',
'uses' => 'EventAttendeesController@postCreateAttendee' 'uses' => 'EventAttendeesController@postCreateAttendee',
]); ]);
Route::get('{event_id}/attendees/print', [ Route::get('{event_id}/attendees/print', [
'as' => 'showPrintAttendees', 'as' => 'showPrintAttendees',
'uses' => 'EventAttendeesController@showPrintAttendees' 'uses' => 'EventAttendeesController@showPrintAttendees',
]); ]);
Route::get('{event_id}/attendees/export/{export_as?}', [ Route::get('{event_id}/attendees/export/{export_as?}', [
'as' => 'showExportAttendees', 'as' => 'showExportAttendees',
'uses' => 'EventAttendeesController@showExportAttendees' 'uses' => 'EventAttendeesController@showExportAttendees',
]); ]);
Route::get('{event_id}/attendees/{attendee_id}/edit', [ Route::get('{event_id}/attendees/{attendee_id}/edit', [
'as' => 'showEditAttendee', 'as' => 'showEditAttendee',
'uses' => 'EventAttendeesController@showEditAttendee' 'uses' => 'EventAttendeesController@showEditAttendee',
]); ]);
Route::post('{event_id}/attendees/{attendee_id}/edit', [ Route::post('{event_id}/attendees/{attendee_id}/edit', [
'as' => 'postEditAttendee', 'as' => 'postEditAttendee',
'uses' => 'EventAttendeesController@postEditAttendee' 'uses' => 'EventAttendeesController@postEditAttendee',
]); ]);
Route::get('{event_id}/attendees/{attendee_id}/cancel', [ Route::get('{event_id}/attendees/{attendee_id}/cancel', [
'as' => 'showCancelAttendee', 'as' => 'showCancelAttendee',
'uses' => 'EventAttendeesController@showCancelAttendee' 'uses' => 'EventAttendeesController@showCancelAttendee',
]); ]);
Route::post('{event_id}/attendees/{attendee_id}/cancel', [ Route::post('{event_id}/attendees/{attendee_id}/cancel', [
'as' => 'postCancelAttendee', 'as' => 'postCancelAttendee',
'uses' => 'EventAttendeesController@postCancelAttendee' 'uses' => 'EventAttendeesController@postCancelAttendee',
]); ]);
/* /*
* ------- * -------
* Orders * Orders
* ------- * -------
*/ */
Route::get('{event_id}/orders/', array( Route::get('{event_id}/orders/', [
'as' => 'showEventOrders', 'as' => 'showEventOrders',
'uses' => 'EventOrdersController@showOrders' 'uses' => 'EventOrdersController@showOrders',
)); ]);
Route::get('order/{order_id}', array( Route::get('order/{order_id}', [
'as' => 'showManageOrder', 'as' => 'showManageOrder',
'uses' => 'EventOrdersController@manageOrder' 'uses' => 'EventOrdersController@manageOrder',
)); ]);
Route::get('order/{order_id}/cancel', array( Route::get('order/{order_id}/cancel', [
'as' => 'showCancelOrder', 'as' => 'showCancelOrder',
'uses' => 'EventOrdersController@showCancelOrder' 'uses' => 'EventOrdersController@showCancelOrder',
)); ]);
Route::post('order/{order_id}/cancel', array( Route::post('order/{order_id}/cancel', [
'as' => 'postCancelOrder', 'as' => 'postCancelOrder',
'uses' => 'EventOrdersController@postCancelOrder' 'uses' => 'EventOrdersController@postCancelOrder',
)); ]);
Route::get('{event_id}/orders/export/{export_as?}', [ Route::get('{event_id}/orders/export/{export_as?}', [
'as' => 'showExportOrders', 'as' => 'showExportOrders',
'uses' => 'EventOrdersController@showExportOrders' 'uses' => 'EventOrdersController@showExportOrders',
]); ]);
Route::get('{event_id}/orders/message', [ Route::get('{event_id}/orders/message', [
'as' => 'showMessageOrder', 'as' => 'showMessageOrder',
'uses' => 'EventOrdersController@showMessageOrder' 'uses' => 'EventOrdersController@showMessageOrder',
]); ]);
Route::post('{event_id}/orders/message', [ Route::post('{event_id}/orders/message', [
'as' => 'postMessageOrder', 'as' => 'postMessageOrder',
'uses' => 'EventOrdersController@postMessageOrder' 'uses' => 'EventOrdersController@postMessageOrder',
]); ]);
/* /*
@ -529,102 +504,88 @@ Route::group(array('middleware' => ['auth', 'first.run']), function() {
* Edit Event * Edit Event
* ------- * -------
*/ */
Route::post('{event_id}/customize', array( Route::post('{event_id}/customize', [
'as' => 'postEditEvent', 'as' => 'postEditEvent',
'uses' => 'EventController@postEditEvent' 'uses' => 'EventController@postEditEvent',
)); ]);
/* /*
* ------- * -------
* Customize Design etc. * Customize Design etc.
* ------- * -------
*/ */
Route::get('{event_id}/customize', array( Route::get('{event_id}/customize', [
'as' => 'showEventCustomize', 'as' => 'showEventCustomize',
'uses' => 'EventCustomizeController@showCustomize' '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/{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 * Check In App
* ------- * -------
*/ */
Route::get('{event_id}/check_in', array( Route::get('{event_id}/check_in', [
'as' => 'showChechIn', 'as' => 'showChechIn',
'uses' => 'EventCheckInController@showCheckIn' 'uses' => 'EventCheckInController@showCheckIn',
)); ]);
Route::post('{event_id}/check_in/search', array( Route::post('{event_id}/check_in/search', [
'as' => 'postCheckInSearch', 'as' => 'postCheckInSearch',
'uses' => 'EventCheckInController@postCheckInSearch' 'uses' => 'EventCheckInController@postCheckInSearch',
)); ]);
Route::post('{event_id}/check_in/', array( Route::post('{event_id}/check_in/', [
'as' => 'postCheckInAttendee', 'as' => 'postCheckInAttendee',
'uses' => 'EventCheckInController@postCheckInAttendee' 'uses' => 'EventCheckInController@postCheckInAttendee',
)); ]);
/* /*
* ------- * -------
* Promote * Promote
* ------- * -------
*/ */
Route::get('{event_id}/promote', array( Route::get('{event_id}/promote', [
'as' => 'showEventPromote', 'as' => 'showEventPromote',
'uses' => 'EventPromoteController@showPromote' 'uses' => 'EventPromoteController@showPromote',
)); ]);
}); });
}); });
Route::post('queue/push', function () {
Route::post('queue/push', function() {
// set_time_limit(300); // set_time_limit(300);
return Queue::marshal(); return Queue::marshal();
}); });
Route::get('/', function () {
Route::get('/', function() {
return Redirect::route('showSelectOrganiser'); 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 'TODO: add terms and cond';
//return View::make('Public.Website.Terms_and_Cond'); //return View::make('Public.Website.Terms_and_Cond');
}]); }]);

View File

@ -1,38 +1,43 @@
<?php namespace App\Models; <?php
namespace App\Models;
use App\Attendize\Utils;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use \App\Attendize\Utils;
class Account extends MyBaseModel { class Account extends MyBaseModel
{
use SoftDeletes; use SoftDeletes;
protected $rules = [ protected $rules = [
'first_name' => ['required'], 'first_name' => ['required'],
'last_name' => ['required'], 'last_name' => ['required'],
'email' => ['required', 'email'] 'email' => ['required', 'email'],
]; ];
protected $messages = []; protected $messages = [];
public function users() { public function users()
{
return $this->hasMany('\App\Models\User'); return $this->hasMany('\App\Models\User');
} }
public function orders() { public function orders()
{
return $this->hasMany('\App\Models\Order'); return $this->hasMany('\App\Models\Order');
} }
public function currency() { public function currency()
{
return $this->hasOne('\App\Models\Currency'); return $this->hasOne('\App\Models\Currency');
} }
public function getStripeApiKeyAttribute() { public function getStripeApiKeyAttribute()
if(Utils::isAttendize()) { {
if (Utils::isAttendize()) {
return $this->stripe_access_token; return $this->stripe_access_token;
} }
return $this->stripe_secret_key; return $this->stripe_secret_key;
} }
} }

View File

@ -1,14 +1,16 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of Activity * Description of Activity.
* *
* @author Dave * @author Dave
*/ */
class Activity extends \Illuminate\Database\Eloquent\Model { class Activity extends \Illuminate\Database\Eloquent\Model
{
} }

View File

@ -1,13 +1,17 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
class Affiliate extends \Illuminate\Database\Eloquent\Model { class Affiliate extends \Illuminate\Database\Eloquent\Model
protected $fillable = array('name', 'visits', 'tickets_sold', 'event_id', 'account_id', 'sales_volume'); {
protected $fillable = ['name', 'visits', 'tickets_sold', 'event_id', 'account_id', 'sales_volume'];
public function getDates() {
return array('created_at', 'updated_at'); public function getDates()
{
return ['created_at', 'updated_at'];
} }
} }

View File

@ -1,4 +1,6 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@ -7,52 +9,58 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
/** /**
* Description of Attendees * Description of Attendees.
* *
* @author Dave * @author Dave
*/ */
class Attendee extends MyBaseModel { class Attendee extends MyBaseModel
{
use SoftDeletes; use SoftDeletes;
public function order(){ public function order()
{
return$this->belongsTo('\App\Models\Order'); return$this->belongsTo('\App\Models\Order');
} }
public function ticket() { public function ticket()
{
return $this->belongsTo('\App\Models\Ticket'); return $this->belongsTo('\App\Models\Ticket');
} }
public function event() { public function event()
return $this->belongsTo('\App\Models\Event'); {
return $this->belongsTo('\App\Models\Event');
} }
public function scopeWithoutCancelled($query)
public function scopeWithoutCancelled($query) { {
return $query->where('attendees.is_cancelled', '=', 0); return $query->where('attendees.is_cancelled', '=', 0);
} }
public function getFullNameAttribute() { public function getFullNameAttribute()
{
return $this->first_name.' '.$this->last_name; return $this->first_name.' '.$this->last_name;
} }
// //
// public function getReferenceAttribute() { // public function getReferenceAttribute() {
// return $this->order->order_reference // 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) { public function getDates()
$order->private_reference_number = str_pad(rand(0, pow(10, 9)-1), 9, '0', STR_PAD_LEFT); {
}); 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);
});
}
} }

View File

@ -1,23 +1,25 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of Currency * Description of Currency.
* *
* @author Dave * @author Dave
*/ */
class Currency extends \Illuminate\Database\Eloquent\Model { class Currency extends \Illuminate\Database\Eloquent\Model
public $timestamps = false; {
protected $softDelete = false; public $timestamps = false;
protected $softDelete = false;
protected $table = 'currencies';
protected $table = 'currencies';
public function event() { public function event()
return $this->belongsTo('\App\Models\Event'); {
} return $this->belongsTo('\App\Models\Event');
}
} }

View File

@ -1,17 +1,18 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of DateFormat * Description of DateFormat.
* *
* @author Dave * @author Dave
*/ */
class DateFormat extends \Illuminate\Database\Eloquent\Model { class DateFormat extends \Illuminate\Database\Eloquent\Model
{
public $timestamps = false; public $timestamps = false;
protected $softDelete = false; protected $softDelete = false;
} }

View File

@ -1,18 +1,20 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of DateTimeFormat * Description of DateTimeFormat.
* *
* @author Dave * @author Dave
*/ */
class DateTimeFormat extends \Illuminate\Database\Eloquent\Model { class DateTimeFormat extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'datetime_formats'; protected $table = 'datetime_formats';
public $timestamps = false; public $timestamps = false;
protected $softDelete = false; protected $softDelete = false;
} }

View File

@ -1,14 +1,17 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of DiscountCode * Description of DiscountCode.
* *
* @author Dave * @author Dave
*/ */
class DiscountCode extends \Illuminate\Database\Eloquent\Model { class DiscountCode extends \Illuminate\Database\Eloquent\Model
{
//put your code here //put your code here
} }

View File

@ -1,112 +1,136 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Str, URL;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Str;
use URL;
class Event extends MyBaseModel { class Event extends MyBaseModel
{
use SoftDeletes; use SoftDeletes;
protected $rules = array(
'title' => 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() { protected $rules = [
return $this->belongsToMany('\App\Models\Question', 'event_question'); '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'); return $this->hasMany('\App\Models\Attendee');
} }
public function images() { public function images()
{
return $this->hasMany('\App\Models\EventImage'); return $this->hasMany('\App\Models\EventImage');
} }
public function messages() {
public function messages()
{
return $this->hasMany('\App\Models\Message')->orderBy('created_at', 'DESC'); return $this->hasMany('\App\Models\Message')->orderBy('created_at', 'DESC');
} }
public function tickets() { public function tickets()
{
return $this->hasMany('\App\Models\Ticket'); return $this->hasMany('\App\Models\Ticket');
} }
public function stats() { public function stats()
{
return $this->hasMany('\App\Models\EventStats'); return $this->hasMany('\App\Models\EventStats');
} }
public function affiliates() { public function affiliates()
{
return $this->hasMany('\App\Models\Affiliate'); return $this->hasMany('\App\Models\Affiliate');
} }
public function orders() { public function orders()
{
return $this->hasMany('\App\Models\Order'); return $this->hasMany('\App\Models\Order');
} }
public function account() { public function account()
{
return $this->belongsTo('\App\Models\Account'); return $this->belongsTo('\App\Models\Account');
} }
public function currency() { public function currency()
{
return $this->belongsTo('\App\Models\Currency'); return $this->belongsTo('\App\Models\Currency');
} }
public function organiser() { public function organiser()
{
return $this->belongsTo('\App\Models\Organiser'); return $this->belongsTo('\App\Models\Organiser');
} }
/* /*
* Getters & Setters * Getters & Setters
*/ */
public function getEmbedUrlAttribute() { public function getEmbedUrlAttribute()
{
return str_replace(['http:', 'https:'], '', route('showEmbeddedEventPage', ['event' => $this->id])); 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; 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; 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); return Carbon::now()->between($this->start_date, $this->end_date);
} }
public function getCurrencySymbolAttribute() { public function getCurrencySymbolAttribute()
{
return $this->currency->symbol_left; return $this->currency->symbol_left;
} }
public function getCurrencyCodeAttribute() {
public function getCurrencyCodeAttribute()
{
return $this->currency->code; return $this->currency->code;
} }
public function getEmbedHtmlCodeAttribute () { public function getEmbedHtmlCodeAttribute()
{
return "<!--Attendize.com Ticketing Embed Code--> return "<!--Attendize.com Ticketing Embed Code-->
<iframe style='overflow:hidden; min-height: 350px;' frameBorder='0' seamless='seamless' width='100%' height='100%' src='".$this->embed_url."' vspace='0' hspace='0' scrolling='auto' allowtransparency='true'></iframe> <iframe style='overflow:hidden; min-height: 350px;' frameBorder='0' seamless='seamless' width='100%' height='100%' src='".$this->embed_url."' vspace='0' hspace='0' scrolling='auto' allowtransparency='true'></iframe>
<!--/Attendize.com Ticketing Embed Code-->"; <!--/Attendize.com Ticketing Embed Code-->";
} }
/* /*
* Get a usable address for embedding Google Maps * Get a usable address for embedding Google Maps
*/ */
public function getMapAddressAttribute() { public function getMapAddressAttribute()
{
$string = $this->venue.',' $string = $this->venue.','
.$this->location_street_number.',' .$this->location_street_number.','
.$this->location_address_line_1.',' .$this->location_address_line_1.','
@ -114,26 +138,27 @@ class Event extends MyBaseModel {
.$this->location_state.',' .$this->location_state.','
.$this->location_post_code.',' .$this->location_post_code.','
.$this->location_country; .$this->location_country;
return urlencode($string); return urlencode($string);
} }
public function getBgImageUrlAttribute() { public function getBgImageUrlAttribute()
{
return URL::to('/').'/'.$this->bg_image_path; return URL::to('/').'/'.$this->bg_image_path;
} }
public function getEventUrlAttribute() { public function getEventUrlAttribute()
{
return URL::to('/').'/e/'.$this->id.'/'.Str::slug($this->title); return URL::to('/').'/e/'.$this->id.'/'.Str::slug($this->title);
} }
public function getSalesAndFeesVoulmeAttribute() { public function getSalesAndFeesVoulmeAttribute()
{
return $this->sales_volume + $this->organiser_fees_volume; return $this->sales_volume + $this->organiser_fees_volume;
} }
public function getDates() { public function getDates()
return array('created_at', 'updated_at', 'start_date', 'end_date'); {
return ['created_at', 'updated_at', 'start_date', 'end_date'];
} }
} }

View File

@ -1,15 +1,16 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of EventImage * Description of EventImage.
* *
* @author Dave * @author Dave
*/ */
class EventImage extends MyBaseModel { class EventImage extends MyBaseModel
{
} }

View File

@ -1,84 +1,84 @@
<?php namespace App\Models; <?php
use DB, Cookie; namespace App\Models;
use App\Models\Ticket;
class EventStats extends \Illuminate\Database\Eloquent\Model { use Cookie;
use DB;
class EventStats extends \Illuminate\Database\Eloquent\Model
{
public $timestamps = false; public $timestamps = false;
public static $unguarded = true; public static $unguarded = true;
/** /**
*
* @todo This shouldn't be in a view. * @todo This shouldn't be in a view.
*
*/ */
/** /**
* Update the amount of revenue a ticket has earned * Update the amount of revenue a ticket has earned.
* *
* @param int $ticket_id * @param int $ticket_id
* @param float $amount * @param float $amount
* @param bool $deduct * @param bool $deduct
*
* @return bool * @return bool
*/ */
public function updateTicketRevenue($ticket_id, $amount, $deduct = FALSE) { public function updateTicketRevenue($ticket_id, $amount, $deduct = false)
{
$ticket = Ticket::find($ticket_id); $ticket = Ticket::find($ticket_id);
if($deduct) { if ($deduct) {
$amount = $amount * -1; $amount = $amount * -1;
} }
$ticket->ticket_revenue = $ticket->ticket_revenue + $amount; $ticket->ticket_revenue = $ticket->ticket_revenue + $amount;
return $ticket->save(); return $ticket->save();
} }
public function updateViewCount($event_id) {
public function updateViewCount($event_id)
{
$stats = $this->firstOrNew([ $stats = $this->firstOrNew([
'event_id' => $event_id, 'event_id' => $event_id,
'date' => DB::raw('CURDATE()') 'date' => DB::raw('CURDATE()'),
]); ]);
$cookie_name = 'visitTrack_'.$event_id.'_'.date('dmy'); $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); Cookie::queue($cookie_name, true, 60 * 24 * 14);
++$stats->unique_views; ++$stats->unique_views;
} }
++$stats->views; ++$stats->views;
return $stats->save(); return $stats->save();
} }
/* /*
* TODO: Missing amount? * TODO: Missing amount?
*/ */
public function updateSalesVolume($event_id) { public function updateSalesVolume($event_id)
{
$stats = $this->firstOrNew([ $stats = $this->firstOrNew([
'event_id' => $event_id, 'event_id' => $event_id,
'date' => DB::raw('CURDATE()') 'date' => DB::raw('CURDATE()'),
]); ]);
$stats->sales_volume = $stats->sales_volume + $amount; $stats->sales_volume = $stats->sales_volume + $amount;
return $stats->save(); return $stats->save();
} }
public function updateTicketsSoldCount($event_id, $count)
public function updateTicketsSoldCount($event_id, $count) { {
$stats = $this->firstOrNew([ $stats = $this->firstOrNew([
'event_id' => $event_id, 'event_id' => $event_id,
'date' => DB::raw('CURDATE()') 'date' => DB::raw('CURDATE()'),
]); ]);
$stats->increment('tickets_sold', $count); $stats->increment('tickets_sold', $count);
return $stats->save(); return $stats->save();
} }
} }

View File

@ -1,31 +1,36 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of Message * Description of Message.
* *
* @author Dave * @author Dave
*/ */
class Message extends MyBaseModel { class Message extends MyBaseModel
{
public function event() { public function event()
{
return $this->belongsTo('\App\Models\Event'); return $this->belongsTo('\App\Models\Event');
} }
public function getRecipientsLabelAttribute() { public function getRecipientsLabelAttribute()
if($this->recipients == 0) { {
if ($this->recipients == 0) {
return 'All Attendees'; return 'All Attendees';
} }
$ticket = Ticket::scope()->find($this->recipients); $ticket = Ticket::scope()->find($this->recipients);
return 'Ticket: '.$ticket->title; 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'];
}
} }

View File

@ -2,26 +2,28 @@
namespace App\Models; namespace App\Models;
use Auth, use Auth;
Validator; use Validator;
/* /*
* Adapted from: https://github.com/hillelcoren/invoice-ninja/blob/master/app/models/EntityModel.php * 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; protected $softDelete = true;
public $timestamps = true; public $timestamps = true;
protected $rules = array(); protected $rules = [];
protected $messages = array(); protected $messages = [];
protected $errors; protected $errors;
public function validate($data) { public function validate($data)
{
$v = Validator::make($data, $this->rules, $this->messages); $v = Validator::make($data, $this->rules, $this->messages);
if ($v->fails()) { if ($v->fails()) {
$this->errors = $v->messages(); $this->errors = $v->messages();
return false; return false;
} }
@ -29,30 +31,30 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model {
return true; return true;
} }
public function errors($returnArray = TRUE) { public function errors($returnArray = true)
{
return $returnArray ? $this->errors->toArray() : $this->errors; return $returnArray ? $this->errors->toArray() : $this->errors;
} }
/** /**
* * @param int $account_id
* @param int $account_id * @param int $user_id
* @param int $user_id
* @param bool $ignore_user_id * @param bool $ignore_user_id
*
* @return \className * @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(); $className = get_called_class();
$entity = new $className(); $entity = new $className();
if (Auth::check()) { if (Auth::check()) {
if (!$ignore_user_id) { if (!$ignore_user_id) {
$entity->user_id = Auth::user()->id; $entity->user_id = Auth::user()->id;
} }
$entity->account_id = Auth::user()->account_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) { if ($user_id && !$ignore_user_id) {
$entity->user_id = $user_id; $entity->user_id = $user_id;
} }
@ -65,16 +67,17 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model {
return $entity; return $entity;
} }
public function getFormatedDate($field, $format = 'd-m-Y H:i') { public function getFormatedDate($field, $format = 'd-m-Y H:i')
return $this->$field === NULL ? NULL : date($format, strtotime($this->$field)); {
return $this->$field === null ? null : date($format, strtotime($this->$field));
} }
/** /**
*
* @param int $accountId * @param int $accountId
*/ */
public function scopeScope($query, $accountId = false) { public function scopeScope($query, $accountId = false)
{
/* /*
* GOD MODE - DON'T UNCOMMENT! * GOD MODE - DON'T UNCOMMENT!
* returning $query before adding the account_id condition will let you * returning $query before adding the account_id condition will let you
@ -82,18 +85,16 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model {
* //return $query; * //return $query;
*/ */
if (!$accountId) { if (!$accountId) {
$accountId = Auth::user()->account_id; $accountId = Auth::user()->account_id;
} }
$table = $this->getTable(); $table = $this->getTable();
$query->where(function($query) use ($accountId, $table) { $query->where(function ($query) use ($accountId, $table) {
$query->whereRaw(\DB::raw('(' . $table . '.account_id = ' . $accountId . ')')); $query->whereRaw(\DB::raw('('.$table.'.account_id = '.$accountId.')'));
}); });
return $query; return $query;
} }
} }

View File

@ -2,84 +2,94 @@
namespace App\Models; namespace App\Models;
use File;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use PDF; use PDF;
use File;
class Order extends MyBaseModel {
class Order extends MyBaseModel
{
use SoftDeletes; use SoftDeletes;
public $rules = [ public $rules = [
'order_first_name' => ['required'], 'order_first_name' => ['required'],
'order_last_name' => ['required'], 'order_last_name' => ['required'],
'order_email' => ['required', 'email'], 'order_email' => ['required', 'email'],
]; ];
public $messages = [ public $messages = [
'order_first_name.required' => 'Please enter a valid first name', 'order_first_name.required' => 'Please enter a valid first name',
'order_last_name.required' => 'Please enter a valid last name', 'order_last_name.required' => 'Please enter a valid last name',
'order_email.email' => 'Please enter a valid email', 'order_email.email' => 'Please enter a valid email',
]; ];
public function orderItems() { public function orderItems()
{
return $this->hasMany('\App\Models\OrderItem'); return $this->hasMany('\App\Models\OrderItem');
} }
public function attendees() { public function attendees()
{
return $this->hasMany('\App\Models\Attendee'); return $this->hasMany('\App\Models\Attendee');
} }
public function account() { public function account()
{
return $this->belongsTo('\App\Models\Account'); return $this->belongsTo('\App\Models\Account');
} }
public function event() { public function event()
{
return $this->belongsTo('\App\Models\Event'); return $this->belongsTo('\App\Models\Event');
} }
public function tickets() { public function tickets()
{
return $this->hasMany('\App\Models\Ticket'); return $this->hasMany('\App\Models\Ticket');
} }
public function orderStatus() { public function orderStatus()
{
return $this->belongsTo('\App\Models\OrderStatus'); return $this->belongsTo('\App\Models\OrderStatus');
} }
public function getOrganiserAmountAttribute() { public function getOrganiserAmountAttribute()
{
return $this->amount + $this->organiser_booking_fee; return $this->amount + $this->organiser_booking_fee;
} }
public function getTotalAmountAttribute() { public function getTotalAmountAttribute()
{
return $this->amount + $this->organiser_booking_fee + $this->booking_fee; return $this->amount + $this->organiser_booking_fee + $this->booking_fee;
} }
public function getFullNameAttribute() { public function getFullNameAttribute()
return $this->first_name . ' ' . $this->last_name; {
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 * @todo Move this from the order model
* @return boolean *
* @return bool
*/ */
public function generatePdfTickets() { public function generatePdfTickets()
{
$data = [ $data = [
'order' => $this, 'order' => $this,
'event' => $this->event, 'event' => $this->event,
'tickets' => $this->event->tickets, 'tickets' => $this->event->tickets,
'attendees' => $this->attendees 'attendees' => $this->attendees,
]; ];
$pdf_file_path = public_path(config('attendize.event_pdf_tickets_path')) . '/' . $this->order_reference; $pdf_file_path = public_path(config('attendize.event_pdf_tickets_path')).'/'.$this->order_reference;
$pdf_file = $pdf_file_path.'.pdf'; $pdf_file = $pdf_file_path.'.pdf';
if (file_exists($pdf_file)) { if (file_exists($pdf_file)) {
return true; return true;
} }
if(!is_dir($pdf_file_path)) { if (!is_dir($pdf_file_path)) {
File::makeDirectory($pdf_file_path, 0777, true, true); File::makeDirectory($pdf_file_path, 0777, true, true);
} }
@ -92,12 +102,12 @@ class Order extends MyBaseModel {
return file_exists($pdf_file); return file_exists($pdf_file);
} }
public static function boot() { public static function boot()
{
parent::boot(); parent::boot();
static::creating(function($order) { static::creating(function ($order) {
$order->order_reference = strtoupper(str_random(5)) . date('jn'); $order->order_reference = strtoupper(str_random(5)).date('jn');
}); });
} }
} }

View File

@ -1,15 +1,17 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of OrderItems * Description of OrderItems.
* *
* @author Dave * @author Dave
*/ */
class OrderItem extends MyBaseModel { class OrderItem extends MyBaseModel
public $timestamps = false; {
public $timestamps = false;
} }

View File

@ -1,15 +1,16 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of OrderStatus * Description of OrderStatus.
* *
* @author Dave * @author Dave
*/ */
class OrderStatus extends \Illuminate\Database\Eloquent\Model { class OrderStatus extends \Illuminate\Database\Eloquent\Model
{
} }

View File

@ -1,55 +1,56 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Str; use Str;
class Organiser extends MyBaseModel { class Organiser extends MyBaseModel
{
protected $rules = array( protected $rules = [
'name' => array('required'), 'name' => ['required'],
'email' => array('required', 'email'), 'email' => ['required', 'email'],
'organiser_logo' => ['mimes:jpeg,jpg,png', 'max:10000'] 'organiser_logo' => ['mimes:jpeg,jpg,png', 'max:10000'],
); ];
protected $messages = array( protected $messages = [
'name.required' => 'You must at least give a name for the event organiser.', '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.max' => 'Please upload an image smaller than 10Mb',
'organiser_logo.size' => '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)' 'organiser_logo.mimes' => 'Please select a valid image type (jpeg, jpg, png)',
); ];
public function events() { public function events()
{
return $this->hasMany('\App\Models\Event'); return $this->hasMany('\App\Models\Event');
} }
public function attendees() { public function attendees()
{
return $this->hasManyThrough('\App\Models\Attendee', '\App\Models\Event'); return $this->hasManyThrough('\App\Models\Attendee', '\App\Models\Event');
} }
public function getFullLogoPathAttribute() { 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)))) { {
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.cdn_url_user_assets').'/'.$this->logo_path;
} }
return config('attendize.fallback_organiser_logo_url'); return config('attendize.fallback_organiser_logo_url');
} }
public function getOrganiserUrlAttribute() { public function getOrganiserUrlAttribute()
{
return route('showOrganiserHome', [ return route('showOrganiserHome', [
'organiser_id' => $this->id, 'organiser_id' => $this->id,
'organiser_slug' => Str::slug($this->oraganiser_name) 'organiser_slug' => Str::slug($this->oraganiser_name),
]); ]);
} }
public function getOrganiserSalesVolumeAttribute() { public function getOrganiserSalesVolumeAttribute()
{
return $this->events->sum('sales_volume'); return $this->events->sum('sales_volume');
} }
public function getDailyStats()
public function getDailyStats() { {
} }
} }

View File

@ -1,14 +1,17 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of PaymentGateway * Description of PaymentGateway.
* *
* @author Dave * @author Dave
*/ */
class PaymentGateway extends \Illuminate\Database\Eloquent\Model { class PaymentGateway extends \Illuminate\Database\Eloquent\Model
{
//put your code here //put your code here
} }

View File

@ -1,22 +1,25 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Description of Questions * Description of Questions.
* *
* @author Dave * @author Dave
*/ */
class Question extends MyBaseModel { class Question extends MyBaseModel
{
use SoftDeletes; use SoftDeletes;
public function events() { public function events()
{
return $this->belongsToMany('\App\Models\Event'); return $this->belongsToMany('\App\Models\Event');
} }
public function question_types()
public function question_types() { {
return $this->hasOne('\App\Models\QuestionType'); return $this->hasOne('\App\Models\QuestionType');
} }
} }

View File

@ -1,7 +1,7 @@
<?php namespace App\Models; <?php
class QuestionType extends \Illuminate\Database\Eloquent\Model { namespace App\Models;
class QuestionType extends \Illuminate\Database\Eloquent\Model
{
} }

View File

@ -1,16 +1,16 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of ReservedTickets * Description of ReservedTickets.
* *
* @author Dave * @author Dave
*/ */
class ReservedTickets extends \Illuminate\Database\Eloquent\Model { class ReservedTickets extends \Illuminate\Database\Eloquent\Model
{
} }

View File

@ -1,41 +1,47 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Ticket extends MyBaseModel
class Ticket extends MyBaseModel { {
use SoftDeletes; use SoftDeletes;
public $rules = [ public $rules = [
'title' => array('required'), 'title' => ['required'],
'price' => array('required', 'numeric', 'min:0'), 'price' => ['required', 'numeric', 'min:0'],
'start_sale_date' => array('date'), 'start_sale_date' => ['date'],
'end_sale_date' => array('date', 'after:start_sale_date'), 'end_sale_date' => ['date', 'after:start_sale_date'],
'quantity_available' => ['integer', 'min:0'] 'quantity_available' => ['integer', 'min:0'],
]; ];
public $messages = [ public $messages = [
'price.numeric' => 'The price must be a valid number (e.g 12.50)', '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)', '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.' 'quantity_available.integer' => 'Please ensure the quantity available is a number.',
]; ];
public function event() { public function event()
{
return $this->belongsTo('\App\Models\Event'); return $this->belongsTo('\App\Models\Event');
} }
public function order() { public function order()
{
return $this->belongsToMany('\App\Models\Order'); return $this->belongsToMany('\App\Models\Order');
} }
public function questions() { public function questions()
{
return $this->belongsToMany('\App\Models\Question', 'ticket_question'); 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); $query->where('remaining_tickets', '=', 0);
} }
@ -43,104 +49,97 @@ class Ticket extends MyBaseModel {
* Getters & Setters * Getters & Setters
*/ */
public function getDates() { public function getDates()
return array('created_at', 'updated_at', 'start_sale_date', 'end_sale_date'); {
return ['created_at', 'updated_at', 'start_sale_date', 'end_sale_date'];
} }
public function getQuantityRemainingAttribute() { public function getQuantityRemainingAttribute()
{
if(is_null($this->quantity_available)) { if (is_null($this->quantity_available)) {
return 9999; //Better way to do this? return 9999; //Better way to do this?
} }
return $this->quantity_available - ($this->quantity_sold + $this->quantity_reserved); return $this->quantity_available - ($this->quantity_sold + $this->quantity_reserved);
} }
public function getQuantityReservedAttribute() {
public function getQuantityReservedAttribute()
{
$reserved_total = \DB::table('reserved_tickets') $reserved_total = \DB::table('reserved_tickets')
->where('ticket_id', $this->id) ->where('ticket_id', $this->id)
->where('expires', '>', \Carbon::now()) ->where('expires', '>', \Carbon::now())
->sum('quantity_reserved'); ->sum('quantity_reserved');
return $reserved_total; return $reserved_total;
} }
public function getBookingFeeAttribute()
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); 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() { 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); {
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(); return $this->getBookingFeeAttribute() + $this->getOrganiserBookingFeeAttribute();
} }
public function getTotalPriceAttribute() { public function getTotalPriceAttribute()
{
return $this->getTotalBookingFeeAttribute() + $this->price; return $this->getTotalBookingFeeAttribute() + $this->price;
} }
public function getTicketMaxMinRangAttribute() { public function getTicketMaxMinRangAttribute()
{
$range = []; $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]; $range[] = [$i => $i];
} }
return $range; return $range;
} }
public function isFree() { public function isFree()
return (int)ceil($this->price) === 0; {
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() { public function getSaleStatusAttribute()
{
if ($this->start_sale_date !== NULL) { if ($this->start_sale_date !== null) {
if ($this->start_sale_date->isFuture()) { if ($this->start_sale_date->isFuture()) {
return config('attendize.ticket_status_before_sale_date'); 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()) { if ($this->end_sale_date->isPast()) {
return config('attendize.ticket_status_after_sale_date'); return config('attendize.ticket_status_after_sale_date');
} }
} }
if ((int)$this->quantity_available > 0) { if ((int) $this->quantity_available > 0) {
if ((int)$this->quantity_remaining <= 0) { if ((int) $this->quantity_remaining <= 0) {
return config('attendize.ticket_status_sold_out'); 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_off_sale');
} }
return config('attendize.ticket_status_on_sale'); return config('attendize.ticket_status_on_sale');
} }
// public function setQuantityAvailableAttribute($value) { // public function setQuantityAvailableAttribute($value) {
// $this->attributes['quantity_available'] = trim($value) == '' ? -1 : $value; // $this->attributes['quantity_available'] = trim($value) == '' ? -1 : $value;
@ -149,5 +148,4 @@ class Ticket extends MyBaseModel {
// public function setMaxPerPersonAttribute($value) { // public function setMaxPerPersonAttribute($value) {
// $this->attributes['max_per_person'] = trim($value) == '' ? -1 : $value; // $this->attributes['max_per_person'] = trim($value) == '' ? -1 : $value;
// } // }
} }

View File

@ -1,14 +1,17 @@
<?php namespace App\Models; <?php
namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of TicketStatuses * Description of TicketStatuses.
* *
* @author Dave * @author Dave
*/ */
class TicketStatus extends \Illuminate\Database\Eloquent\Model { class TicketStatus extends \Illuminate\Database\Eloquent\Model
{
//put your code here //put your code here
} }

View File

@ -1,17 +1,18 @@
<?php namespace App\Models; <?php
use Illuminate\Database\Eloquent\SoftDeletingTrait; namespace App\Models;
/* /*
Attendize.com - Event Management & Ticketing Attendize.com - Event Management & Ticketing
*/ */
/** /**
* Description of Timezone * Description of Timezone.
* *
* @author Dave * @author Dave
*/ */
class Timezone extends \Illuminate\Database\Eloquent\Model { class Timezone extends \Illuminate\Database\Eloquent\Model
{
public $timestamps = false; public $timestamps = false;
protected $softDelete = false; protected $softDelete = false;
} }

View File

@ -1,15 +1,16 @@
<?php namespace App\Models; <?php
namespace App\Models;
use Illuminate\Auth\Authenticatable; use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
class User extends Model implements AuthenticatableContract, CanResetPasswordContract { {
use Authenticatable, CanResetPassword, SoftDeletes; use Authenticatable, CanResetPassword, SoftDeletes;
/** /**
@ -24,13 +25,15 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* *
* @var array * @var array
*/ */
protected $hidden = array('password'); protected $hidden = ['password'];
public function account() { public function account()
{
return $this->belongsTo('\App\Models\Account'); return $this->belongsTo('\App\Models\Account');
} }
public function activity() { public function activity()
{
return $this->hasMany('\App\Models\Activity'); return $this->hasMany('\App\Models\Activity');
} }
@ -39,7 +42,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* *
* @return mixed * @return mixed
*/ */
public function getAuthIdentifier() { public function getAuthIdentifier()
{
return $this->getKey(); return $this->getKey();
} }
@ -48,7 +52,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* *
* @return string * @return string
*/ */
public function getAuthPassword() { public function getAuthPassword()
{
return $this->password; return $this->password;
} }
@ -57,28 +62,32 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* *
* @return string * @return string
*/ */
public function getReminderEmail() { public function getReminderEmail()
{
return $this->email; return $this->email;
} }
public function getRememberToken() { public function getRememberToken()
{
return $this->remember_token; return $this->remember_token;
} }
public function setRememberToken($value) { public function setRememberToken($value)
{
$this->remember_token = $value; $this->remember_token = $value;
} }
public function getRememberTokenName() { public function getRememberTokenName()
{
return 'remember_token'; return 'remember_token';
} }
public static function boot() { public static function boot()
{
parent::boot(); parent::boot();
static::creating(function($user) { static::creating(function ($user) {
$user->confirmation_code = str_random(); $user->confirmation_code = str_random();
}); });
} }
} }

View File

@ -3,19 +3,16 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Request;
use App\Models\Organiser;
use Auth;
class AppServiceProvider extends ServiceProvider {
class AppServiceProvider extends ServiceProvider
{
/** /**
* Bootstrap any application services. * Bootstrap any application services.
* *
* @return void * @return void
*/ */
public function boot() { public function boot()
{
require app_path('Attendize/constants.php'); require app_path('Attendize/constants.php');
} }
@ -28,15 +25,10 @@ class AppServiceProvider extends ServiceProvider {
* *
* @return void * @return void
*/ */
public function register() { public function register()
{
$this->app->bind( $this->app->bind(
'Illuminate\Contracts\Auth\Registrar', 'App\Services\Registrar' 'Illuminate\Contracts\Auth\Registrar', 'App\Services\Registrar'
); );
} }
} }

View File

@ -1,34 +1,35 @@
<?php namespace App\Providers; <?php
namespace App\Providers;
use Illuminate\Bus\Dispatcher; use Illuminate\Bus\Dispatcher;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class BusServiceProvider extends ServiceProvider { class BusServiceProvider extends ServiceProvider
{
/** /**
* Bootstrap any application services. * Bootstrap any application services.
* *
* @param \Illuminate\Bus\Dispatcher $dispatcher * @param \Illuminate\Bus\Dispatcher $dispatcher
* @return void *
*/ * @return void
public function boot(Dispatcher $dispatcher) */
{ public function boot(Dispatcher $dispatcher)
$dispatcher->mapUsing(function($command) {
{ $dispatcher->mapUsing(function ($command) {
return Dispatcher::simpleMapping( return Dispatcher::simpleMapping(
$command, 'App\Commands', 'App\Handlers\Commands' $command, 'App\Commands', 'App\Handlers\Commands'
); );
}); });
} }
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
} }

View File

@ -1,23 +1,24 @@
<?php namespace App\Providers; <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class ConfigServiceProvider extends ServiceProvider { class ConfigServiceProvider extends ServiceProvider
{
/** /**
* Overwrite any vendor / package configuration. * Overwrite any vendor / package configuration.
* *
* This service provider is intended to provide a convenient location for you * This service provider is intended to provide a convenient location for you
* to overwrite any "vendor" or package configuration that you may want to * to overwrite any "vendor" or package configuration that you may want to
* modify before the application handles the incoming request / command. * modify before the application handles the incoming request / command.
* *
* @return void * @return void
*/ */
public function register() public function register()
{ {
config([ config([
// //
]); ]);
} }
} }

View File

@ -1,32 +1,34 @@
<?php namespace App\Providers; <?php
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider { class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array
*/
protected $listen = [
'event.name' => [
'EventListener',
],
];
/** /**
* The event handler mappings for the application. * Register any other events for your application.
* *
* @var array * @param \Illuminate\Contracts\Events\Dispatcher $events
*/ *
protected $listen = [ * @return void
'event.name' => [ */
'EventListener', 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);
//
}
//
}
} }

View File

@ -1,28 +1,28 @@
<?php namespace App\Providers; <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class HelpersServiceProvider extends ServiceProvider { class HelpersServiceProvider extends ServiceProvider
{
/** /**
* Bootstrap the application services. * Bootstrap the application services.
* *
* @return void * @return void
*/ */
public function boot() public function boot()
{ {
require app_path('Helpers/helpers.php'); require app_path('Helpers/helpers.php');
require app_path('Helpers/macros.php'); require app_path('Helpers/macros.php');
} }
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
} }

View File

@ -1,44 +1,46 @@
<?php namespace App\Providers; <?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
class RouteServiceProvider extends ServiceProvider { class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/** /**
* This namespace is applied to the controller routes in your routes file. * Define your route model bindings, pattern filters, etc.
* *
* In addition, it is set as the URL generator's root namespace. * @param \Illuminate\Routing\Router $router
* *
* @var string * @return void
*/ */
protected $namespace = 'App\Http\Controllers'; public function boot(Router $router)
{
parent::boot($router);
/** //
* Define your route model bindings, pattern filters, etc. }
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);
//
}
/**
* 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');
});
}
/**
* 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');
});
}
} }

View File

@ -1,39 +1,42 @@
<?php namespace App\Services; <?php
namespace App\Services;
use App\User; use App\User;
use Validator;
use Illuminate\Contracts\Auth\Registrar as RegistrarContract; use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
use Validator;
class Registrar implements RegistrarContract { class Registrar implements RegistrarContract
{
/** /**
* Get a validator for an incoming registration request. * Get a validator for an incoming registration request.
* *
* @param array $data * @param array $data
* @return \Illuminate\Contracts\Validation\Validator *
*/ * @return \Illuminate\Contracts\Validation\Validator
public function validator(array $data) */
{ public function validator(array $data)
return Validator::make($data, [ {
'name' => 'required|max:255', return Validator::make($data, [
'email' => 'required|email|max:255|unique:users', 'name' => 'required|max:255',
'password' => 'required|confirmed|min:6', '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']),
]);
}
/**
* 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']),
]);
}
} }

View File

@ -12,7 +12,7 @@
*/ */
$app = new Illuminate\Foundation\Application( $app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../') realpath(__DIR__.'/../')
); );
/* /*
@ -27,18 +27,18 @@ $app = new Illuminate\Foundation\Application(
*/ */
$app->singleton( $app->singleton(
'Illuminate\Contracts\Http\Kernel', 'Illuminate\Contracts\Http\Kernel',
'App\Http\Kernel' 'App\Http\Kernel'
); );
$app->singleton( $app->singleton(
'Illuminate\Contracts\Console\Kernel', 'Illuminate\Contracts\Console\Kernel',
'App\Console\Kernel' 'App\Console\Kernel'
); );
$app->singleton( $app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler', 'Illuminate\Contracts\Debug\ExceptionHandler',
'App\Exceptions\Handler' 'App\Exceptions\Handler'
); );
/* /*

View File

@ -29,7 +29,6 @@ require __DIR__.'/../vendor/autoload.php';
$compiledPath = __DIR__.'/cache/compiled.php'; $compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) if (file_exists($compiledPath)) {
{ require $compiledPath;
require $compiledPath;
} }

View File

@ -1,9 +1,9 @@
<?php <?php
return array( return [
'debug' => false, 'debug' => false,
'binpath' => 'lib/', 'binpath' => 'lib/',
'binfile' => 'wkhtmltopdf-amd64', 'binfile' => 'wkhtmltopdf-amd64',
'output_mode' => 'I' 'output_mode' => 'I',
); ];

View File

@ -68,7 +68,7 @@ return [
| will not be safe. Please do this before deploying an application! | 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, 'cipher' => MCRYPT_RIJNDAEL_128,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -141,8 +141,6 @@ return [
'App\Providers\RouteServiceProvider', 'App\Providers\RouteServiceProvider',
'App\Providers\HelpersServiceProvider', 'App\Providers\HelpersServiceProvider',
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -156,55 +154,55 @@ return [
*/ */
'aliases' => [ 'aliases' => [
'App' => 'Illuminate\Support\Facades\App', 'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan', 'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth', 'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade', 'Blade' => 'Illuminate\Support\Facades\Blade',
'Bus' => 'Illuminate\Support\Facades\Bus', 'Bus' => 'Illuminate\Support\Facades\Bus',
'Cache' => 'Illuminate\Support\Facades\Cache', 'Cache' => 'Illuminate\Support\Facades\Cache',
'Config' => 'Illuminate\Support\Facades\Config', 'Config' => 'Illuminate\Support\Facades\Config',
'Cookie' => 'Illuminate\Support\Facades\Cookie', 'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt', 'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB', 'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model', 'Eloquent' => 'Illuminate\Database\Eloquent\Model',
/* /*
* changed Event alias to LaravelEvent as there was a conflict * changed Event alias to LaravelEvent as there was a conflict
* If something blows up it could be because of this * If something blows up it could be because of this
*/ */
'LaravelEvent' => 'Illuminate\Support\Facades\Event', 'LaravelEvent' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File', 'File' => 'Illuminate\Support\Facades\File',
'Hash' => 'Illuminate\Support\Facades\Hash', 'Hash' => 'Illuminate\Support\Facades\Hash',
'Input' => 'Illuminate\Support\Facades\Input', 'Input' => 'Illuminate\Support\Facades\Input',
'Inspiring' => 'Illuminate\Foundation\Inspiring', 'Inspiring' => 'Illuminate\Foundation\Inspiring',
'Lang' => 'Illuminate\Support\Facades\Lang', 'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log', 'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail', 'Mail' => 'Illuminate\Support\Facades\Mail',
'Password' => 'Illuminate\Support\Facades\Password', 'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue', 'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect', 'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis', 'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request', 'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response', 'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route', 'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema', 'Schema' => 'Illuminate\Support\Facades\Schema',
'Session' => 'Illuminate\Support\Facades\Session', 'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage', 'Storage' => 'Illuminate\Support\Facades\Storage',
'URL' => 'Illuminate\Support\Facades\URL', 'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator', 'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View', 'View' => 'Illuminate\Support\Facades\View',
'Form' => 'Illuminate\Html\FormFacade', 'Form' => 'Illuminate\Html\FormFacade',
'HTML' => 'Illuminate\Html\HtmlFacade', 'HTML' => 'Illuminate\Html\HtmlFacade',
'Str' => 'Illuminate\Support\Str', 'Str' => 'Illuminate\Support\Str',
'Utils' => 'App\Attendize\Utils', 'Utils' => 'App\Attendize\Utils',
'Carbon' => 'Carbon\Carbon', 'Carbon' => 'Carbon\Carbon',
'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf', 'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf',
'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade', 'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade',
'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade', 'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade',
'Image' => 'Intervention\Image\Facades\Image', 'Image' => 'Intervention\Image\Facades\Image',
'Excel' => 'Maatwebsite\Excel\Facades\Excel', 'Excel' => 'Maatwebsite\Excel\Facades\Excel',
'Socialize' => 'Laravel\Socialite\Facades\Socialite', 'Socialize' => 'Laravel\Socialite\Facades\Socialite',
'HttpClient' => 'Vinelab\Http\Facades\Client', 'HttpClient' => 'Vinelab\Http\Facades\Client',
'Purifier' => 'Mews\Purifier\Facades\Purifier', 'Purifier' => 'Mews\Purifier\Facades\Purifier',
'Markdown' => 'MaxHoffmann\Parsedown\ParsedownFacade', 'Markdown' => 'MaxHoffmann\Parsedown\ParsedownFacade',
], ],

View File

@ -17,14 +17,14 @@ return [
'fallback_organiser_logo_url' => '/assets/images/logo-100x100-lightBg.png', 'fallback_organiser_logo_url' => '/assets/images/logo-100x100-lightBg.png',
'cdn_url' => '', 'cdn_url' => '',
'max_tickets_per_person' => 30, #Depreciated 'max_tickets_per_person' => 30, //Depreciated
'checkout_timeout_after' => 8, #mintutes 'checkout_timeout_after' => 8, //mintutes
'ticket_status_sold_out' => 1, '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_before_sale_date' => 3,
'ticket_status_on_sale' => 4, 'ticket_status_on_sale' => 4,
'ticket_status_off_sale' => 5, 'ticket_status_off_sale' => 5,
'ticket_booking_fee_fixed' => 0, 'ticket_booking_fee_fixed' => 0,
'ticket_booking_fee_percentage' => 0, 'ticket_booking_fee_percentage' => 0,
@ -34,14 +34,14 @@ return [
'order_partially_refunded' => 3, 'order_partially_refunded' => 3,
'order_cancelled' => 4, 'order_cancelled' => 4,
'default_timezone' => 30, #Europe/Dublin 'default_timezone' => 30, //Europe/Dublin
'default_currency' => 2, #Euro 'default_currency' => 2, //Euro
'default_date_format' => 'j M, Y', 'default_date_format' => 'j M, Y',
'default_date_picker_format' => 'd M, yyyy', 'default_date_picker_format' => 'd M, yyyy',
'default_datetime_format' => 'F j, Y, g:i a', 'default_datetime_format' => 'F j, Y, g:i a',
'default_query_cache' => 120, #Minutes 'default_query_cache' => 120, //Minutes
'default_locale' => 'en', 'default_locale' => 'en',
'cdn_url_user_assets' => '', 'cdn_url_user_assets' => '',
'cdn_url_static_assets' => '' 'cdn_url_static_assets' => '',
]; ];

View File

@ -2,66 +2,66 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Authentication Driver | Default Authentication Driver
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This option controls the authentication driver that will be utilized. | This option controls the authentication driver that will be utilized.
| This driver manages the retrieval and authentication of the users | This driver manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application. | attempting to get access to protected areas of your application.
| |
| Supported: "database", "eloquent" | Supported: "database", "eloquent"
| |
*/ */
'driver' => 'eloquent', 'driver' => 'eloquent',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Authentication Model | Authentication Model
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "Eloquent" authentication driver, we need to know which | When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it | 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. | is often just the "User" model but you may use whatever you like.
| |
*/ */
'model' => 'App\Models\User', 'model' => 'App\Models\User',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Authentication Table | Authentication Table
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "Database" authentication driver, we need to know which | When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic | 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. | default value but you may easily change it to any table you like.
| |
*/ */
'table' => 'users', 'table' => 'users',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Password Reset Settings | Password Reset Settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may set the options for resetting passwords including the view | 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 | 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. | 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 | The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so | considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed. | they have less time to be guessed. You may change this as needed.
| |
*/ */
'password' => [ 'password' => [
'email' => 'Emails.Auth.Reminder', 'email' => 'Emails.Auth.Reminder',
'table' => 'password_resets', 'table' => 'password_resets',
'expire' => 60, 'expire' => 60,
], ],
]; ];

View File

@ -1,5 +1,5 @@
<?php <?php
return [ return [
'store_path' => public_path("/"), 'store_path' => public_path('/'),
]; ];

View File

@ -2,78 +2,78 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Cache Store | Default Cache Store
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This option controls the default cache connection that gets used while | This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is | using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function. | not explicitly specified when executing a given caching function.
| |
*/ */
'default' => env('CACHE_DRIVER', 'file'), 'default' => env('CACHE_DRIVER', 'file'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Cache Stores | Cache Stores
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may define all of the cache "stores" for your application as | 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 | well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches. | same cache driver to group types of items stored in your caches.
| |
*/ */
'stores' => [ 'stores' => [
'apc' => [ 'apc' => [
'driver' => 'apc' 'driver' => 'apc',
], ],
'array' => [ 'array' => [
'driver' => 'array' 'driver' => 'array',
], ],
'database' => [ 'database' => [
'driver' => 'database', 'driver' => 'database',
'table' => 'cache', 'table' => 'cache',
'connection' => null, 'connection' => null,
], ],
'file' => [ 'file' => [
'driver' => 'file', 'driver' => 'file',
'path' => storage_path().'/framework/cache', 'path' => storage_path().'/framework/cache',
], ],
'memcached' => [ 'memcached' => [
'driver' => 'memcached', 'driver' => 'memcached',
'servers' => [ 'servers' => [
[ [
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
], ],
], ],
], ],
'redis' => [ 'redis' => [
'driver' => 'redis', 'driver' => 'redis',
'connection' => 'default', 'connection' => 'default',
], ],
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Cache Key Prefix | Cache Key Prefix
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When utilizing a RAM based store such as APC or Memcached, there might | 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 | 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. | value to get prefixed to all our keys so we can avoid collisions.
| |
*/ */
'prefix' => 'laravel', 'prefix' => 'laravel',
]; ];

View File

@ -2,40 +2,40 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Additional Compiled Classes | Additional Compiled Classes
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify additional classes to include in the compiled file | Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes | generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application. | that are included on basically every request into the application.
| |
*/ */
'files' => [ 'files' => [
realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'), realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'), realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'), realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'), realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'), realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'),
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Compiled File Providers | Compiled File Providers
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may list service providers which define a "compiles" function | Here you may list service providers which define a "compiles" function
| that returns additional files that should be compiled, providing an | that returns additional files that should be compiled, providing an
| easy way to get common files from any packages you are utilizing. | easy way to get common files from any packages you are utilizing.
| |
*/ */
'providers' => [ 'providers' => [
// //
], ],
]; ];

View File

@ -2,124 +2,124 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| PDO Fetch Style | PDO Fetch Style
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| By default, database results will be returned as instances of the PHP | By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an | stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style. | array format for simplicity. Here you can tweak the fetch style.
| |
*/ */
'fetch' => PDO::FETCH_CLASS, 'fetch' => PDO::FETCH_CLASS,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Database Connection Name | Default Database Connection Name
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify which of the database connections below you wish | Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course | to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library. | you may use many connections at once using the Database library.
| |
*/ */
'default' => 'mysql', 'default' => 'mysql',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Database Connections | Database Connections
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here are each of the database connections setup for your application. | Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is | Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple. | supported by Laravel is shown below to make development simple.
| |
| |
| All database work in Laravel is done through the PHP PDO facilities | All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of | so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development. | choice installed on your machine before you begin development.
| |
*/ */
'connections' => [ 'connections' => [
'sqlite' => [ 'sqlite' => [
'driver' => 'sqlite', 'driver' => 'sqlite',
'database' => storage_path().'/database.sqlite', 'database' => storage_path().'/database.sqlite',
'prefix' => '', 'prefix' => '',
], ],
'mysql' => [ 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => env('DB_HOST'), 'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'), 'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'), 'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'), 'password' => env('DB_PASSWORD'),
'charset' => 'utf8', 'charset' => 'utf8',
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'prefix' => '', 'prefix' => '',
'strict' => false, 'strict' => false,
], ],
'pgsql' => [ 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8', 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'schema' => 'public', 'schema' => 'public',
], ],
'sqlsrv' => [ 'sqlsrv' => [
'driver' => 'sqlsrv', 'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'prefix' => '', 'prefix' => '',
], ],
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Migration Repository Table | Migration Repository Table
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This table keeps track of all the migrations that have already run for | This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of | your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database. | the migrations on disk haven't actually been run in the database.
| |
*/ */
'migrations' => 'migrations', 'migrations' => 'migrations',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Redis Databases | Redis Databases
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Redis is an open source, fast, and advanced key-value store that also | 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 | 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. | such as APC or Memcached. Laravel makes it easy to dig right in.
| |
*/ */
'redis' => [ 'redis' => [
'cluster' => false, 'cluster' => false,
'default' => [ 'default' => [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'port' => 6379, 'port' => 6379,
'database' => 0, 'database' => 0,
], ],
], ],
]; ];

View File

@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -26,12 +26,12 @@ return array(
| can also be used. For PDO, run the package migrations first. | can also be used. For PDO, run the package migrations first.
| |
*/ */
'storage' => array( 'storage' => [
'enabled' => true, 'enabled' => true,
'driver' => 'file', // redis, file, pdo 'driver' => 'file', // redis, file, pdo
'path' => storage_path() . '/debugbar', // For file driver 'path' => storage_path().'/debugbar', // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO) 'connection' => null, // Leave null for default connection (Redis/PDO)
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -70,7 +70,7 @@ return array(
| |
*/ */
'collectors' => array( 'collectors' => [
'phpinfo' => true, // Php version 'phpinfo' => true, // Php version
'messages' => true, // Messages 'messages' => true, // Messages
'time' => true, // Time Datalogger 'time' => true, // Time Datalogger
@ -90,7 +90,7 @@ return array(
'config' => false, // Display config settings 'config' => false, // Display config settings
'auth' => false, // Display Laravel authentication status 'auth' => false, // Display Laravel authentication status
'session' => false, // Display session data in a separate tab 'session' => false, // Display session data in a separate tab
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -101,33 +101,33 @@ return array(
| |
*/ */
'options' => array( 'options' => [
'auth' => array( 'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar 'show_name' => false, // Also show the users name/email in the debugbar
), ],
'db' => array( 'db' => [
'with_params' => true, // Render SQL with the parameters substituted 'with_params' => true, // Render SQL with the parameters substituted
'timeline' => false, // Add the queries to the timeline 'timeline' => false, // Add the queries to the timeline
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files. '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, '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 'hints' => true, // Show hints for common mistakes
), ],
'mail' => array( 'mail' => [
'full_log' => false 'full_log' => false,
), ],
'views' => array( 'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large.. 'data' => false, //Note: Can slow down the application, because the data can be quite large..
), ],
'route' => array( 'route' => [
'label' => true // show complete route on bar 'label' => true, // show complete route on bar
), ],
'logs' => array( 'logs' => [
'file' => null 'file' => null,
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -142,4 +142,4 @@ return array(
'inject' => true, 'inject' => true,
); ];

View File

@ -1,8 +1,8 @@
<?php <?php
return array( return [
'cache' => array( 'cache' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -29,24 +29,24 @@ return array(
| Cache settings | Cache settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'settings' => array( 'settings' => [
'memoryCacheSize' => '32MB', 'memoryCacheSize' => '32MB',
'cacheTime' => 600 'cacheTime' => 600,
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Memcache settings | Memcache settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'memcache' => array( 'memcache' => [
'host' => 'localhost', 'host' => 'localhost',
'port' => 11211, 'port' => 11211,
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -54,10 +54,10 @@ return array(
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'dir' => storage_path('cache') 'dir' => storage_path('cache'),
), ],
'properties' => array( 'properties' => [
'creator' => 'Maatwebsite', 'creator' => 'Maatwebsite',
'lastModifiedBy' => 'Maatwebsite', 'lastModifiedBy' => 'Maatwebsite',
'title' => 'Spreadsheet', 'title' => 'Spreadsheet',
@ -67,35 +67,35 @@ return array(
'category' => 'Excel', 'category' => 'Excel',
'manager' => 'Maatwebsite', 'manager' => 'Maatwebsite',
'company' => 'Maatwebsite', 'company' => 'Maatwebsite',
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Sheets settings | Sheets settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'sheets' => array( 'sheets' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default page setup | Default page setup
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'pageSetup' => array( 'pageSetup' => [
'orientation' => 'portrait', 'orientation' => 'portrait',
'paperSize' => '9', 'paperSize' => '9',
'scale' => '100', 'scale' => '100',
'fitToPage' => false, 'fitToPage' => false,
'fitToHeight' => true, 'fitToHeight' => true,
'fitToWidth' => true, 'fitToWidth' => true,
'columnsToRepeatAtLeft' => array('', ''), 'columnsToRepeatAtLeft' => ['', ''],
'rowsToRepeatAtTop' => array(0, 0), 'rowsToRepeatAtTop' => [0, 0],
'horizontalCentered' => false, 'horizontalCentered' => false,
'verticalCentered' => false, 'verticalCentered' => false,
'printArea' => null, 'printArea' => null,
'firstPageNumber' => null, 'firstPageNumber' => null,
), ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -108,7 +108,7 @@ return array(
'creator' => 'Maatwebsite', 'creator' => 'Maatwebsite',
'csv' => array( 'csv' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Delimiter | 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 | Default sheet settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'sheets' => array( 'sheets' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -245,8 +245,8 @@ return array(
| Apply strict comparison when testing for null values in the 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 | Whether we want to return information about the stored file or not
| |
*/ */
'returnInfo' => false 'returnInfo' => false,
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| PDF Settings | PDF Settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'pdf' => array( 'pdf' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -298,48 +298,48 @@ return array(
| PDF Driver settings | PDF Driver settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'drivers' => array( 'drivers' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| DomPDF settings | DomPDF settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'DomPDF' => array( 'DomPDF' => [
'path' => base_path('vendor/dompdf/dompdf/') 'path' => base_path('vendor/dompdf/dompdf/'),
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| tcPDF settings | tcPDF settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'tcPDF' => array( 'tcPDF' => [
'path' => base_path('vendor/tecnick.com/tcpdf/') 'path' => base_path('vendor/tecnick.com/tcpdf/'),
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| mPDF settings | mPDF settings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'mPDF' => array( 'mPDF' => [
'path' => base_path('vendor/mpdf/mpdf/') 'path' => base_path('vendor/mpdf/mpdf/'),
), ],
) ],
) ],
), ],
'filters' => array( 'filters' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register read filters | Register read filters
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'registered' => array( 'registered' => [
'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' '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', '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 | Date columns
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'columns' => array() 'columns' => [],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Import sheets by config | 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 | Table headings
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'th' => array( 'th' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 12, 'size' => 12,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Strong tags | Strong tags
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'strong' => array( 'strong' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 12, 'size' => 12,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Bold tags | Bold tags
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'b' => array( 'b' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 12, 'size' => 12,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Italic tags | Italic tags
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'i' => array( 'i' => [
'font' => array( 'font' => [
'italic' => true, 'italic' => true,
'size' => 12, 'size' => 12,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 1 | Heading 1
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h1' => array( 'h1' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 24, 'size' => 24,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 2 | Heading 2
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h2' => array( 'h2' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 18, 'size' => 18,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 2 | Heading 2
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h3' => array( 'h3' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 13.5, 'size' => 13.5,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 4 | Heading 4
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h4' => array( 'h4' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 12, 'size' => 12,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 5 | Heading 5
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h5' => array( 'h5' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 10, 'size' => 10,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Heading 6 | Heading 6
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'h6' => array( 'h6' => [
'font' => array( 'font' => [
'bold' => true, 'bold' => true,
'size' => 7.5, 'size' => 7.5,
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Hyperlinks | Hyperlinks
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'a' => array( 'a' => [
'font' => array( 'font' => [
'underline' => true, 'underline' => true,
'color' => array('argb' => 'FF0000FF'), 'color' => ['argb' => 'FF0000FF'],
) ],
), ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Horizontal rules | Horizontal rules
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'hr' => array( 'hr' => [
'borders' => array( 'borders' => [
'bottom' => array( 'bottom' => [
'style' => 'thin', 'style' => 'thin',
'color' => array('FF000000') 'color' => ['FF000000'],
), ],
) ],
) ],
) ],
) ],
); ];

View File

@ -2,69 +2,69 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Filesystem Disk | Default Filesystem Disk
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify the default filesystem disk that should be used | 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 | by the framework. A "local" driver, as well as a variety of cloud
| based drivers are available for your choosing. Just store away! | based drivers are available for your choosing. Just store away!
| |
| Supported: "local", "s3", "rackspace" | Supported: "local", "s3", "rackspace"
| |
*/ */
'default' => 'local', 'default' => 'local',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Default Cloud Filesystem Disk | Default Cloud Filesystem Disk
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Many applications store files both locally and in the cloud. For this | Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver | reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container. | will be bound as the Cloud disk implementation in the container.
| |
*/ */
'cloud' => 's3', 'cloud' => 's3',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Filesystem Disks | Filesystem Disks
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may configure as many filesystem "disks" as you wish, and you | Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have | may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options. | been setup for each driver as an example of the required options.
| |
*/ */
'disks' => [ 'disks' => [
'local' => [ 'local' => [
'driver' => 'local', 'driver' => 'local',
'root' => public_path().'/user_content', 'root' => public_path().'/user_content',
], ],
's3' => [ 's3' => [
'driver' => 's3', 'driver' => 's3',
'key' => 'your-key', 'key' => 'your-key',
'secret' => 'your-secret', 'secret' => 'your-secret',
'region' => 'your-region', 'region' => 'your-region',
'bucket' => 'your-bucket', 'bucket' => 'your-bucket',
], ],
'rackspace' => [ 'rackspace' => [
'driver' => 'rackspace', 'driver' => 'rackspace',
'username' => 'your-username', 'username' => 'your-username',
'key' => 'your-key', 'key' => 'your-key',
'container' => 'your-container', 'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD', 'region' => 'IAD',
], ],
], ],
]; ];

View File

@ -1,6 +1,6 @@
<?php <?php
return array( return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -15,6 +15,6 @@ return array(
| |
*/ */
'driver' => 'gd' 'driver' => 'gd',
); ];

View File

@ -2,123 +2,123 @@
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Mail Driver | Mail Driver
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Laravel supports both SMTP and PHP's "mail" function as drivers for the | 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 | sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail. | your application here. By default, Laravel is setup for SMTP mail.
| |
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log" | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
| |
*/ */
'driver' => env('MAIL_DRIVER', 'mail'), 'driver' => env('MAIL_DRIVER', 'mail'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| SMTP Host Address | SMTP Host Address
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may provide the host address of the SMTP server used by your | Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with | applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries. | 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 | SMTP Host Port
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This is the SMTP port used by your application to deliver e-mails to | 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 | users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default. | stay compatible with the Mailgun e-mail application by default.
| |
*/ */
'port' => env('MAIL_PORT', 587), 'port' => env('MAIL_PORT', 587),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Global "From" Address | Global "From" Address
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| You may wish for all e-mails sent by your application to be sent from | 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 | 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. | 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 | E-Mail Encryption Protocol
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify the encryption protocol that should be used when | Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the | the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security. | transport layer security protocol should provide great security.
| |
*/ */
'encryption' => env('MAIL_ENCRYPTION','tls'), 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| SMTP Server Username | SMTP Server Username
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| If your SMTP server requires a username for authentication, you should | If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on | set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one. | connection. You may also set the "password" value below this one.
| |
*/ */
'username' => env('MAIL_USERNAME'), 'username' => env('MAIL_USERNAME'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| SMTP Server Password | SMTP Server Password
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may set the password required by your SMTP server to send out | 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 | messages from your application. This will be given to the server on
| connection so that the application will be able to send messages. | connection so that the application will be able to send messages.
| |
*/ */
'password' => env('MAIL_PASSWORD'), 'password' => env('MAIL_PASSWORD'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Sendmail System Path | Sendmail System Path
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "sendmail" driver to send e-mails, we will need to know | 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 | 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. | been provided here, which will work well on most of your systems.
| |
*/ */
'sendmail' => '/usr/sbin/sendmail -bs', 'sendmail' => '/usr/sbin/sendmail -bs',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Mail "Pretend" | Mail "Pretend"
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When this option is enabled, e-mail will not actually be sent over the | 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 | web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development. | you may inspect the message. This is great for local development.
| |
*/ */
'pretend' => false, 'pretend' => false,
]; ];

Some files were not shown because too many files have changed in this diff Show More