daugaard47

daugaard47

Member Since 2 Years Ago

Experience Points
17,440
Total
Experience

2,560 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
151
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 4
17,440 XP
Apr
10
1 month ago
Activity icon

Replied to Laravel And Nuxt - Do I Need To Decouple?

After giving much though to what Bobby said above

Also, I would personally think about what Nuxt brings extra to the table that blade for example doesn't provide for you. Do you really need that frontend framework?

I decided to stick with Blade and use Vue on certain components that don't matter if they get indexed or not.

As for what you're trying to do, I would suggest you look at Livewire. Laracasts has a Livewire guest speaker course. You can find more from the creator Caleb Porzio. He also has a nice course on Alpine js.

If I were to build my site over I'd probably reach for this.

Mar
02
2 months ago
Activity icon

Started a new Conversation Use Salesforce As A Back-end?

I'm wanting to know if anyone here has ever used Salesforce as a back-end?

Quick Backstory:

I've created a nice data-driven website using Laravel with Nova, but work is requesting to explore the possibility of using Salesforce as a backend.

I want to know if anyone has been tasked with this. If so, what are the Pros & Cons? What issues might come into play?

I know there are a couple packages for Laravel to help with this if I wanted to stick with Laravel, but I would be willing to use another framework like Vue or React if need. I'm having a horrible time trying to find any documentation on this.

The way I see it there are two options:

  1. Keep the Laravel + Nova flow and push all data to MySql & Salesforce via the SF API on all Post Requests. (Manage/Sync two databases, Laravel and Salesforce.)

  2. Dump Laravel and Nova, Take all my current data, import to Salesforce, Map the fields, create the relationships and use the Salesforce API to Get/Post future data on the front-end. (Only manage Salesforce and a front-end)

Any help on this subject would be appreciated.

Feb
07
3 months ago
Activity icon

Started a new Conversation Date Range Picker Storing Data

I have a travel app and allow users to pick travel dates by using a date range picker: https://flatpickr.js.org/examples/#range-calendar

Date Range Picker Value = 2020-06-22 to 2020-06- 27

What is the best way to store this data in my database?

I'm currently doing it like this.. 3 columns in the database.

  1. trip_date name="trip_date"
  2. start_date
  3. end_date

I break apart the Range Picker Value like this:

$dates = explode('to', $request->trip_date);
$startDate = trim($dates[0]);
$endDate = trim($dates[1]);

Then save the dates like this:

$travelDates= TravelDate::create([
    'trip_date' => $request->trip_date,
    'start_date' => $startDate,
    'end_date' => $endDate,
...

I guess the only reason to store the Full trip_date from the range picker would be for easy return output to the user, but how would you format 2020-06-22 to 2020-06- 27 to a more readable format like m-d-Y to m-d-Y? the double dates and the "to" is throwing me off..

I love the user experience of using a date range picker, but think it might be best to Drop trip_date column and only store start_date and end_date.

Curious how others handle this.

Feb
05
3 months ago
Activity icon

Replied to Custom Laravel Nova Avatars

@skauk This seems to be working great for generating the gravatar links via Nova. Thank you.

My other issue though is I currently have 300+ existing users. 1/3 has uploaded their own Avatar image and I would like to display those as well. How would I do this with Nova?

Example: (This is how I'm displaying the 3 optional avatars on the front-end.)

<div class="avatar-wrap">
    @php
    $userId = Auth::user()->id;
    $userAvatar = Auth::user()->avatar;
    @endphp
    // Option 1.
    // If User has 'DefaultAvatar.png' in the avatar column use this.
    @if (Auth::check() && (Auth::user()->avatar == 'DefaultAvatar.png'))
    <div class="..." style="background-image:url(/images/DefaultAvatar.png)"></div>

    // Option 2.
    // If User has 'Garavatar Link' in the avatar column use this.
    @elseif (strpos($userAvatar, 'gravatar') == true)
        <div class="..." style="background-image:url({{ $userAvatar }}"></div>

    @else
    // Option 3.
    // If User has 'Their Own Image' in the avatar column use this.
        <div class="..." style="background-image:url({{ asset("storage/images/users/$userId/avatar/$userAvatar") }}"></div>
    @endif
</div>

So how could I do this same logic in the Nova Users View?

How could I do something like this logic?

    $userId = User::user()->id;
    $userAvatar = User::user()->avatar;
 
    if ($user->avatar == 'DefaultAvatar.png'){
    // Option 1.
    // If User has 'DefaultAvatar.png' in the avatar column use this.
    return 'https://mysite.com/images/DefaultAvatar.png';

    }elseif (strpos($userAvatar, 'gravatar') == true){
    // Option 2.
    // If User has 'Garavatar Link' in the avatar column use this.
       return  $userAvatar;

   }else{
    // Option 3.
    // If User has 'Their Own Image' in the avatar column use this.
    return 'https://mysite.com/images/users/'.$userId.'/'.$userAvatar;
    }

If there a way to add this logic as a file system and then call it like this:

Avatar::make('Avatar')->disk('currentAvatars'),

This way was mentioned here: https://github.com/laravel/nova-issues/issues/2324#event-3008740340

Feb
04
3 months ago
Activity icon

Started a new Conversation Custom Laravel Nova Avatars

I'm currently trying to get Nova to play nice with my existing website and existing users table.

My issue is with the Gravatar. I already have an avatar field in my users table and would like to display those rather the auto generated Gravatars.

In my Nova/User class I have the following. (Also changed to first_name and last_name)

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

           Gravatar::make('Avatar'),

            Text::make('First Name')
                ->sortable()
                ->rules('required', 'max:255'),

            Text::make('Last Name')
                ->sortable()
                ->rules('required', 'max:255'),

            Text::make('Email')
                ->sortable()
                ->rules('required', 'email', 'max:254')
                ->creationRules('unique:users,email')
                ->updateRules('unique:users,email,{{resourceId}}'),

            Password::make('Password')
                ->onlyOnForms()
                ->creationRules('required', 'string', 'min:8')
                ->updateRules('nullable', 'string', 'min:8'),
        ];
    }

When a user registers normally via the registration form, I'm doing the following with the avatar column from my auth > register controller. (I want to do the same in the Nova User Create)

RegisterController.php

    protected function create(array $data)
    {
        $hash = md5(strtolower(trim($data['email'])));
        $gravatar = 'http://www.gravatar.com/avatar/'.$hash.'??s=200&d=identicon';
        $user = User::create([
            'first_name' => $data['first_name'],
            'last_name' => $data['last_name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
            'avatar' => $gravatar, // user DB `avatar` is set to a default image (default-avatar.png)
            'role_id' => '0', // DB is set to default 0
        ]);
}
  1. When I create a new user Via Nova, where/what is the form request that it is hitting?
  2. Where can I change the Nova/User view to display my avatars from my users database?
Activity icon

Awarded Best Reply on Proper File Structure In Nova

Okay I ended up deleting the root > vendor > laravel > nova and nova-app files and ran composer-update.

This recreated the symlink for nova in root > vendor > laravel > nova.

Still would like to confirm that this is the correct file structure.

Activity icon

Replied to Proper File Structure In Nova

I'm going to go ahead and close this. But if I'm missing something, please let me know. Thanks!

Activity icon

Replied to Proper File Structure In Nova

Okay I ended up deleting the root > vendor > laravel > nova and nova-app files and ran composer-update.

This recreated the symlink for nova in root > vendor > laravel > nova.

Still would like to confirm that this is the correct file structure.

Activity icon

Replied to Proper File Structure In Nova

Okay so I tested on a clean Laravel install. (Previous was installing into an existing project)

Looks like the file structure is like this on the clean install:

Root:

  • app
  • nova (This is the downloaded folder)
  • resources - views - vendor - nova
  • vendor
    • laravel (This is removed)
      • nova (THIS IS A SYMLINK)
      • nova-app (This is removed)

So... Based on this, how can I recreate that symbolic link in the root vendor folder?

Activity icon

Started a new Conversation Proper File Structure In Nova

This is what I currently have:

Root:

  • app
  • bootstrap
  • config
  • database
  • nova (This is the downloaded folder)
  • resources
    • views
      • vendor
        • nova
  • vendor
    • laravel
      • nova
      • nova-app

Seems like I have to many nova files? If the proper file structure documented somewhere?

Can I remove the last vendor > laravel > nova & vendor > laravel > nova-app?

This is the 3rd time I've installed Nova so I'm not sure if some of this is left over junk. I installed on a branch, then made mistake, then deleted branch and restarted again.

Thanks, Chris

Jan
30
4 months ago
Activity icon

Replied to Storing Unknown Data

Hey Guys, Thanks for all the helpful information on this topic. Really made it easier to understand.

Jan
25
4 months ago
Activity icon

Replied to Storing Unknown Data

Bobby, Thank you for the advice. In the trips scenario do you think it would be better to create 3 tables?

  1. Trips Table
  2. Passengers Table
  3. Trips_Passengers (Pivot table)

Also would foreign keys need to be involved?

Appreciate the help.

Jan
24
4 months ago
Activity icon

Started a new Conversation Storing Unknown Data

This title is pretty week, but I'm not sure what the technical term is for this.

Here is what I'm trying to learn:

Say I'm a travel agent and I'm selling multiple trips. When someone signs up for a Trip they can bring as many people as they want with them.

I store my trips in a database , but also want to store the trip passengers:

Trips Table
+----+-----------+
| id | trip_name |
+----+-----------+
|  1 | Trip A    |
|  2 | Trip B    |
|  3 | Trip C    |
+----+-----------+

So...

A user signs up for Trip A and wants to bring 4 friends. (5 people total)

  • Trip A
    • Passenger 1
    • Passenger 2
    • Passenger 3
    • Passenger 4
    • Passenger 5

Another user signs up for Trip C and has 2 passengers

Trip B has 3 passengers

etc..

How would you store all the passengers in a database without setting a limit on how many people can signup?

I don't know how many passengers are joining...

I would think there would have to be a relationship between Trips and Passengers, but I'm having trouble wrapping my head around it..

Would it be:

  • Trips can have Many Passengers
  • Passengers belongs to Trips

Then create a Passengers table like this:

Passengers Table
+----+----------+-------------+
| id | trips_id | passengers  |
+----+----------+-------------+
|  1 |        1 | passenger 1 |
|  2 |        1 | passenger 2 |
|  3 |        1 | passenger 3 |
|  4 |        1 | passenger 4 |
|  5 |        1 | passenger 5 |
|  6 |        3 | passenger 1 |
|  7 |        3 | passenger 2 |
|  8 |        2 | passenger 1 |
|  9 |        2 | passenger 2 |
| 10 |        2 | passenger 3 |
+----+----------+-------------+

__

Another scenario is the Laracon Online Ticket Pay

Notice the Add Another Attendee. How would you store the attendees in a database table?

Here is a screenshot in case the link goes away.

LaraconOnlinePay

Any tips or tutorials for this would be appreciated.

Thanks!