Nana-Odai

Nana-Odai

Member Since 1 Year Ago

Experience Points
1,760
Total
Experience

3,240 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
3
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
1,760 XP
Jul
06
1 month ago
Jun
30
1 month ago
Activity icon

Started a new Conversation How To Replace Part Of The View With New Result Or View Using Ajax

I want to change the result in the table when any option in the drop down is selected. link to image https://i.stack.imgur.com/0RmPW.png

View:

<div class="tab-content" id="myTabContent">
        @include('invoices.invoice-table')
</div>

Controller:

 $invoices = Invoice::where('slug', $request->slug)->paginate(15);
  $html =  view('invoices.invoice-table', compact('invoices'))->render();

  return response()->json(compact('html'));

Ajax code:

$(function($){
            $(document).on('change', '#select-customer', function(){
                let cust =  $(this).val();
                $.ajax({
                    url: '/invoices/search',
                    type: 'post',
                    dataType:'json',
                    data:{slug:cust, _token:'{{ csrf_token() }}'},
                    success: function(data){
                        $("#myTabContent").html(data.html);
                    }
                });
            })
        })
Apr
26
3 months ago
Activity icon

Replied to Call To A Member Function Swap() On Null - Laravel Cashier Subscription

The issue now is I get the error No such plan: Premium But I have the plan too in stripe

Activity icon

Replied to Call To A Member Function Swap() On Null - Laravel Cashier Subscription

I want to check if user is subscribed, then swap, else create the subscription. When I move the swap inside the if and newsubscription inside the else, I get no such plan: premium

Activity icon

Started a new Conversation Call To A Member Function Swap() On Null - Laravel Cashier Subscription

I am creating a subscription using laravel cashier and stripe. I am not using the user model, but using employer model. I have added the billable trait, set CASHIER_MODEL=App\Employer in my .env. Done all that is required but I get below error when making payments.

Call to a member function swap() on null

My codes

try {

	// get plan
	$plan = Plan::where('slug', $request->slug)->first();
			
	$getEmployer = auth('employer')->user(); 

	$stripeCustomer = $getEmployer->createOrGetStripeCustomer();

	$updateStripeCustomer =  $getEmployer->updateStripeCustomer([
			'name' => $getEmployer->fname ." " .$getEmployer->lname,
			'email' => $getEmployer->email,
			'phone' => $getEmployer->phone,
		]);
			
	// get paymentMethod
	$paymentMethod = $request->paymentMethod;

	if ($getEmployer->hasDefaultPaymentMethod()) {
		$getEmployer->updateDefaultPaymentMethod($paymentMethod);
	}else{
		$getEmployer->addPaymentMethod($paymentMethod);
	}

	// check if user is already subscribed, then swap
	if ($getEmployer->subscribed('main')) {
		// charge if new subscriber
		$charge =  $getEmployer->newSubscription('main', $plan->stripe_plan)->create($paymentMethod, [
					'email' => $getEmployer->email,
				]);

		// save new subscription status
		$getEmployer->plan_id = $plan->id;
		$getEmployer->save();

      		 // Mail
		event(new SubscriptionMail($getEmployer));

		\Session::flash('success', 'You have upgraded to the '.$plan->plan_type.' plan');
		return redirect()->route('employer.dashboard');
				
	}else{

		$getEmployer->subscription('main')->swap($plan->stripe_plan);
		event(new SubscriptionMail($getEmployer));

		\Session::flash('success', 'You have changed to the '.$plan->plan_type.' plan');
		return redirect()->route('employer.dashboard');
		}
} catch (\Exception $e) {
	\Session::flash('error',$e->getMessage());
return back();
} 
Apr
23
3 months ago
Activity icon

Started a new Conversation I Need Clarification On Cashier Subscription And Changing Subscription

Hi community, in using laravel cashier,

I have read the documentation and some tutorials but still need some understanding. In creating a subscription, I use payment intents. and then able to charge which reflects in the stipe dashboard. Below is my code. Does this mean every month, the user will automatically be charged for the subscription? eg:

$paymentMethod = $request->paymentMethod;

$user->newSubscription($plan->stripe_plan, $plan->stripe_plan)->create($paymentMethod, [
 	'email' => $user->email,
	]);

Also, How do I change the subscription using 'swap' like below?:

$user->subscription('main')->swap($plan->stripe_plan);

If the user is upgrading or downgrading, do I have to charge the user as in step one above and then do the swap?

Also, Should the main be the new subscription name or the old subscription name?

Also, Every registered user is automatically assigned to the 'Introductory" plan which is free. Do I have to create a stripe customer when signing up and when a user is upgrading, then I use the customer to charge? How do I go about it?

Apr
21
3 months ago
Activity icon

Started a new Conversation How To Remove Duplicates From Union

Hi community, I am doing some search joining different results at the end with a union like below. Now, there are duplicates. How do I remove the duplicates from the result after using the union?

$nurses = $result_by_types->union($result_by_experience)->union($result_by_car)->union($nurses_by_salary)->union($result_by_work);

Apr
03
4 months ago
Activity icon

Replied to Searching Through An Array

Do I have to loop through before exploding with the or

Apr
02
4 months ago
Activity icon

Started a new Conversation Searching Through An Array

I have users table Each user has an attribute salary_range which explodes to an array below.

$user-> salary_range

 [
	"5 or £24-30k",
	"6 or £30-37k",
	"7 or £38-43k",
	"8a or £44-51k",
	"8b or £52-61k",
	"8c or £62-73k",
	"8d or £74-87k",
	"9 or £88k+"
]

I have a variable with value $amount = 26K;

I want to return all users where 26k is found in their salary range.

Feb
24
5 months ago
Activity icon

Replied to Sending A Welcome Email After User Verify His Account

I have been able to resolve it. thanks a lot for your time

Activity icon

Replied to Sending A Welcome Email After User Verify His Account

Yes, can I use markdown in the event listener?

Activity icon

Replied to Sending A Welcome Email After User Verify His Account

I am getting below error now

No hint path defined for [mail]. (View: /home2/foundew3/public_html/nursehero/resources/views/emails/welcome.blade.php)
Activity icon

Replied to Sending A Welcome Email After User Verify His Account

how do I pass the user name to the welcome emails.blade?

Activity icon

Replied to Sending A Welcome Email After User Verify His Account

I have imported and getting below error

Undefined property: Illuminate\Auth\AuthManager::$user
Activity icon

Started a new Conversation Sending A Welcome Email After User Verify His Account

How to use 'Illuminate\Auth\Events\Verified' to send a welcome email after a user verifies his or her account.

EventServiceProvider

 protected $listen = [
        Registered::class => [
            SendEmailVerificationNotification::class,
        ],
        'Illuminate\Auth\Events\Verified' => [
            'App\Listeners\WelcomeMail',
        ],
    ];

'App\Listeners\WelcomeMail'

public function handle(Verified $event)
    {
        $user = auth()->user;
        Mail::send('emails.welcome', $user, function($message) use ($user) {
            $message->to($user['email']);
            $message->subject('WelcomeMail');
        });
    }

I get below error

Argument 1 passed to App\Listeners\WelcomeMail::handle() must be an instance of App\Listeners\Verified, instance of Illuminate\Auth\Events\Verified given