Sinnbeck

Sinnbeck

Programmer at Aalund

Member Since 4 Years Ago

Odder

Experience Points
233,030
Total
Experience

1,970 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
136
Lessons
Completed
Best Reply Awards
353
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 47
233,030 XP
Dec
09
6 hours ago
Activity icon

Replied to Generate Random Numbers Between A Range

That would have been nice knowing from the start :)

Borrowed from here https://stackoverflow.com/a/7228322/1305117

setInterval(function() {
console.log(randomIntFromInterval(first_value, last_value);

}, 1000);

function randomIntFromInterval(min, max) { // min and max included 
  return Math.floor(Math.random() * (max - min + 1) + min);
}
Activity icon

Replied to Generate Random Numbers Between A Range

So you need something in javascript instead that generates a random number between 2 numbers?

Laravel does not do anything "every second". That would be your frontend code :)

Activity icon

Replied to Combine Two Query Into One

You are assuming that you are getting one instance, but you are getting a collection.

Change ->get() to ->first()

Activity icon

Replied to Generate Random Numbers Between A Range

Then please give some context. What is $first_value and $last_value?

From your first post I just assumed that first value was like 200 seconds and the seconds was 9000 seconds. That would then give you all seconds between those two.

Activity icon

Awarded Best Reply on How To Cast An Object To String

Well it would be quite easy to make some sot of __toString yourself

public function __toString() 
{
$data = [
'platformId' => $this->platformId,
'gameId' => $this->gameId,
...
];
return json_encode($data);
}
Activity icon

Replied to How To Remove Same Object From Two Collection?

Just change the syntax. This is the exact same code as posted by @tisuchi so the solution is his. @tisuchi Feel free to just copy paste this and get the best answer if it works. It is you solution, not mine :)

$clean1 = $array1->diff($array2); 
$clean2 = $array2->diff($array1); 

$final_output = $clean1->merge($clean2);
Activity icon

Replied to How To Cast An Object To String

Well it would be quite easy to make some sot of __toString yourself

public function __toString() 
{
$data = [
'platformId' => $this->platformId,
'gameId' => $this->gameId,
...
];
return json_encode($data);
}
Activity icon

Replied to Generate Random Numbers Between A Range

Should be easy enough

$range = range($first_value, $last_value);
$random = collect($range)->shuffle()->slice(0, $amount);
Activity icon

Replied to How To Cast An Object To String

I assume that MatchList does not extend eloquent?

This is how eloquent does it. https://github.com/laravel/framework/blob/6.x/src/Illuminate/Database/Eloquent/Model.php#L1638

Activity icon

Awarded Best Reply on Zurb/tribute

First of all you would include it in you app.js instead.

Go into your /resources/js/app.js and add this line (i am just assuming you are adding your javascript directly inside a blade file)

window.Tribute = require('tributejs');

I also suggest watching this: https://laracasts.com/series/learn-laravel-mix and later this https://laracasts.com/series/webpack-for-everyone

Activity icon

Replied to Zurb/tribute

First of all you would include it in you app.js instead.

Go into your /resources/js/app.js and add this line (i am just assuming you are adding your javascript directly inside a blade file)

window.Tribute = require('tributejs');

I also suggest watching this: https://laracasts.com/series/learn-laravel-mix and later this https://laracasts.com/series/webpack-for-everyone

Activity icon

Replied to Slug Is Not Called

You are checking a column called 'category_id', with slug. Is that correct. I would assume the column would be named something like 'slug'?

Activity icon

Replied to Slug Is Not Called

Looks good. Did it work after you removed the '' ?

Activity icon

Replied to Slug Is Not Called

And how do you call this method? Please show the route?

Also remove the '' around variable like this.

->where('product.category_id','=',$slug)->get();
Dec
07
2 days ago
Activity icon

Replied to Own Crypto Cyrrency Token Payment Gateway

Once you have all of these answers down I would suggest posting something like "how do I create a custom payment system for my crypto currency" here

https://crypto.stackexchange.com

Activity icon

Replied to Own Crypto Cyrrency Token Payment Gateway

Is it built on anything existing or totally custom built? Did you build it?

Activity icon

Replied to Own Crypto Cyrrency Token Payment Gateway

Is the currency on any established payment gateways like coin gate?

Activity icon

Awarded Best Reply on Select Multiple Where In

You forgot []

->WhereIn( `l_type`, ['credit_sale','cash_sale'] )
Activity icon

Replied to Own Crypto Cyrrency Token Payment Gateway

Have you already created this crypto currency? Just curious

Activity icon

Replied to Select Multiple Where In

You forgot []

->WhereIn( `l_type`, ['credit_sale','cash_sale'] )
Activity icon

Awarded Best Reply on Cannot Install Tailwindcss On A Fresh Laravel Project

You could give this a try. Haven't used it myself yet but I might on my next project

https://laravel-news.com/use-tailwind-preset-npm

Activity icon

Replied to Cannot Install Tailwindcss On A Fresh Laravel Project

You could give this a try. Haven't used it myself yet but I might on my next project

https://laravel-news.com/use-tailwind-preset-npm

Activity icon

Replied to Cannot Install Tailwindcss On A Fresh Laravel Project

And what is the problem? Do you get an error or something?

Activity icon

Replied to Laravel Controller Edit Function Issue.

Please show the route in web.php

Activity icon

Replied to I Am Hosting My Website On Cpanel And I Cant Run Composer Update

Most likely yes. You should check the requirements and check if you shared server has it.

Use can create a php file in public with this content and call in the browser

<?php 
phpinfo();
Activity icon

Awarded Best Reply on AssertSee Multiple Thing In Phpunit Test

You could try

$this->get(route('profiles.index'))->assertSeeInOrder($sortUsers);
Dec
06
3 days ago
Activity icon

Replied to Trying To Run A Raw Query And Getting A Syntax Error 1055

Might be worth looking into actually fixing the query instead. Disabling it can lead to unwanted results

https://www.liquidweb.com/kb/how-to-disable-mysql-strict-mode/

Activity icon

Awarded Best Reply on Trying To Run A Raw Query And Getting A Syntax Error 1055

Try disabling strict mode

'connections' => [
        'mysql' => [
            'strict' => false,

        ]
    ]
Activity icon

Replied to Trying To Run A Raw Query And Getting A Syntax Error 1055

Try disabling strict mode

'connections' => [
        'mysql' => [
            'strict' => false,

        ]
    ]
Activity icon

Replied to Advice Please.

And your question is?

Activity icon

Replied to Laravel/PHP TCP Socket Connection?

Don't know of any but here is a list of possible libraries

https://packagist.org/?query=Tcp%20socket%20server

Activity icon

Replied to Should I Use Api.php For Vue Post Requests

I have personally created a third route file called ajax.php that uses the web middleware. Create the file and set up in RouteServiceProvider

Activity icon

Awarded Best Reply on Env Variable Does Not Pass In Job Queue

Well as you are experiencing, it most like does not have access to the env data you are expecting. You could spend a day trying to get it to actually load the env properly (dumping $_ENV to a file until it has the data you expect could be way of debugging that), or you can use config, which has been tested by thousands of users before you

I am not saying it is impossible. I am just saying that there is (probably) better way

One thing you could try is using getenv('USERNAME') etc

Activity icon

Awarded Best Reply on Coverting From Jquery To Javascript

Here is an example :)

function fetch_data(page){
var request = new XMLHttpRequest();
request.open('GET', '/pagination/fetch_browsergames_data?page='+page,, true);

request.onload = function() {
  if (this.status >= 200 && this.status < 400) {
    // Success!
    var data = JSON.parse(this.response);
//redo the next part with javascript.
$("#games_content").html(data);

                    $('html, body').animate({scrollTop : 0},1000);
                    var lazyLoadInstance = new LazyLoad({
                        elements_selector: ".lazy"
                        // ... more custom settings?
                    });
                    $(".page-loader").addClass('page-loader-hidden');
  }
};
request.send();
Activity icon

Replied to Coverting From Jquery To Javascript

Be aware that fetch does not work in older browsers. If that isnt a problem that would be a nice alternative :)

https://caniuse.com/#feat=fetch vs https://caniuse.com/#feat=mdn-api_xmlhttprequest

Activity icon

Replied to Coverting From Jquery To Javascript

Here is an example :)

function fetch_data(page){
var request = new XMLHttpRequest();
request.open('GET', '/pagination/fetch_browsergames_data?page='+page,, true);

request.onload = function() {
  if (this.status >= 200 && this.status < 400) {
    // Success!
    var data = JSON.parse(this.response);
//redo the next part with javascript.
$("#games_content").html(data);

                    $('html, body').animate({scrollTop : 0},1000);
                    var lazyLoadInstance = new LazyLoad({
                        elements_selector: ".lazy"
                        // ... more custom settings?
                    });
                    $(".page-loader").addClass('page-loader-hidden');
  }
};
request.send();
Activity icon

Replied to 419 Page Expired

Do you have a valid .env file with a APP_KEY ?

Activity icon

Replied to Coverting From Jquery To Javascript

Sure. What part are you having trouble converting? Or are you just looking for someone to do the job for you?

Activity icon

Awarded Best Reply on Combo Box

This assumes that it is set. Use isset

@if(isset($data))
Activity icon

Replied to Method Illuminate\Database\Eloquent\Collection::paginate Does Not Exist.

Are use sure the error is coming from that code? It normally happens when you run get() before paginate()

Activity icon

Replied to Combo Box

This assumes that it is set. Use isset

@if(isset($data))
Activity icon

Awarded Best Reply on How Do I Make This Validation Only Appear When I Start Writting?

I edited the official jsfiddle from their documentation to also trigger on invalid. It does the exact same.

https://jsfiddle.net/gp8dwex3/

Without my edits

https://jsfiddle.net/Frizi/b5v4faqf/

If you check $dirty as well you should be good :)

There are two common ways of considering if an error should be displayed. It is important to understand which one suits your use case better. You can use either $error or $anyError validation property, or by extension, the low-level variants: $dirty or $anyDirty. Note that this documentation uses mainly $error variant in it's examples, but the choice is yours to make.

Edit: Example of fix using css

https://jsfiddle.net/gp8dwex3/1/