@tisuchi
class GoogleController extends Controller
{
//
// private $event;
private $summary;
private $location;
private $description;
public $start_time;
public $end_time;
private $timezone;
private $event_creator_email;
private $booker_email;
public function oauth(){
//all my properties are null here
dd($this->location); //null
$uuid = Str::uuid();
$url = "http:://127.0.0.1:8000/schedules/".$uuid."/";
$event = new Event(array(
'summary' => $this->summary, #topic
'location' => $this->location, #location
'description' => $this->description . ' ' . $url, #description
'start' => array(
'dateTime' => Carbon::createFromFormat('Y-m-d H:i',$this->start_time), #datetime
'timeZone' => $this->timezone, #timezone
),
'end' => array(
'dateTime' => Carbon::createFromFormat('Y-m-d H:i', $this->end_time), #added time like 30 mins
'timeZone' => $this->timezone, #timezone
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=1'
),
'attendees' => array(
array('email' => $this->event_creator_email), #event_creator email
array('email' => $this->booker_email), #booker email
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
}
public function client(AppEvent $event){
$this->start_time = $event->booking->booking_date . ' ' . $event->booking->start_time;
$this->end_time = $event->booking->booking_date . ' ' . $event->booking->end_time;
// dd($this->start_time); #right
$this->summary = $event->eventname;
$this->description = $event->description;
$this->location = $event->bookingdetail->location;
$this->timezone = $event->bookingevent->timezone;
$this->event_creator_email = $event->user->email;
$this->booker_email = $event->bookingdetail->email;
// dd($this->start_time, $this->end_time, $this->summary, $this->description, $this->location, $this->timezone, $this->event_creator_email, $this->booker_email);
$client = new Google_Client();
$client->setAuthConfig(public_path('files/client_secret_68036643521-8ujgf4t0pndql4usb2qneori0ftg1htn.apps.googleusercontent.com.json'));
$client->addScope(Calendar::CALENDAR);
$client->setRedirectUri('http://127.0.0.1:8000/oauth2callback.php');
// offline access will give you both an access and refresh token so that
// your app can refresh the access token without user interaction.
$client->setAccessType('offline');
// Using "consent" ensures that your application always receives a refresh token.
// If you are not using offline access, you can omit this.
$client->setPrompt('consent');
$client->setIncludeGrantedScopes(true);
$email = Auth::user()->email;
$client->setLoginHint($email);
// $client->setApprovalPrompt('consent');
$auth_url = $client->createAuthUrl();
// dd(filter_var($auth_url, FILTER_SANITIZE_URL));
return redirect(filter_var($auth_url, FILTER_SANITIZE_URL));
}
This is the issue in the client method it is okay but in the oauth method alll the properties are null. What can be the issue.