Brainmaniac

Brainmaniac

Member Since 1 Year Ago

Experience Points
4,620
Total
Experience

380 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
40
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
4,620 XP
Jul
29
1 week ago
Activity icon

Awarded Best Reply on What To Backfill With In Type-column On Polymorphic Table?

Correct was: App\User

Activity icon

Started a new Conversation What To Backfill With In Type-column On Polymorphic Table?

Hi,

I am changing my file-model to go from one to many to be a one to many polymorphic relation. Before only my User-model could have hava file but now my model Guest will also be able to have a file.

So before I had a column on in the file table named user_id I have renamed that one following the pattern here: https://laravel.com/docs/7.x/eloquent-relationships#many-to-many-polymorphic-relations

So it is now named fileable_id.

In addition to the renaming I have added a column named fileable_type I know want to back fill this column so it point on the User-model. What should I write in that column?

I have tried App\User and User without success.

Jul
04
1 month ago
Activity icon

Started a new Conversation Missing Methods In Handler.php

Hi there 👋

I am about to upgrade from 6.x to 7.x of my laravel framwork. I See in the documentation for upgrade that I should update the exception type to Throwable on these methods:

use Throwable;

public function report(Throwable $exception);
public function shouldReport(Throwable $exception);
public function render($request, Throwable $exception);
public function renderForConsole($output, Throwable $exception);

I'd be happy to that only problem is I don't seem to have these two methods in my Handler.php:

public function shouldReport(Throwable $exception);
public function renderForConsole($output, Throwable $exception);

Is there some installation that I missed in previous updates? And how can I get those methods?

Have nice day!

Apr
20
3 months ago
Activity icon

Replied to Access Target Model With HasManyThrough Between Two Steps Of Has-many Relations

Thank you I'll see what I come up with. If good I'll make PR to laravel... Any suggestions on how to start?

@jeffreyway @tay-tay

Apr
19
3 months ago
Activity icon

Started a new Conversation Access Target Model With HasManyThrough Between Two Steps Of Has-many Relations

Please see the attached structure:

enter image description here

I want to access all packs that has any fruits that has a specific tag.

Seudo Code here: Tag: 'Good fruits' -> Fruits: ['banan', 'cactus'] -> Packs: ['Exotic', 'DessertFruits']

So I want to have something like:

$myTag = App\Tag::where('name', 'goodFruits')->first();

$mytag->packs

=>Illuminate\Database\Eloquent\Collection {#3907
     all: [
      App\Pack {
          .. 'Exotic' ..
       },
       {
       ... 'DessertFruits' ...
       },
     ],
   }

Both Between Pack and Fruit and between Fruit and Tag there are pivot-tables. I have the correct set-up with belongsToMany in each model. In the tag model I also have:

    /**
    * Gets all the packs for a tag
    */
    public function packs()
    {
        return $this->hasManyThrough('App\Pack', 'App\Fruit');
    }

...all according to:

https://laravel.com/docs/6.x/eloquent-relationships#has-many-through

I am running Laravel 6.

So what is the problem?

When I execute $myTag->packs I get:

Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fruit.tag_id' in 'field list' (SQL: select `packs`.*, `fruits`.`tag_id` as `laravel_through_key` from `packs` inner join `fruits` on `fruits`.`id` = `packs`.`fruit_id` where `fruits`.`tag_id` = 1)' 

What am I doing wrong? How can I achieve what I want?

Apr
12
3 months ago
Activity icon

Replied to Reasons For Erratic Behaviour Loading Constants From Env->config->blade?

🎉🤩 Thank you!! Assumed there was something with some cache but did not know this! Thank you!

Activity icon

Started a new Conversation Reasons For Erratic Behaviour Loading Constants From Env->config->blade?

I am running Laravel Framework 5.8.37 (Haven't had time to upgrade yet...)

I have Sstripe as a payment solution in my laravel app. After some refactoring I am about to re-implement my payment stuff from Stripe.

I keep all my keys and stuff in the .env. like:

STRIPE_PUB_KEY= pk_test_MyKeYs
STRIPE_SECRET_KEY= sk_test_MyKeYs
STRIPE_END_POINT_SECRET = whsec_MyKeYs

In the app.config I define them:

'stripe_pub_key' => env('STRIPE_PUB_KEY'),
'stripe_secret_key' => env('STRIPE_SECRET_KEY'),
'stripe_end_point_secret' => env('STRIPE_END_POINT_SECRET')	

Then from my code I call:

var stripe = Stripe("{{ config('app.stripe_pub_key') }}");

Everything SHOLD work. But what happens? I get the error:

Uncaught IntegrationError: Please call Stripe() with your publishable key. You used an empty string.

The call to the config returns empty string! Strange, well it will get worse. To be able to test better I've just added this to my blade:

<h1>My response:{{ config('app.stripe_pub_key') }}</h1>

It does indeed return empty string. Now to the real strangeness. If I change to:

<h1>My response:{{ config('app.stripe_secret_key') }}</h1>

... just to test. It returns the secret key!!! 😤 - It also works with the end point secret. It seems to just be the pub_key that does not work... Also if I make a random new one it does not seem to work...

What can this be?

Apr
10
4 months ago
Activity icon

Replied to Can't Use Env('MY_VARIABLE') In Javascript

Snapey, it all worked when I did as you said!

Activity icon

Replied to Can't Use Env('MY_VARIABLE') In Javascript

Thank you Snapey! I will look in to this. Since my upgrade to 5.7 I can no longer access a lot of stuff from my .env on the server.... am using forge. But locally it's fine. 😰

Apr
06
4 months ago
Activity icon

Started a new Conversation Can't Use Env('MY_VARIABLE') In Javascript

Hello!

I recently updated Laravel from 5... to 6...

Now when I click my buy-buttons I do not get redirected to the stripe purchase page.. On the server. Locally to the test links in stripe it works just fine!

I have stripe integration like this on a blade, the script includes:

var stripe = Stripe('{{env('STRIPE_PUB_KEY')}}');

This works fine locally rendering my stripe public key that I have in my .env but on my server it does not work.. On both server and locally I have Laravel v. 5.7.28 php version server 7.3.12 php version locally 7.4.4

Yes, I have a variable in both my .env on server and locally called STRIPE_PUB_KEY...

This drives me nuts.. What can be the difference. Can it really be the php version?

Mar
31
4 months ago
Activity icon

Started a new Conversation Does The Example Route In The Api.php Do Anything?

Hello Everyone,

because of this bug in laravel: https://github.com/laravel/framework/issues/22034

I wonder if the example route in api.php does anything or is it safe to just remove it?

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
Mar
26
4 months ago
Activity icon

Replied to Snake_case Or CamelCase

Bump :) Looking through the Laravel source I see a few public $camelCaseProperty; so Ill go with that