CRUGG

CRUGG

Student at N/A

Member Since 2 Months Ago

Hagen

Experience Points
350
Total
Experience

4,650 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 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
350 XP
Oct
16
1 week ago
Activity icon

Replied to JSON In Database, Search For Entry By Value In JSON?

But that would make everything quite hard. Currently, I get the User and then just get the GitHub Connection Column from it. If I would do it like this, I would have to Find an entry in that Table where the Platform ID, User ID AND key is what I'm searching for...

Activity icon

Replied to JSON In Database, Search For Entry By Value In JSON?

I don't even know what "rdbms" is. In addition to that, if I would have it all in separate columns, I'd have 3 columns per Platform the User can connect their account with. If that's 20 Platforms, every User would have 60 Columns, just for Account Connections. And as I said, I just don't see why. The solution of @sinnbeck works perfectly fine for me and I don't have any problems.

Oct
15
1 week ago
Activity icon

Replied to JSON In Database, Search For Entry By Value In JSON?

Can I also use that on a Model?

User::whereJsonContains('connection_steam->id', $job->steam_id)->first();

Seems to not work. Whoops. Edit: This is for Arrays only... facepalm The one for Objects if above...

Activity icon

Started a new Conversation JSON In Database, Search For Entry By Value In JSON?

Hey there. I have a Model with a field that contains JSON Data. Is there any way to search for an entry which has a specific value inside that JSON Object? So like ::where("something", "anotherValue")->first(); just that it searches for a key inside a JSON field instead of a field?

Sep
26
3 weeks ago
Activity icon

Replied to Laravel Maintenance --render And --secret Not Working

That says 7.25 apparently. I am 100% sure that I installed Laravel after 8 was out though, so I don't know why it installed Laravel 7. Can I easily upgrade to 8 or is that a lot of work?

Activity icon

Started a new Conversation Laravel Maintenance --render And --secret Not Working

Hey there! I'm currently trying out the php artisan down Command described in the Laravel Docs Page. When I add either the --render or the --secret Parameter (I haven't tried the others), I get an error saying:

The "--render" option does not exist.

or

The "--secret" option does not exist.

Aug
09
2 months ago
Activity icon

Replied to Modify User In Controller - Integrity Constraint Violation: 4025

Update: Making it nullable fixed it.

Activity icon

Replied to Modify User In Controller - Integrity Constraint Violation: 4025

Hey! Those are set to the JSON Datatype. About the nullable Part, aren't those nullable by default? My Migration looks like this:

$table->json('connection_discord');
$table->json('connection_steam');
$table->json('connection_github');

Also, if they aren't nullable, shouldn't I get an Error whilst migrating?

Aug
08
2 months ago
Activity icon

Started a new Conversation Modify User In Controller - Integrity Constraint Violation: 4025

Hey there. I am currently working on making it possible for my Users to link their Social Media Accounts to their Accounts on my Website using Socialite. When being redirected to my callback, I get this error:

SQLSTATE[23000]: Integrity constraint violation: 4025 CONSTRAINT `users.connection_discord` failed for `***_hub`.`users` (SQL: update `users` set `connection_steam` = {"name":"CRUGG","id":76561198308261486,"url":"https:\/\/steamcommunity.com\/id\/crugg_\/"}, `users`.`updated_at` = 2020-08-08 16:54:56 where `id` = 1)

The Function I use to handle the Callback and to modify the User to add the Information looks like this:

/**
 * Handles the callback of the authentification provider.
 *
 * @return \Illuminate\Http\Response
 */
public function callback($service)
{
    $account = Socialite::driver($service)->user();
    $data = ['name' => $account->nickname, 'id' => $account->id];
    $user = User::find(Auth::user()->id);
    switch($service) {
        case "github":
            $data['url'] = $account->user['html_url'];
            $user->connection_github = json_encode($data);
            break;
        case "discord":
            $data['url'] = 'https://discord.com/users/' . $account->id;
            $user->connection_discord = json_encode($data);
            break;
        case "steam":
            $data['url'] = $account->user['profileurl'];
            $user->connection_steam = json_encode($data);
            break;
        default:
            return 'error';
    }
    $user->save();
    return view('connections.' . $service);
}
Jul
31
2 months ago
Activity icon

Replied to Cache External Rest API In Laravel

From how I understand it, your Code, runs the Query and caches that, however, I have no Idea how I'd then get the Information. Because I basically needs a function that, if the Request is cached, returns that. And if not, requests, caches and then returns that

Activity icon

Replied to Cache External Rest API In Laravel

Hm yeah that would work I just thought there's maybe a direct way to cache Responses (so when calling the Endpoint, I get the cached version) Would this work?

$data = Cache::store('redis')->get('myEndpoint');
if(isset($data)) {
	return $data;
} else {
	$response = Http:get('https://example.tld/api/endpoint'):
	Cache::store('redis')->put('myEndpoint', $response, 60);
	return $response;
}

I'm definitely not the best programmer. If anyone has some Improvements to my Code, I'd be happy to hear them.

Activity icon

Started a new Conversation Cache External Rest API In Laravel

Let's say I want to obtain data from an External REST API through this. How would I cache this Data to e.g. only have max. 1 Request per Minute to the external API Endpoint with Laravel's Caching? Is there anything I can enable or any packages I can use to achieve this? Or what would I have to do?

Jul
26
2 months ago
Activity icon

Replied to User Fields Exposed Publicly Or Not?

Ah alright! As long as it is just for the User itself, things like Bio etc. can be in there. Thank you very much for your help!

Activity icon

Replied to User Fields Exposed Publicly Or Not?

Okay! So by default, the User data isn't exposed? In the routes/api.php File, which I haven't touched yet, there is something about /user though. What is that about?

Activity icon

Started a new Conversation User Fields Exposed Publicly Or Not?

Hey there! I'm a complete Laravel Newbie and am currently trying to learn by doing in a little Project. I am using Laravel 7 and am using the Auth System from the UI Package. I've also added multiple fields to the User such as a Bio using Migrations and added them as fillable Fields in the User Model. Now for my Profile View, I get a User like this:

$user = User::where('name', $username)->first();

And then pass that data to the View. I have several Questions now.

  1. While I am able to access e.g. the Bio in the View, if I don't do that, can the User still see that info?
  2. Does the data get exposed some other way? e.g. through a REST API?
  3. If that's the case, how would I get rid of it. Additionally, how would I make it only be viewable by specific Users?