ddotgrass

ddotgrass

Website developer at D3.io

Hastings

Hire Me

Member Since 4 Years Ago

Experience Points 6,265
Experience
Level
Lessons Completed 76
Lessons
Completed
Best Reply Awards 3
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

13 Dec
1 year ago

ddotgrass left a reply on Eager Loading Is Taking A While

Thanks for the reply @tigana

I can achieve similar results to what you're proposing with:

$model = $this->model->with('accounts:id,name')->take(100)->get();

But it doesn't change much, it still takes about 4 seconds to execute. Whereas the first one, which loads 1,500 results, will execute in less than a second.

I'm using debug bar to debug the queries and the query I pasted above (with all the ID's in the IN clause), is the query that's being executed and subsequently, the query that's taking 4 seconds to load. I'm sure it's because it's a a large IN set.

ddotgrass started a new conversation Eager Loading Is Taking A While

Hi everyone!

I just wanted to see if this was an expected result whilst using Eager Loading. I'm having a bit of a slowness issue.

Basically, this query:

select * from `products` where `products`.`id` in ('1', '2', '3', '4', '5', '7', '8', '11', '14', '17', '18', '19', '20', '21', '22', '23', '24', '33', '35', '86', '101') and `products`.`deleted_at` is null

is fine. It doesn't take long to run at all, a few ms.

The code for it is as simple as:

$model = $this->model->with('products')->take(1500)->get();

I haven't added the pagination yet so I'm aware of that!

Anyway, another query which does the same just with less results, seems to be taking 4 seconds to load with Eager Loading, and 2 seconds without.

The slow query has quite a large IN clause, though...which I suspect is the problem.

select `product` from `accounts` where `accounts`.`product` in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112') and `accounts`.`deleted_at` is null
$model = $this->model->with('accounts')->take(100)->get();

I don't know if the IN clause is simply too big or there's an underlying problem that I'm not seeing/something I should investigate.

If I remove the "->with('products')" it'll load in 2 seconds, which still seems a bit much for 100 results.

The table structure is small, I'm only selecting 6 columns.

I appreciate any insights!

31 Oct
1 year ago

ddotgrass started a new conversation Does MongoDB Not Cascade?

Hey all!

I'm fairly new to MongoDB so I'm just trying to wrap my head around it. I'm using the "jenssegers/laravel-mongodb" package and whilst building my application, I realised that deleted entries weren't cascading.

Is that MongoDB specific or is something wrong somewhere?

Cheers!

20 Feb
2 years ago

ddotgrass left a reply on Internal Server Error On AMPPS

@Snapey his suggestion didn't work.

I just figured it out, though. It was because the code was using Bugsnag, which I was unaware of. I don't have the API key for it. Not sure why it wasn't logging the errors anywhere, though!

ddotgrass left a reply on Internal Server Error On AMPPS

@Snapey - it's on AMPPS, it's just "laravel.dev". If I go to a route that I know exits, like /login, the same problem persists. If I go to a route that doesn't exist, I get the standard Laravel stacktrace.

ddotgrass left a reply on Internal Server Error On AMPPS

@iMsIdZz - that's mostly just the default Laravel code? I already have that in there. I can see you've added "RewriteCond %{REQUEST_FILENAME} !-d" but that still did not work.

ddotgrass started a new conversation Internal Server Error On AMPPS

I've finally given up on this error message. I'm new to using AMPPS and there is nothing in the error logs. I've got debugging on and still, nothing.

I've dwindled it down to this line in /public/index.php

$response = $kernel->handle(
        $request = Illuminate\Http\Request::capture()
);

This isn't a fresh install of Laravel. My client has a Laravel site and I'm trying to work on it locally.

I am now stuck for ideas as to why this is happening! Any help will be much appreciated.

PHP version 5.6 Larvel version 5.1

12 Oct
3 years ago

ddotgrass left a reply on A Little Help Please On Streaming.

You can do this with WebRTC. PHP isn't really the language you're after for streaming. You can use WebRTC alongside PHP. For example; you might use WebRCT and post data to a PHP script, using the PHP script to save a video to your server.

30 Jul
3 years ago

ddotgrass started a new conversation Is There A Way To Pass Links To Custom Error Messages?

Hey all.

I'm trying to create a link in a custom validation error message.

E.g: 'email.unique' => 'Email has already been used, click here to see your stuff',

Basically, I'm creating a pre-registration. Users are assigned codes when they pre-register so they can see their referral count. If they forget they've signed up already, I want to give them a message "Email already used, click here to see who you've referred"...or something to that tune!

Cheers!

29 Jul
3 years ago

ddotgrass started a new conversation How Big Is Too Big?

Hi everyone.

Not sure if this has been asked before, but, I wanted to get some opinions from everyone. I've building quite a large site with Laravel at the moment, and I just stopped to think...how big is too big? Is Laravel up for the job of huge sites?

I'm working on a very, very large website at the moment for a client that has the potential to have over 100 models, if they are needed! The site has a lot of features and a lot of user activity going on.

I love Laravel and I'll continue using it, but just wanted to see what other Laravel developers thought.

10 Feb
3 years ago

ddotgrass left a reply on You Can Now Autocomplete Usernames

This is very handy, @JeffreyWay :D

ddotgrass left a reply on Detecting Request Type/format

Ah, sorry @toniperic - I didn't read the question properly!

Have you tried the header() function?

    public function header($key = null, $default = null)
    {
        return $this->retrieveItem('headers', $key, $default);
    }

ddotgrass left a reply on Detecting Request Type/format

You can use isJson() and wantsJson(). Also:

    public function ajax()
    {
        return $this->isXmlHttpRequest();
    }
````

To determine if the request is AJAX.

ddotgrass left a reply on Email Accounts Through DigitalOcean?

Probably best @nitrammit if you are unsure! Gmail is still excellent for your emails!

09 Feb
3 years ago

ddotgrass left a reply on Email Accounts Through DigitalOcean?

My understanding of DO is that you need to setup a mail server on your droplet. They tell you how to here: https://www.digitalocean.com/community/articles/how-to-install-and-setup-postfix-on-ubuntu-12-04

ddotgrass left a reply on Handlers

If you take a look at the Handlers directory, it has "Commands" and "Events". The Handlers directory is tasked with the logic involved when an Event or Command fires.

This Events lesson might be helpful to you :D https://laracasts.com/lessons/laravel-5-events

ddotgrass left a reply on Pass Data To Requests Or Middleware

@prodigy10 - check my above reply. You can use the Request method.

ddotgrass left a reply on Pass Data To Requests Or Middleware

Put the ID in the URL.


use Closure;
class checkFleet {

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        
        if($request->fleetID) 
        {

            $checkFleet = Fleet::where('id', '=', $request->fleetID)->first();
            
            if( !$checkFleet  )
            {
                //dostuff
            }
        }
        
        return $next($request);
    }

}

Obviously I'm assuming your Model is called "Fleet".

08 Feb
3 years ago

ddotgrass left a reply on L5 Comes With CSS?

I love Bootstrap, so I'm glad it comes with L5. I prefer Sass,though, but compiling with Sass is easy in L5 using Elixir!

ddotgrass left a reply on Where Do You Guys Store Your JSON Or Static Type Files?

Yeah, probably best you don't store them in public. I've only needed to store a JSON file once, so far, and I put it inside storage. When I work on a bigger project, I'll probably create a directory in there to store them, to make things neater.

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@nolros - this did not work either I'm afraid :( This is the strangest issue!

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@hostianer - I've set the Mailgun configuration, yes. It doesn't make it that far, though, because Laravel's Mail class always fails.

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@hostianer - I'm not using one. I tried Mailgun, but that failed. I've tried my servers SMTP, still nothing. Even "mail" and "sendmail" don't work. None of the drivers work.

ddotgrass left a reply on Laravel Scheduler

@danzar - that's a good idea. I like that, I think I will use it!

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@nolros - Tried that, too, before I even asked. I just tried again and still, nothing!

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - Set to "log" and still nothing!

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - I reverted back to the default mail.php seen here: https://raw.githubusercontent.com/laravel/laravel/master/config/mail.php - only I'm using "mail" as the driver, although, none of the others work either.

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - "something wrong"

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - that was just my bad typing, sorry. It does have an apostrophe in the script. I will update it.

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - yes, debug mode is on. No errors at all!

ddotgrass started a new conversation Laravel Scheduler

Just a quick question about Scheduler.

I have setup a scheduled task, and there's a chance this task is going to be processing a lot of data, it could take a long time to finish the task.

I need to run this task every 5 minutes, however. Let's assume the task runs for the first time and the task it's running takes 10 minutes to complete. Well, when it comes to run again 5 minutes later, that first task still has 5 minutes remaining, does it overwrite the current background process and start again or is a new process created?

ddotgrass left a reply on Searching For A Laravel Programmer With Free Capacities

@bashy "If you feel like you would like to do it, give me short financial quote and approx. time plan"

ddotgrass left a reply on Laravel 5 Mail(), Nothing Works

@xroot - done that, it doesn't seem to be writing anything to the log files. Even when I said the driver to "log".

ddotgrass left a reply on Where To Check For Authorization?

Use middleware for this situation. Then you only need one line of code in your constructor class to verify if the page/resource belongs to the user.

ddotgrass started a new conversation Laravel 5 Mail(), Nothing Works

Hi all,

I feel like I am being a little stupid here. I'm trying to use Laravel Mail(), I've edited my app/config/mail.php file and tried everything. I've tried using Mailgun, SMTP, mail, sendmail - nothing works. No matter what I do, an email never sends.

If I return Mail::failures() the email is always there.

At the moment, I'm just doing this inside of a controller to see if it'll send:

Mail::send('emails.blank', array('key' => 'value'), function($message) { $message->from('xxxxx@xxxx.com); $message->to('xxxxx@xxxx.com', 'John Smith')->subject('Welcome!'); });

Any help would be much appreciated!