num3thod

num3thod

Member Since 4 Years Ago

ottawa on

Lead Software Architect at Homicity Inc.

Experience Points 18,410
Experience Level 4

1,590 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 235
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

18 Jul
2 years ago

num3thod started a new conversation Struggling To Retrieve Users By Role

Hi, I have a relatively simple need to retrieve Users of a certain role, which is defined on a pivot table called assigned_roles.

my User model ''' public function roles() { return $this->belongsToMany(config('access.role'), config('access.assigned_roles_table'), 'user_id', 'role_id'); } '''

10 Feb
3 years ago

num3thod started a new conversation Problems With The Default Removal Of WWW

This has been haunting me for the past three days. Basically, on my latest L5.1 project, whenever I type WWW.domain.com it removes it perfectly. But if I type WWW.domain.com/path, it rewrites to domain.com/index.php/path, thus breaking the page.

In my .htaccess, I've tried other variants such as:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteCond %{HTTPS}:s (on:(s)|off:s)
RewriteRule ^(.*)$ http%2://domain/$1 [R=301,L]

The default is:

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

Has anybody experienced this? Any advice would be extremely appreciated. Thanks.

06 Feb
3 years ago

num3thod left a reply on Yet Another Mailgun Question. Please Help.

Yeah, it seems to be a DNS issue. VPS hosts website -> GoDaddy manages email accounts (I know)

I will simply post to another L5 project that has no issues with smtp. Thanks.

num3thod started a new conversation Yet Another Mailgun Question. Please Help.

So I've used mailgun/mandrill in the past without issues. But on this Laravel 5.1 project, I am constantly getting timeouts on live. The error message says "Connection could not be established with host smtp.mailgun.org [Connection timed out #110]".

Yet, I am specifically using the Mailgun driver. Laravel should not be attempting to connect through SMTP (which is blocked by my hosting provider). What is going on here? How do I force Laravel to use the mailgun driver and NOT try smtp?

MAIL_DRIVER=mailgun
'mailgun' => [
        'domain' => env('mydomain.com'),
        'secret' => env('key-a2d3f9XXXXXXXXXXXXXXX'),
    ],
01 Feb
3 years ago

num3thod left a reply on Is There A Way To Append A URL Param From A Controller?

SOLVED. Was an error within my manual paginator.

31 Jan
3 years ago

num3thod started a new conversation Is There A Way To Append A URL Param From A Controller?

I just need to append &page=1 when returning the view.

The reason is that my manual paginator is sorting my filtered results incorrectly on the first page (which does not contain the page param).

Thanks in advance.

28 Jan
3 years ago

num3thod left a reply on I Simply Need To Retrieve An Item From A Collection.

SOLVED. Changed to whereLoose. So $result = $collection->whereLoose('id', $search_input)->all();

num3thod left a reply on Mandrill Not Able To Send Mails.

Try to simply change to the 'smtp' driver. I always have to fuss around to set it up on my VPS.

num3thod started a new conversation I Simply Need To Retrieve An Item From A Collection.

Greetings,

So I have this table/model that has, obviously, an id column. I want to retrieve a specific row based on its id value. I also want to do this NOT as an eloquent query, but rather a sexy Laravel Collection method (because I want to further manipulate said collection).

For some reason, I keep getting an empty array as a result.

Here is a sample snippet:

$search_input = Input::get('search_input');
$collection = MyModel::all();
$result = $collection->where('id', $search_input);
dd($result); //Always comes back empty
//RESULT
Collection {#475 ▼
  #items: []
}

Also tried:

$search_input = Input::get('search_input');
$collection = MyModel::all();
$result = $collection->where('id', $search_input)->all(); //added the ->all();
dd($result); //Always comes back empty
//RESULT
[]

Also tried:

$search_input = Input::get('search_input');
$collection = MyModel::all();
$result = $collection->where('id', $search_input)->all(); //added the ->all();
dd($result); //Always comes back empty
//RESULT
[]

Also tried first(), and bunch of other methods. But no matter what I try, I can't seem to retrieve that darn dow. Thanks in advance.

17 Jan
3 years ago

num3thod started a new conversation Bizarre ErrorException When Chaining Two Where Clauses To Retrieve A Specific Row

Hi, I'm wondering if I am going crazy here, or if I am not doing this the right way.

Basically, I am trying (and succeeding) to get a specific row in the following manner:

$myRow = Table::where('COLUMN1', $value1)->where('COLUMN2', $value2)->first();
echo $myRow->COLUMN3;

Issue is that Laravel is returning "Trying to get property of non-object", yet also returning the correct row as if everything was a-ok. Die and dump tells me the correct row was returned.

What am I doing wrong here?

Many thanks in advance.

MR

20 Sep
3 years ago

num3thod left a reply on Intervention Image Upload - Ajax Post Problem

Solved by ditching $.post and replace with a proper $.ajax call. So umm, $.post sucks.

num3thod left a reply on Intervention Image Upload - Ajax Post Problem

Additional/missing details:

I am getting a http 200 from the laravel post handler. Just not getting into the if (Input::hasFile('file')) condition.

num3thod started a new conversation Intervention Image Upload - Ajax Post Problem

Hi, I've been banging my head for hours now trying to figure out why Laravel doesn't seem to get the ajax post data for a file upload.

Specifically, Laravel seems to be unable to "read" the posted object data. Or, at least, I'm going about it the wrong way.

My approach: 1- retrieve the file object 2- post to laravel 3- save file and return success message (pretty simple stuff)

My code:

//JS
uploadElement.on("drop", function (e) {
   e.preventDefault();
   var file = e.originalEvent.dataTransfer.files[0];
   handleFileUpload(file);
});

function handleFileUpload(file) {
   var theImage = file;
   $.post('upload', {
      file: file
   }, onSuccess);
}

function onSuccess(data, status, xhr) {
   console.log(data, status, xhr);
}
//PHP
Route::post('upload', function(){
   $data = Input::get('file');
   if (Input::hasFile('file'))
   {
      $file = Input::file('formData');
      $file->move('public/uploads', 
      $file->getClientOriginalName());
      $image = Image::make(sprintf('public/uploads/%s', $file->getClientOriginalName()))->resize(200, 200)->save();
      return "YES F**K YES!";
      }
   return $data;
   //returns "[]"
});

Any help or insight or even vaguest of hints would greatly appreciated.

Thanks,

MR

02 Jul
3 years ago

num3thod left a reply on Is There A Way To Pass A Call To A Partial Though {!! MyVariable !!}?

Many thanks @constb! This is what I will try. Will report back when completed.

num3thod started a new conversation How To Use BladeCompiler Method?

I ran into this http://laravel.com/api/5.1/Illuminate/View/Compilers/BladeCompiler.html#method_compileString today and am trying to use it to compile a string I have.

I am trying return view::compileString($myString);

but am getting Call to undefined method Illuminate\View\Factory::compileString()

Any ideas? Thanks.

01 Jul
3 years ago

num3thod left a reply on Is There A Way To Pass A Call To A Partial Though {!! MyVariable !!}?

@constb Thanks for the suggestion. Can you give me an example of how I would create the shortcodes?

num3thod left a reply on Is There A Way To Pass A Call To A Partial Though {!! MyVariable !!}?

@polarcubs Actually no. I do know how to call partials straight up in my view, as you indicated. What I am trying to do is call a partial from my blog posts content, like you would a Wordpress shortcode. I searched and searched, but am not seeing an effective way to do this.

30 Jun
3 years ago

num3thod started a new conversation Is There A Way To Pass A Call To A Partial Though {!! MyVariable !!}?

Ok, I know this is going to sound bizarre, but hear me out. I created a simple blog, and I'd like to be able to call Blade partials from the blog post body (content) area when composing a post. Similar to how shortcodes work in Wordpress.

Obviously, when I try inserting @include('includes.partials.test') it ignores it and shows it as a string.

Any ideas? I am aware that there are composer packages for shortcodes, but I'd prefer sticking to pure Laravel if possible.

Thanks in advance.

MR

16 Jun
4 years ago

num3thod left a reply on Postgres Db Seeding

@ldruneau You are right, and yes, with a few extra adjustments, the seeding is now working.

1- comment out DB::statement('SET FOREIGN_KEY_CHECKS=0;'); and DB::statement('SET FOREIGN_KEY_CHECKS=1;'); 2- follow this guide for the truncate statements http://espadav8.co.uk/2015/03/04/laravel-database-seeding-with-postgresql/

Thanks.

num3thod started a new conversation Postgres Db Seeding

I am getting the following error when attempting to seed my Postgres db

SQLSTATE[42704]: Undefined object: 7 ERROR: unrecognized configuration parameter "foreign_key_checks" (SQL: SET FOREIGN_KEY_CHECKS=0;)

The only other mention I could find is this post

https://laracasts.com/discuss/channels/eloquent/foreign-key-constraints-on-seeding

Yet, nothing on how to configure DatabaseSeeder.php for Postgres seeding.

Thanks.

num3thod left a reply on Foreign Key Constraints On Seeding

@rdelorier What should be done Postgres?

09 Jun
4 years ago

num3thod left a reply on Database Query Builder Question

@bestmomo Never mind. Got it. Woo!

num3thod left a reply on Database Query Builder Question

@mstnorris Hey, I was wondering if you could explain this line $id = $this->blog ? ',' . $this->blog : '';

I have everything setup, but am struggling to adapt this bit to my scenario. Thanks.

num3thod left a reply on Database Query Builder Question

@bestmomo Oh man. That's the right (clean) way to do this. Was my first hunch, but got lazy ; )

Anyways, thank you all for the tips.

Cheers.

num3thod left a reply on Database Query Builder Question

@mstnorris Thanks. I'll try that now.

num3thod started a new conversation Database Query Builder Question

I created a simple blog (for learning). Let's say I want to update a page's slug, but want to query my database to see if the new slug is already used by another page.

My code looks like this

$page->slug = Input::get('slug');
if (Page::where('slug', '=', $page['slug'])->first()) {
            throw new GeneralException('That slug has already been used.');
    } else {
            $page->save();
            return redirect()->route('admin.access.pages.index')->withFlashSuccess('The page was successfully updated.');
    }

My problem is that I am catching the very page I am updating, thus it will always throw the exception. How would I exclude "this" page from my query?

Hoping this makes sense. I looked and looked, but alas, nothing. Thanks in advance.