Griehle

Griehle

PHP Developer at National energy Foundation

Member Since 9 Months Ago

Experience Points
13,260
Total
Experience

1,740 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
123
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 3
13,260 XP
21 Sep
1 day ago

Griehle left a reply on Resource Route Not Passing Info

Route::resource('Shop', 'ShopController'); This is why?

Griehle left a reply on Do You Need A Roles Package?

When has less code ever been a bad plan?

Griehle left a reply on Resource Route Not Passing Info

Is this true if its outside of the class in question? That everywhere its used it must always be capitalized? In this case the var in question was $project, so in the method it was Project $project. And I had to change it from that to Project $Project, in order for it to work. I have long since moved on past this, I was just updating for future visitors. That's the only var I have that issue with. All the rest work as intended.

Griehle left a reply on Resource Route Not Passing Info

I made the variable with the same capitalization as he Typehint and it worked. Makes ZERO sense to me.

Griehle started a new conversation Works In Tinker Not In Policy

Why would something return the right data in tinker and not work in a policy? I use

 $product->store->user_id; 

in tinker it return the number so I can use that against auth user in a policy. But in the policy itself I am getting a Trying to get property 'user_id' of non-object error. Why would that be?

16 Sep
6 days ago

Griehle left a reply on Get This Where This Exists

Big cleanup starts Wednesday thank the Gods. But what a great learning experience running around behind someone else cleaning up their messes until I can just rebuild from scratch.

I gotta say, I love the way you start that thread out. Giving the guy some push. Nice one. But the stack overflow has the answer I was after. Makes me realize how lazy I got at the end of the day to just ask here. haha. You don't even need the badge do you?

Thanks again.

Griehle started a new conversation Get This Where This Exists

I am really thinking pivot tables are too much hassle. Here is another question. I have types, in a table of Genre that exist. I wanted to list all genres in all stores. however, some of those stores are no longer around. They have been deleted, yet the product and the genre remain. I already know about cascade and all the ways this SHOULD have been built my question is

    $firstGenres = Genre::all();
    $genres = $firstGenre->where(Shop exists )

Shop is on the other side of a pivot table and it keeps telling me there is no shop. So... what do I need to do? get yourself that badge for answering!

15 Sep
1 week ago

Griehle left a reply on How To Access Method In Child Component ?

Try something more like this.

    <add-task :item="item" :bus="bus" ref="addNewTaskData" />

methods: {
        clearForm() {
           this.bus.$emit('clearForm')
    }

Your Child component is not reachable unless it $emits an event.

https://forum.vuejs.org/t/how-to-call-a-child-component-method/19363

Griehle left a reply on Pivot Table Data

In doing iit the other way around for me in tinker, like I started at I was able to get with $genre->with('products')->get(); it was that last get() that I had forgotten.

14 Sep
1 week ago

Griehle left a reply on Pivot Table Data

Awesome. Thanks for the explanation. That way works now. Now I had been querying a specific genre and trying to collect all the products. This gets me that much closer.

Griehle left a reply on Pivot Table Data

Update: I am now just trying to see genre in connection with any product. I have a list all products page so I am trying this

@foreach($products as $product)
      <ul>
           <li>{{$product->pivot->genre}}</li>
</ul>
 @endforeach

It says "Trying to get property 'genre' of non-object "

I am beginning to doubt the usefulness of pivot tables. :) But I need to learn it all. I appreciate all the help this forum offers.

13 Sep
1 week ago

Griehle left a reply on Pivot Table Data

Certainly. Type is represented by genre is this. This is the Product model

     public function shop(){
          return $this->belongsTo(Shop::class);
     }

     public function user(){
         return $this->belongsTo(User::class);
     }

     public function genre(){
         return $this->belongsToMany(Genre::class); //->withPivot('genre_id', 'product_id')
     }

And this is the Shop Model

     public function products(){
         return $this->hasMany(Product::class);
     }

     public function user(){
         return $this->belongsTo(User::class);
     }

     public function genre(){
        return $this->hasMany(Genre::class, Product::class);
     }

And finally the Genre Model

    public function products(){
        return $this->belongsToMany(Product::class);
        }

    public function shop(){
         return $this->hasMany(Shop::class);
    }

I am just for now using tinker trying to access it, and again, my main interest would be to go from Genre to a Products collection. Don't know why this one is killing me.

Griehle started a new conversation Pivot Table Data

I have a Shop, or store, In Tinker I can access it

      $user->shop;

The Shop has Products and the products have types. But there is a pivot table there. So the type name can be anything. however, I cannot access it as

     $product->type;

or even

     $user->shop->product[0]->type; 

I have the relationships set as has many, it saves well everything seems to be working until I try to display the product with these addition. Or better for me. Trying to access the type and show all products. But.. I just cannot suss it. I hope it isn't too vague for help here.

Griehle left a reply on How To Become Web Development Master?

Going from good to great requires Drinking. Coffee mostly.

Caffeine is taken in and converted to code, but the by-product of that is sarcasm.

But as Microsoft found out Alcohol is also useful. https://xkcd.com/323/

12 Sep
1 week ago
11 Sep
1 week ago

Griehle left a reply on Do We Need To Create A Migration Table For Every Model?

My OPinion, Yes. Yes you should always write the migration because it can be created with a simple -m as you create your model but what's really nice is those moments when you need to remember what that one column name was, or how it was spelled, or any reference to yoru database like that. You don't need to open up sequel pro and find your tables, you just reference the migration. Oh ya, it's also really sweet for local dev as discussed above. Especially with factories. but that's not this thread.

10 Sep
1 week ago

Griehle left a reply on Eloquent Is So Slow ...

And then there was Laravel 6

02 Sep
2 weeks ago

Griehle commented on Two Layers Of Validation

What if I am also adding a user_id in the form of $userId = Auth::user() kind of thing? so that the Project is owned by the creator of it? How do Include it in the Project::create method?

01 Sep
3 weeks ago

Griehle commented on Cleaner Controllers And Mass Assignment Concerns

Apparently, your variable must have the same capitalizations as the Typehint

Griehle left a reply on Resource Route Not Passing Info

Ya, IM sure of it. I have watched it 3 times. I bet it's something I missed lessons ago. I am not getting the empty array brackets. I will look for the github, that's good idea.

Griehle commented on Cleaner Controllers And Mass Assignment Concerns

My stuff stopped having anything in it after changing to type hint. Empty array which makes the edit link not work either as the id is blank as well. no idea why yet. worked fine before

Griehle left a reply on Resource Route Not Passing Info

Its not getting the correct info. I dd() the var and the array I get is not the project array at all.

Griehle started a new conversation Resource Route Not Passing Info

I was following the 5.7 from scratch tutorial and everything was fine until the controller methods were changed to get Project $project in. Its not passing any id numbers at all the ink all have a blank spot in them where the number should go

  Url/Project/ /edit

What possible things would make it so it suddenly stops working, I bet it's something stupid.

31 Aug
3 weeks ago

Griehle commented on Routing Conventions Worth Following

I already had a layouts file and the links in it were route(/Projects') they had to be changed to Projects.index and Projects.create respectively. Using the Route:list command resolved this question.

30 Aug
3 weeks ago

Griehle commented on Routing Conventions Worth Following

I must have missed something. I switched to the Route::resource thing and now all my routes are undefined?

29 Aug
3 weeks ago

Griehle left a reply on Undefined Var In Vue.js

In Vue dev tools it gave the layout of it and the name. That didn't narrow it down much because there were many instances so was it mounted, created, data or html? In the end it was html or actually data() where the error was. but there is no good way to find that without hunt and peck style as far as I know because the line number was 56718 which.. my component is not quite that big.

Nothing to really help future peeps out with here.

Griehle started a new conversation Undefined Var In Vue.js

How do you find an error in vue when all it says is undefined in App.js ? How can I find out where the undefined var is exactly? Which instance of the var in the component?

28 Aug
3 weeks ago

Griehle left a reply on Emails Not Sending

Well, I was able to get it to run by entering the command I created, but somehow it is not firing at night, when its supposed to check. The linux is good, its my code that's the issue.

27 Aug
3 weeks ago

Griehle left a reply on Emails Not Sending

Well, I can run the artisan command locally and right now its set up to only email me. And it finally worked. Cleared config cache. haha. how did I miss that? dork. Now to see if it runs tonight. that will narrow down the possible issues. Thank you!

Griehle left a reply on Emails Not Sending

you asked about mail.php I have questions about this one line. the rest is good Im sure. since it all seems to reference the .env file.

  'driver' => env('smtp', 'smtp'),

Griehle left a reply on Emails Not Sending

I am using sendgrid. I have not actually tried using it before with laravel, but we use it for html email campaigns. I checked in with their tutorials and it's pretty straight forward. Setting up the .env file correctly and creating mailable. but they don't actually cover cron jobs. I figured more info is better answer?

Griehle left a reply on SPA Token Authentication Lesson

Are you asking about something like JWT? because no I have not seen one of those on here yet. But LOTS of people are using that so the forums will work out well for you.

Griehle started a new conversation Emails Not Sending

I had followed a tutorial and it had me create an artisan command. The idea is that if someone comments on the page it will send email with a short synopsis of each comment in an email. I have a command file and in it is a handle method

 public function handle(){
    $this->line('running registered:users');
    $postarray = array();
    $date = date('Y-m-d');

    //getting the total posts created today
    $posts = Post::whereDate('created_at', $date)->get();
    $i = 0;
    foreach ($posts as $post) {
        $postBody   = str_limit($post->body, 40);
        $userName   = $post->user->name;

        $poster['name' . $i] = $userName;
        $poster['body' . $i] = $postBody;

        $i++;
        array_push($postarray, $poster);
    }

    if (!empty($postarray)) {
        Mail::to('[email protected]1.org')->send(new SendMailable($postarray));
        $this->line('shared posts');
    } else {
        $this->line('no posts to share');
    }

    $this->line('finished running registered:users');
}

I have the Mailable file

class SendMailable extends Mailable
 {
  use Queueable, SerializesModels;
  public $postarray;

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

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{

    return $this->view('emails.registeredcount')
                        ->from('[email protected]', "NEF WOW")
                        ->Subject('NEF WOW Daily Digest');
}

}

And I have this view

    <div>
    Here is what has happened on the <a href=" htttp://wow.nef1.org">WOW board</a> recently <br>

    <br>

@foreach($postarray as $post)
    <p>{{ $post['name'.$loop->index] }} Wrote: </p>
    <p>{{ str_limit($post['body'.$loop->index], $limit=60, $end = '...') }}</p>
    <p><a href="http://wow.nef1.org">Read more here</a></p>
        <br><br>
    @endforeach
</div>

the command works because I get the response back. But its not mailing anything out. I thought it was a problem with the cron running on the server but its working. The scheduler in laravel is

 protected function schedule(Schedule $schedule)
{
    $schedule->command('registered:users')
        ->dailyAt('23:50')
        ->sendOutputTo(
            storage_path(
                'logs/' .
                    Carbon::now()->format('Y-m-d') .
                    '-registered:users-output.txt'
            )
        );
    
}

So.. Can you help me suss this one?

21 Aug
1 month ago

Griehle left a reply on PhpDoc In Laravel

There seems to be an issue with symphony and phpDocs though. I cannot get it do anything but tell me no.

10 Jul
2 months ago

Griehle commented on Has Many Through

Aww man, I came here to get away from the politics. :D

20 Jun
3 months ago

Griehle left a reply on Populating Database With Images With Faker

Could you do this kind of thing with Audio files? Using Factories for dev. How would you do that and be able to test if it plays after playlist creation and such. Or would you use some kind of dummy file that doesn't actually play?

29 May
3 months ago

Griehle left a reply on How Does SnipeIt Do It?

@BOBBYBOUWMANN - Awesome. I have been working my way through the design pattern videos. I will go follow up on that and see if I can find more tutorials to teach me this. Trying to make the most out of the framework if I am working in it anyway. :)

28 May
3 months ago

Griehle left a reply on How Does SnipeIt Do It?

@BOBBYBOUWMANN - So I gather that some of those are referencing Models or tables. And in those models there are methods. I see that. And then establishing the relationship becomes very important as well. I feel like I am missing a piece here though.

Griehle left a reply on How Does SnipeIt Do It?

@BOBBYBOUWMANN - Thank you for responding. It is a query similar to what you write in fact. My question really is about the front end things. The return array does not contain things such as eol_date, but they do use $assets->eol_date. and it returns a date. So I would like to know where they are writing whatever it is. My research says it's something to do with accessors and relationships. BUt I cannot find anything solid for a tutorial.

Griehle started a new conversation How Does SnipeIt Do It?

If you are familiar with SnipeIT they have a depreciation report and in it they use functions or something such as

 @foreach ($assets as $asset)
              <tr>
                <td>{{ is_null($asset->company) ? '' : $asset->company->name }}</td>
                <td>
                  @if ($asset->model)
                  {{ $asset->model->category->name }}
                  @endif
                </td>
                <td>
                  @if ($asset->deleted_at!='')
                  <del>{{ $asset->asset_tag }}</del>
                  @else
                  {{ $asset->asset_tag }}
                  @endif
                </td>
                <td>{{ $asset->model->name }}</td>
                @if ($snipeSettings->display_asset_name)
                <td>{{ $asset->name }}</td>
                @endif
                <td>{{ $asset->serial }}</td>
                <td>
                  @if ($asset->model->depreciation)
                  {{ $asset->model->depreciation->name }}
                  @endif
                </td>
                <td>
                  @if ($asset->model->depreciation)
                  {{ $asset->model->depreciation->months }}
                  @endif
                </td>
                <td>
                    @if (($asset->checkedOutToUser()) && ($asset->assigned))
                       {{ $asset->assigned->getFullNameAttribute() }}
                    @else

                        @if ($asset->assigned)
                            {{ $asset->assigned->name }}
                        @endif
                    @endif
                </td>

And I am trying to write a report that shows a sum of monthly depreciation by supplier_id for each month in the fiscal year. Seems like I should be able to do something based on their stuff but I don't understand how they are getting the $asset->stuff->here....

Is this vague enough? I don't even know how to ask for what I need here.