Commit f31f7b88 by fezrul

update for poc

parent 64cc8306
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class EventAttendance extends Model
{
//
protected $table = 'event_attendance';
protected $fillable = ['id','fk_master_event','fk_event_participant','time'];
}
\ No newline at end of file
...@@ -8,6 +8,8 @@ use App\MasterEvent; ...@@ -8,6 +8,8 @@ use App\MasterEvent;
use Cookie; use Cookie;
use App\EventParticipant; use App\EventParticipant;
use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Redirect;
use PDF;
use QrCode;
class EventPageController extends Controller class EventPageController extends Controller
{ {
...@@ -41,7 +43,35 @@ class EventPageController extends Controller ...@@ -41,7 +43,35 @@ class EventPageController extends Controller
$qrcode = Cookie::get('qrcode'); $qrcode = Cookie::get('qrcode');
$email = Cookie::get('email'); $email = Cookie::get('email');
$invcode = Cookie::get('invcode'); $invcode = Cookie::get('invcode');
$inv_status = Cookie::get('inv_status');
$notice = ''; $notice = '';
// dd($inv_status);
if($inv_status !== null){
// dd('yesy');
if($inv_status == 0)
{
$info = EventParticipant::where('email', $email)->where('fk_master_event',$eventid)->first();
$name = $info->fullname;
return view('event.action',compact('eventid','notice','inv_status','email','invcode','name'));
}else{
$notice = 'You Have Rejected this invitation';
return view('event.reject',compact('eventid','notice'));
}
}else{
// return redirect::to('/');
if($message == null){$notice = '';}else{$notice = $message;} if($message == null){$notice = '';}else{$notice = $message;}
if($session == null){ if($session == null){
...@@ -63,6 +93,8 @@ class EventPageController extends Controller ...@@ -63,6 +93,8 @@ class EventPageController extends Controller
} }
}
...@@ -84,9 +116,56 @@ class EventPageController extends Controller ...@@ -84,9 +116,56 @@ class EventPageController extends Controller
} }
public function action($slug,$email)
{
// dd($slug);
$validate = MasterEvent::where('end_date','>',date('Y-m-d'))->where('event_slug',$slug)->first();
if($validate)
{
$info = EventParticipant::where('email', $email)->where('fk_master_event',$validate->id)->first();
if($info->acceptance_status == 1){
return redirect::to('page/detail/'.$slug.'/')->withCookie(cookie('email', $email,60))->withCookie(cookie('invitation', $info->id,1));
}else if($info->acceptance_status == 0){
return redirect::to('/event/'.$slug)->withCookie(cookie('inv_status', '0',0.2))->withCookie(cookie('email', $email,0.2))->withCookie(cookie('invitation', '1',0.2))->withCookie(cookie('invcode', $info->invitation_code,0.2));
}else{
return redirect::to('/event/'.$slug)->withCookie(cookie('message', 'You Have Rejected The Invitation',0.2))->withCookie(cookie('inv_status', '2',0.2));
}
}else{
return redirect::to('/event/'.$slug)->withCookie(cookie('message', 'The Event that you are invited has endded',60));
}
}
public function qrscan($slug,$email,$invcode) public function qrscan($slug,$email,$invcode)
{ {
// dd('slug:'.$slug.',email:'.$email.',code:'.$invcode); // dd('slug:'.$slug.',email:'.$email.',code:'.$invcode);
// if (Auth::guest())
// {
// dd('not login');
// }else{
// // dd('login');
// $user = Auth::user();
// $uid = $user->id;
// $event = MasterEvent::where('fk_user',$uid)->get();
// return view('admin.show', compact('event'));
// }
$event = MasterEvent::where('event_slug', $slug)->first(); $event = MasterEvent::where('event_slug', $slug)->first();
if($event) if($event)
...@@ -96,21 +175,73 @@ class EventPageController extends Controller ...@@ -96,21 +175,73 @@ class EventPageController extends Controller
$message = Cookie::get('message'); $message = Cookie::get('message');
$notice = ''; $notice = '';
if($message == null){$notice = '';}else{$notice = $message;} if($message == null){$notice = '';}else{$notice = $message;}
if (Auth::guest())
{
if($session == null)
{
if($session == null){
return redirect::to('/event/'.$slug)->withCookie(cookie('qrcode', 1,1))->withCookie(cookie('email', $email,1))->withCookie(cookie('invcode', $invcode,1)); $info = EventParticipant::where('email', $email)->where('fk_master_event',$eventid)->first();
if($info)
{
if($info->acceptance_status == 1)
{
return redirect::to('page/detail/'.$slug.'/')->withCookie(cookie('email', $email,60))->withCookie(cookie('invitation', $info->id,1));
}else if($info->acceptance_status == 0)
{
return redirect::to('/event/'.$slug)->withCookie(cookie('inv_status', '0',0.2))->withCookie(cookie('email', $email,0.2))->withCookie(cookie('invitation', '1',0.2))->withCookie(cookie('invcode', $info->invitation_code,0.2));
}else{
return redirect::to('/event/'.$slug)->withCookie(cookie('message', 'You Have Rejected The Invitation',0.2))->withCookie(cookie('inv_status', '2',0.2));
}
}else{
return redirect::to('/event/'.$slug)->withCookie(cookie('message', 'You are not in the guess list',0.2));
}
}else{ }else{
$info = EventParticipant::where('id', $session)->first(); $info = EventParticipant::where('id', $session)->first();
return redirect::to('/event/detail/'.$slug); return redirect::to('/event/detail/'.$slug);
// return view('detail.index',compact('eventid','info')); }
}else
{
$user = Auth::user();
$uid = $user->id;
$event = MasterEvent::where('fk_user', $uid)->first();
if($event)
{
$info = EventParticipant::where('email', $email)->where('fk_master_event',$eventid)->first();
if($info)
{
$message='';
return view('detail.adminaction',compact('eventid','slug','info','message'));
}else{
$message = 'The guest that you scan is not in your event guest list';
return view('detail.noaction',compact('eventid','slug','message'));
}
}else
{
$message = 'You are not the admin for this guess event';
return view('detail.noaction',compact('eventid','slug','message'));
} }
}
}else{ }else{
...@@ -121,9 +252,11 @@ class EventPageController extends Controller ...@@ -121,9 +252,11 @@ class EventPageController extends Controller
} }
public function detail($slug) public function detail($slug)
{ {
$session = Cookie::get('invitation'); $session = Cookie::get('invitation');
$event = MasterEvent::where('event_slug', $slug)->first(); $event = MasterEvent::where('event_slug', $slug)->first();
$eventid = $event->id; $eventid = $event->id;
...@@ -138,13 +271,69 @@ class EventPageController extends Controller ...@@ -138,13 +271,69 @@ class EventPageController extends Controller
$info = EventParticipant::where('id', $session)->first(); $info = EventParticipant::where('id', $session)->first();
// return redirect::to('/event/'.$slug.'/detail'); // return redirect::to('/event/'.$slug.'/detail');
return view('detail.index',compact('eventid','info')); return view('detail.index',compact('eventid','info','slug'));
} }
// dd($res2); // dd($res2);
} }
public function download($slug)
{
$session = Cookie::get('invitation');
$event = MasterEvent::where('event_slug', $slug)->first();
$eventid = $event->id;
if($session == null){
$notice = 'Your Session is expired';
return redirect::to('/event/'.$slug)->withCookie(cookie('message', $notice,1));
// return view('event.index',compact('eventid','notice'));
}else{
$info = EventParticipant::where('id', $session)->first();
// return redirect::to('/event/'.$slug.'/detail');
return view('detail.download',compact('eventid','info','slug'));
}
// dd($res2);
}
public function downloadpdf($slug)
{
$session = Cookie::get('invitation');
$event = MasterEvent::where('event_slug', $slug)->first();
$eventid = $event->id;
if($session == null){
$notice = 'Your Session is expired';
return redirect::to('/event/'.$slug)->withCookie(cookie('message', $notice,1));
}else{
$info = EventParticipant::where('id', $session)->first();
$create =QrCode::format('png')->size(275)->generate(url('event/qrscan/'.$slug.'/'.$info->email.'/'.$info->invitation_code),'qrcode/'.$session.'.png');
$pdf = PDF::loadView('detail.pdfdownload', compact('info','slug','eventid'));
return $pdf->stream( 'invitation-digital-pass.pdf');
// return view('detail.download',compact('eventid','info','slug'));
}
// dd($res2);
}
public function findevent($slug) public function findevent($slug)
{ {
......
...@@ -11,8 +11,11 @@ use Illuminate\Http\Request; ...@@ -11,8 +11,11 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response as res; use Illuminate\Http\Response as res;
use App\MasterEvent; use App\MasterEvent;
use App\EventParticipant; use App\EventParticipant;
use App\EventAttendance;
use App\Users; use App\Users;
use Cookie; use Cookie;
use Mail;
use DB;
class HomeController extends Controller class HomeController extends Controller
...@@ -95,17 +98,21 @@ class HomeController extends Controller ...@@ -95,17 +98,21 @@ class HomeController extends Controller
$user = Auth::user(); $user = Auth::user();
$uid = $user->id; $uid = $user->id;
$events = MasterEvent::where('fk_user',$uid)->first(); $events = MasterEvent::where('fk_user',$uid)->first();
$msg = Cookie::get('gms');
$notice = '';
if($msg == null){$notice = '';}else{$notice = $msg;}
$event = EventParticipant::where('fk_master_event',$events->id)->get(); $event = EventParticipant::where('fk_master_event',$events->id)->get();
return view('admin.guest', compact('event')); return view('admin.guest', compact('event','notice'));
} }
} }
public function attendance($id) public function attendancelist()
{ {
if (Auth::guest()) if (Auth::guest())
...@@ -116,17 +123,57 @@ class HomeController extends Controller ...@@ -116,17 +123,57 @@ class HomeController extends Controller
}else{ }else{
// dd('login');
$user = Auth::user(); $user = Auth::user();
$uid = $user->id; $uid = $user->id;
$event = MasterEvent::where('id',$id)->first(); $events = MasterEvent::where('fk_user',$uid)->first();
// dd($event); $eventid = $events->id;
$list = DB::SELECT("SELECT a.*,b.time FROM event_participant a,event_attendance b WHERE b.`fk_event_participant` = a.`id` and a.fk_master_event = $eventid");
return view('admin.list', compact('events','list'));
return view('admin.scan', compact('event'));
}
} }
public function attendance($id,$eventid)
{
$attendance = new EventAttendance;
$attendance->fk_master_event = $eventid;
$attendance->fk_event_participant = $id;
$attendance->time = date('Y-m-d H:i:s');
$attendance->save();
$info = EventParticipant::where('id', $id)->where('fk_master_event',$eventid)->first();
$event = MasterEvent::where('id', $eventid)->first();
$slug = $event->event_slug;
$message='Guest Attendance successfully taken';
return view('admin.attendance.adminaction',compact('eventid','slug','info','message'));
}
public function goodies($id,$eventid)
{
$info = EventParticipant::where('id', $id)->where('fk_master_event',$eventid)->first();
$info->goodies_status = 1;
$info->save();
$event = MasterEvent::where('id', $eventid)->first();
$slug = $event->event_slug;
$message='Guest has recieved the Goodies ';
return view('admin.attendance.adminaction',compact('eventid','slug','info','message'));
} }
...@@ -147,6 +194,54 @@ class HomeController extends Controller ...@@ -147,6 +194,54 @@ class HomeController extends Controller
} }
public function addguest(Request $request) {
$user = Auth::user();
$uid = $user->id;
$events = MasterEvent::where('fk_user',$uid)->first();
$check = EventParticipant::where('email',$request->email)->first();
if($check)
{
return redirect::to('/guest')->withCookie(cookie('gms', 'Guest Email is already used in this event',0.05));
}else
{
$InvCode = str_random(5);
$guestadd = new EventParticipant;
$guestadd->fk_master_event= $events->id;
$guestadd->fullname=$request->name;
$guestadd->email=$request->email;
$guestadd->phone = $request->phone;
$guestadd->address = $request->address;
$guestadd->invitation_code = $InvCode;
$guestadd->invitation_status = 1;
$guestadd->acceptance_status = 0;
$guestadd->save();
$uevent = $events->event_name;
$uemail = $request->email;
$uname = $request->name;
Mail::send('admin.email.invite', array('name' => $uname,'slug' => $events->event_slug,'eventname' => $events->event_name,'uemail' => $uemail), function ($message) use ($uemail,$uevent){
$message->from('myevent@gmail.com', 'MyEvent');
$message->to($uemail)->subject('Invitation for :'.$uevent.'');
});
return redirect::to('/guest')->withCookie(cookie('gms', 'Successfully add a guest',0.05));
}
}
public function editevent($id) public function editevent($id)
{ {
......
...@@ -13,6 +13,7 @@ use App\MasterEvent; ...@@ -13,6 +13,7 @@ use App\MasterEvent;
use App\EventParticipant; use App\EventParticipant;
use App\Users; use App\Users;
use Cookie; use Cookie;
use Mail;
class InvitationController extends Controller class InvitationController extends Controller
...@@ -40,24 +41,69 @@ class InvitationController extends Controller ...@@ -40,24 +41,69 @@ class InvitationController extends Controller
{ {
$validate = MasterEvent::where('end_date','>',date('Y-m-d'))->where('id',$request->evenid)->first();
$validate = MasterEvent::where('end_date','>',date('Y-m-d'))->where('id',$request->evenid)->first();
if($validate) if($validate)
{ {
$data = EventParticipant::where('invitation_code', $request->name)->where('fk_master_event',$request->evenid)->where('email',$request->email)->first(); $data = EventParticipant::where('invitation_code', $request->name)->where('fk_master_event',$request->evenid)->where('email',$request->email)->first();
if($data){ if($data)
{
if($data->acceptance_status == 1)
{
return redirect::to('page/detail/'.$validate->event_slug)->withCookie(cookie('invitation', $data->id,5));
}else if($data->acceptance_status == 0)
{
if($request->actionid == 1)
{
$data->acceptance_status = 1; $data->acceptance_status = 1;
$data->save(); $data->save();
return redirect::to('/event/'.$validate->event_slug)->withCookie(cookie('invitation', $data->id,5)); $uevent = $validate->event_name;
$uemail = $request->email;
$uname = $data->fullname;
Mail::send('admin.email.accept', array('name' => $uname,'slug' => $validate->event_slug,'eventname' => $uevent,'uemail' => $uemail,'invcode' =>$data->invitation_code), function ($message) use ($uemail,$uevent){
$message->from('myevent@gmail.com', 'MyEvent');
$message->to($uemail)->subject('Acceptance for :'.$uevent.'');
});
return redirect::to('download/detail/'.$validate->event_slug)->withCookie(cookie('invitation', $data->id,5));
}else if($request->actionid == 2)
{
$data->acceptance_status = 2;
$data->save();
return redirect::to('/event/'.$validate->event_slug)->withCookie(cookie('message', 'You Have Rejected The Invitation',0.1))->withCookie(cookie('inv_status', '2',0.1));
}else{ }else{
return redirect::to('/event/'.$validate->event_slug)->withCookie(cookie('inv_status', '0',0.2))->withCookie(cookie('email', $request->email,0.2))->withCookie(cookie('invitation', '1',0.2))->withCookie(cookie('invcode', $data->invitation_code,0.2));
}
}else
{
return redirect::to('/event/'.$validate->event_slug)->withCookie(cookie('message', 'You Have Rejected The Invitation',0.1))->withCookie(cookie('inv_status', '2',0.1));
}
}else
{
$qrcode = Cookie::get('qrcode'); $qrcode = Cookie::get('qrcode');
if($qrcode == 1){ if($qrcode == 1){
...@@ -72,12 +118,6 @@ class InvitationController extends Controller ...@@ -72,12 +118,6 @@ class InvitationController extends Controller
} }
}else{ }else{
// dd('The Event that you are invited has endded'); // dd('The Event that you are invited has endded');
......
...@@ -26,6 +26,9 @@ class AppServiceProvider extends ServiceProvider ...@@ -26,6 +26,9 @@ class AppServiceProvider extends ServiceProvider
$menu->add('Guest Details', 'guest') $menu->add('Guest Details', 'guest')
->active('') ->active('')
->data('icon', 'fa fa-users'); ->data('icon', 'fa fa-users');
$menu->add('Attendance', 'attendancelist')
->active('')
->data('icon', 'fa fa-users');
} }
} }
......
...@@ -72,6 +72,13 @@ return [ ...@@ -72,6 +72,13 @@ return [
*/ */
'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
......
...@@ -21,6 +21,7 @@ class CreateEventParticipantTable extends Migration ...@@ -21,6 +21,7 @@ class CreateEventParticipantTable extends Migration
$table->string('invitation_code'); $table->string('invitation_code');
$table->unsignedInteger('invitation_status'); $table->unsignedInteger('invitation_status');
$table->unsignedInteger('acceptance_status'); $table->unsignedInteger('acceptance_status');
$table->unsignedInteger('goodies_status');
$table->nullableTimestamps(); $table->nullableTimestamps();
}); });
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment