tundeogunde

tundeogunde

Member Since 1 Year Ago

Experience Points 360
Experience Level 1

4,640 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

05 Jan
1 year ago

tundeogunde left a reply on Why Do I Get This Error - Trying To Get Property Of Non-object

Thanks a lot @Snapey and @kobear.

@Snapey, you're right about coding defensively; I tried your example, though it gave me an error about an unexpected '?'. However the approach of @kobear worked perfect.

The lesson learnt is to code defensively. I do appreciate your help and suggestions.

12 Dec
1 year ago

tundeogunde left a reply on Why Do I Get This Error - Trying To Get Property Of Non-object

Hi JackJones,

Please could you make your comment clearer? I'm probably using the wrong word "object". But what I mean is

  • in my view if I exclude {{$enrolment->event->title}} I still get an error.
  • in my view if exclude {{$enrolment->enrollee->surname}} I don't get any error anymore
  • if I change the {{$enrolment->enrollee->surname}} to {{$enrolment->enrollee->id}} I don't get an error but displays just the enrollee id

I'm a bit new to this, I'd appreciate a bit more clarity ; thanks.

tundeogunde started a new conversation Why Do I Get This Error - Trying To Get Property Of Non-object

I use Laravel 5.4

While displaying a particular view I keep getting the Error – “Trying to get property of non-object (View: C:\xampp\htdocs\enrolpad-lar\resources\views\enrolment\test.blade.php)”

Here’s a snippet of my view

@extends('layout.organizer_title_master')
@section('body')
    <div id="main-content">
        <div class="box-outer container">
            <div class="row">
                    <div id="messageAlert" class="col-md-12 alert alert-success text-center" role="alert" style="display: none;"></div>
                    <div class="col-md-4 page-container animate-box">
                        
                   </div>
                                    
                   <div class="col-md-8 page-container animate-box">
                        
                        <div class="white-container contact-box">
                            
                            @foreach ($enrolments as $enrolment)
                                <div class="row">                                   
                                    {{$enrolment->enrollee->surname}}<br>{{$enrolment->event->title}}
                                </div><hr>
                            @endforeach
                        </div>                      
                   </div>
            </div>
        </div>
    </div>    
@endsection
19 Oct
1 year ago

tundeogunde started a new conversation How Do I Implement Authorization And Roles For Application Admin

I use Laravel 5.4.

My application serves users that I call organizers; organizers have to login to use the application; Auth for organizers have been implemented and working.

I wish to implement Auth for Administrators and with this I also have to define roles and access levels for different administrators. How do I do this please. Is there any resource, link or tutorial that explains this?

16 Oct
1 year ago

tundeogunde left a reply on How Do I Give Public Access To Part Of A Controller Function

Thank you Snapey.

You are right about your comment - "You have to think that the callback is a totally standalone session. It is not part of the transactions you are having with the user, its a completely independent request.".

I took this approach and it worked for me. Thanks a lot for opening my eyes to this. I do appreciate.

15 Oct
1 year ago

tundeogunde started a new conversation How Do I Give Public Access To Part Of A Controller Function

I am using Laravel 5.4.

For my payment Controller file, I need to create a function to handle the payment Gateway Callback. The same payment Gateway Callback will handle Callback for payments made by Authorized users for subscription and by public users for other services.

My PaymentController contains the follwing:

public function __construct()
    {
        $this->middleware('auth:user');
    }

public function handleGatewayCallback()
{
    if($payer == 'user') {
       $user = Auth::user(); // Get the user's details
        $organizer = Organizer::find($user->id);
        ....procedure-1
    } else if($payer == 'public') {
        ....procedure-2
    }
}

The problem I encounter is that the code above will not execute the "else if" block if the payer is a public user; but it will execute the "if" block perfectly.

If I change the construct to

public function __construct()
    {
        $this->middleware('auth:user', ['except' => ['handleGatewayCallback']]);
    }

the "if" block will display the exception error "Trying to get property of non-object" while executing; while the "else if" block will execute perfectly.

How can I get both the "if" and the "else if" blocks to work when their conditions are true?

17 Aug
1 year ago

tundeogunde left a reply on How Do I Send Email To Multiple Recipients From A Single Email Form?

Thanks a lot Gator. It worked. I do appreciate.

Regards

16 Aug
1 year ago

tundeogunde started a new conversation How Do I Send Email To Multiple Recipients From A Single Email Form?

I am using Laravel 5.4. I have a contact form displayed in a Bootstrap Modal. Using JavaScript, the email recipients input box is populated and separated with commas. When I click the send button, no email is sent. However, if the input box has just one recipient the email is sent and works perfectly.

Below is my Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\enrolment;
use App\enrollee;
use App\event;
use Illuminate\Support\Facades\Mail;
use Auth;
use Session;
use Carbon\Carbon;
use Illuminate\Support\Facades\Validator;
use App\Mail\eventEnrolled;
use App\Mail\emailToEnrollee;
use Illuminate\Support\Facades\DB;

class enrolmentController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth:organizer', ['except' => ['processenrolment', 'storeenrolment']]);
    }
    
    public function emailtoenrollee(Request $request)
    {
        $user = Auth::user();
        $event = Event::find($request->event_id);
        $event->senderEmail = $user->email;
        $event->senderName = $user->name;
        $event->message = $request->message;
        $event->email = $request->email;        
        $event->subject = $request->subject;  
        
        // Send email the mail to the Enrollee 
        Mail::send(new emailToEnrollee($event));
    }
}

When the recipients are more than one, the $request->email contains comma separated email addresses. Here's my Mailable

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class emailToEnrollee extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($event)
    {
        //
        $this->event = $event;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from($this->event->senderEmail, $this->event->senderName)->subject($this->event->subject)->to($this->event->email)->markdown('emails.emailToEnrollee')->with([
                'message' => $this->event->message,
                'sender' => $this->event->senderName,
                'subject' => $this->event->subject,
            ]);        
    }
}

How do I get my code to send to more than one comma separated email addresses from my form?

Thanks in advance

09 Aug
1 year ago

tundeogunde left a reply on How Do I Send Mail From A Bootstrap Modal Form?

I've found out the problem. I had left out the following in my controller; that explains why email was not sent. My mistake.

use App\Mail\emailToEnrollee;

Thank you.

tundeogunde started a new conversation How Do I Send Mail From A Bootstrap Modal Form?

I am using Laravel 5.4. I have a contact form displayed in a modal. I wish visitors to fill this form, click on the button and the email sent to the receiving email. I have also written javascript code that retrieves data from the form and post to my controller.

Below is my controller code

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\enrolment;
use App\enrollee;
use App\event;
use Illuminate\Support\Facades\Mail;
use Auth;
use Session;
use Carbon\Carbon;
use Illuminate\Support\Facades\Validator;
use App\Mail\eventEnrolled;
use Illuminate\Support\Facades\DB;

class enrolmentController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth:organizer', ['except' => ['processenrolment', 'storeenrolment']]);
    }
    
    public function emailtoenrollee(Request $request)
    {
        $user = Auth::user();
        $event = Event::find($request->event_id);
        $event->senderEmail = $user->email;
        $event->senderName = $user->name;
        $event->message = $request->message;
        $event->email = $request->email;
        $event->subject = $request->subject;      

        return $event;
        
        // Send email the mail to the Enrollee 
        Mail::send(new emailToEnrollee($event));
    }
    
}

When I comment out the Mail function so that the data object will be displayed, I get the desired output in my javascript console. However when I uncomment the Mail function, no email is sent and no output is displayed on the console. Below is the code for my Mailable emailToEnrollee.php

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class emailToEnrollee extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($event)
    {
        //
        $this->event = $event;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from($this->event->senderEmail, $this->event->senderName)->subject($this->event->subject)->to($this->event->email)->markdown('emails.emailToEnrollee')->with([
                'message' => $this->event->message,
                'sender' => $this->event->senderName,
                'subject' => $this->event->subject,
            ]);        
    }
}

Below is my emailToEnrollee.blade.php markdown

@component('mail::message')
# {{$subject}}

{{$message}}

{{$sender}}<br><br>

{{ config('app.name') }}
@endcomponent

Is there something am doing wrong? Or is there a better way to send email from a form displayed on a Bootstrap Modal?

23 Jul
1 year ago

tundeogunde left a reply on Error While Passing Variable To Where Clause On Join

Thanks a lot tykus; it worked! I never knew I had to pass the $request. New lesson learnt!!!

tundeogunde started a new conversation Error While Passing Variable To Where Clause On Join

I am trying to retrieve records from a simple search form. The search string is to search through a join of 2 tables; enrolments table and enrollees table joined on enrollee_id. The search should search for the string in the name fields of the enrollees table and return details of the enrolments by enrollees who satisfy the search criteria.

public function search_for_enrolment(Request $request, $id) { $enrolments = Enrolment::where('event_id','=',$id)->join('enrollees','enrollees.id','=','enrolments.enrollee_id')->where(function($query) { $query->where('enrollees.firstname','=',$request->searchString)->orWhere('enrollees.othernames','=',$request->searchString)->orWhere('enrollees.surname','=',$request->searchString); })->get();

return view('enrolment.show_event_enrolments', compact('enrolments'));

}

The error I get is "Undefined variable: request"

However, if I test with a defined string; if I replace $request->searchString with 'John' , I get the desired output.

Am I doing something wrong?