mfoote

mfoote

Member Since 2 Years Ago

Atlanta

Director of Innovation & Technology at SpineCenterAtlanta

Experience Points 6,250
Experience Level 2

3,750 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 43
Lessons
Completed
Best Reply Awards 1
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.

27 Nov
2 months ago

mfoote started a new conversation Email Verification And Queue

Does anyone know off-hand if there is a "switch" that will for the built-in email verification in Laravel 5.7 to turn on the ShouldQueue ? I did not see anything in the docs.

mfoote left a reply on Self Relation On Model With Date Constraint - Possible?

Closing this as no good answer.

26 Nov
2 months ago

mfoote left a reply on Can Not Change Mailable Subject If ShoulQueue Is Implemented

I discovered how to correct this, the setup must be done in the construct, not the build. I know the documents say in the build but, in my case...

...
class SendDocument extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($filename)
    {
        $this->subject('Your Document Request');
        $this->attachFromStorageDisk('docs', '/tmp/' . $filename, [
            'mime' => 'application/zip'
        ]);
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.send.document');
    }
}
...

mfoote left a reply on Can Not Change Mailable Subject If ShoulQueue Is Implemented

I have this same issue, did you figure this out?

13 Nov
3 months ago

mfoote left a reply on Return Named Route With Parameter AND Model

I also tried that as well, it doesn't seem to look into the relation to find the user because it expects the returned document to hold the ID for {user}.

I understand there are many ways to do this, I just find it odd that there is no way to pass a second model to a named route w/o actually adding it as a second parameter in the route itself.

Your first solution is good and is the way i will do it if there is no other way.

I should also mention that much of this is dynamically driven and loaded via ajax, I dont always know the documents actual id without using the dynamic relation you see in the code above.

mfoote left a reply on Return Named Route With Parameter AND Model

@ANDREICH1980 - I also tried that as well, it doesn't seem to look into the relation to find the user because it expects the returned document to hold the ID for {user}.

I understand there are many ways to do this, I just find it odd that there is no way to pass a second model to a named route w/o actually adding it as a second parameter in the route itself.

Your first solution is good and is the way i will do it if there is no other way.

mfoote left a reply on Return Named Route With Parameter AND Model

@ANDREICH1980 - I have considered that but would like to know if I am missing another way to do it.

mfoote started a new conversation Return Named Route With Parameter AND Model

Issue: Sessions flash is remaining on user refresh of browser, cause appears to be because I am returning a view instead of redirecting.

Route is...

...
Route::get('/document/user/{user}/manage', '[email protected]')->name('doc.user.manage');
...

I need to convert the following...

public function manageByType(User $user, $type)
    {
        $updated = false;
        $doc = '_document_' . $type;
        $user->load($doc);
        ...
        return view('document.user.' . $type . '.index', compact('document'));
    }

to something like this...

public function manageByType(User $user, $type)
    {
        $updated = false;
        $doc = '_document_' . $type;
        $user->load($doc);
        ...
       return redirect()->route('doc.user.manage', ['user' => $user->id]);
    }

I need to return the $document model, but the $user information in not available in it so i can not do...

 return redirect()->route('doc.user.manage', [$document]);
11 Jun
8 months ago

mfoote left a reply on Self Relation On Model With Date Constraint - Possible?

@tiagotavares the issues is I dont have $date it needs to come from the existing record. If I had the date, there would be no issue.

07 Jun
8 months ago

mfoote left a reply on Get All Users

Try...

public function allUsers() {
    $users = User::all();
    return view('admin', compact('users));
  }

mfoote left a reply on Self Relation On Model With Date Constraint - Possible?

it returns null, I think this is because $this is of a different scope in my situation, due to the fact I am doing this via the controller, not a loaded model. I think i need to somehow limit it in the query inside...

->with([
                '_previous_calls' => function ($query) {
//here
                },

mfoote left a reply on Self Relation On Model With Date Constraint - Possible?

@adamprickett ani is not a unique column in the table, id is the unique column. The relation above works if I remove the ->where('start_time', '<', $this->start_time). My issue is I only want records previous to the current selection.

mfoote started a new conversation Self Relation On Model With Date Constraint - Possible?

I am trying to figure out how to ask this...

Is it possible to add a relation to self and then exclude anything newer than the current selection....

I am trying to determine if a call is unique by determining if a Call has Calls before the Current Call- I know crazy way to ask it heh... but basically this...

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;


class Call extends Model
{
    
    public function _previous_calls()
    {
    return $this->hasMany('App\Call', 'ani', 'ani')->where('start_time', '<', $this->start_time);
    }

}

it seems like $this->start_time is not valid because i am eager loading in my controller.

29 May
8 months ago

mfoote left a reply on Is There Any Drag-and-drop Studio/builder For Laravel?

English MFers... do you speak it...

25 May
8 months ago

mfoote left a reply on Best Way To Implement "download" Reports Feature With Pagination

@TuffRivers are you wanting to only download what is showing on the paginated screen or just strip the pagination and download?

mfoote left a reply on Switch Table On Model - For Staging - Possible?

@m-rk great idea, I will try that and get back... thank you for the input.

mfoote left a reply on Switch Table On Model - For Staging - Possible?

@m-rk I use laravel as an ETL tool to sync a medical database, there would never be anything relation based involved, it is a one-shot sync of data.

This would be a way to allow me to load a staging table without affecting the current "live" table.

It is basically a way to reload the "sync". After loading the "stage" table I would run a command that pause the "live" sync, rename the live table to "users_obs", rename "stage" table to "users" and then restart the live sync.

As it is now, I have to pause the entire ETL system to reload a table.

mfoote left a reply on Need Help For Url Creation

I'd stay away from dashes, perhaps use underscore _

That made me lol...

mfoote started a new conversation Multiple Tables On Model - For Staging - Possible?

Is is possible to do something like the following to allow switching tables when staging synchronized data?

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    protected $table = 'users';
    use Notifiable;

    /**
     * Changes model to store to staging table.
     */
    public function stage(){
        $this->table = 'users_stg';
    }
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}
Then instantiate the model like...
05 Mar
11 months ago

mfoote left a reply on User Defined Fields & Eloquent

I actually found something based on another question answered by @meeshka , thank you meeshka! I am using rinvex/attributes).

mfoote started a new conversation User Defined Fields & Eloquent

Has anyone come up with a solid eloquent structure for allowing users to define their own columns to extend a model? A couple examples would be like Saleforce or Zoho extend Leads and Contacts. I knwo i can create a secondary table that has id | foreign_model_id | column_name | column_value. My concern is how do you effeciently do look ups based on varying datatypes in the extension table. do you something like ->wherRaw("cast...?

mfoote left a reply on Making Form Fields And Labels Custom Laravel

@bashy how would you handle look ups on dates, neumerics, etc? would you simply do a cast in the where statement?

06 Feb
1 year ago

mfoote left a reply on There Are No Commands Defined In The "command" Namespace.

Did you create the commands via...

php artisan make:command --command=command:ClearNotificationsTable

I did a test with the same naming in 5.5 and it worked fine... just curious if the command is not in the correct directory.

mfoote started a new conversation Best Way To Capture Notifiable Email Failures

When sending an email, at times I will get a failure do to gmail bombing. What is the best way to capture these types of errors? Is it as simple as the following?

try {
      $user = User::find($userId);
      $notifications = [];
      $token = []
      $user->notify(new NotificationEmail($token, $user, $notifications));
      } catch (\Exception $e) {
        \do logging here
      }
11 Dec
1 year ago

mfoote left a reply on Transfer Server To Another Forge Account

You can do this under Server Details->Meta

04 Dec
1 year ago

mfoote left a reply on BadMethodCallException: Method Update Does Not Exist

Just do, $product = Product::find($id); unless I am missing something, why do you need the user?

01 Dec
1 year ago

mfoote left a reply on Post Data Not Send When Word "from" MethodNotAllowedHttpException In RouteCollection.php Line 218

Looking at the image you attached, and your statement that it works with the word of but not when the word is from, it seems like laravel is trying to protect against SQL Injection.

mfoote left a reply on BelongsTo Vs. HasOne... Yes... Again With This...

@mikefolsom Thank you for the reply, this clears up a lot.

30 Nov
1 year ago

mfoote left a reply on Schema DefaultStringLength 191 -- How To Make It 255?

Understood, I do recall having that same issue at one point.

mfoote left a reply on Stupid GetAttribute() Question

Taylor has the right opinion... in my opinion ;)

mfoote left a reply on BadMethodCallException: Method Update Does Not Exist

@jorpedito They aren't resourcing the route, so it has to be done in a non-standard way, splendidkeen's controller is not called ProductController.

mfoote left a reply on Schema DefaultStringLength 191 -- How To Make It 255?

Does this not work?

$table->string('field', 255);

mfoote left a reply on BadMethodCallException: Method Update Does Not Exist

I did some editing after I looked at your controller more.

Seriously though, look at route resourcing, its amazing. you can create a model and while you do it, prebuild your migration and controller/methods with one command.

Route::resource('product', 'ProductController')

and

php artisan make:model Product -mcr

you are half done!

mfoote left a reply on BadMethodCallException: Method Update Does Not Exist

What version of Laravel are you on? if 5+ try

Route::group(['middleware' => 'auth'], function () {
  Route::post('/product/{id}/update', '[email protected]');
});

and in your form...

<form class="form-vertical" role="form" action="/product/<the id of product>/update" method="POST">

You should look into the resourcing built into routes in laravel, it builds the routes for you in a standard format. With it you can do...

Route::resource('product', 'ProductController')

And it will build all the routes needed to manage a resource.

mfoote left a reply on BadMethodCallException: Method Update Does Not Exist

Did you run php artisan route:list and verify the routes are valid? /edit seems lacking.

mfoote left a reply on Route Question

Or since you are writing them anyway...

Route::put('/authors/handle/{id}/state', '[email protected]');

Route::put('/authors/handle/{id}/opinion', '[email protected]');

mfoote started a new conversation BelongsTo Vs. HasOne... Yes... Again With This...

I know this is like beating a dead horse, but I still get baffled by this. It appears to be very relevant to the name of the function.

Case & Point...

I have a table called system_logs, the table has a type id column system_log_type_id, as well as, a table called system_log_types with a id column. A system log can only have one type.

That said, the following will not work...

/**
     * Get the type this log belongs to.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function type()
    {
        return $this->belongsTo('App\SystemLogType');
    }

Yet this does....

/**
     * Get the type this log belongs to.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function system_log_type()
    {
        return $this->belongsTo('App\SystemLogType');
    }

These also work...

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function type()
    {
        return $this->belongsTo('App\SystemLogType', 'id');
    }


    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function type()
    {
        return $this->hasOne('App\SystemLogType', 'id', 'system_log_type_id');
    }

Am I to assume that the backtrace uses the function name as opposed to the actual relation, 'App\SystemLogType', to do the look up?

14 Nov
1 year ago

mfoote left a reply on Undefined Offset Error

Are you sure it’s not $id causing the issue? Try Auth::user()->I’d.

mfoote started a new conversation Google APi W/ Calendar - Response Empty

I am running the following code ins a console command...

        $cfg = Config::get('calendar');
        $client = new \Google_Client();
        $client->setApplicationName('Test Application');
        $client->addScope(\Google_Service_Calendar::CALENDAR);
        $client->setAuthConfig($cfg['authConfig']);
        $service = new \Google_Service_Calendar($client);
        $calendarList = $service->calendarList->listCalendarList();
        while(true) {
            foreach ($calendarList->getItems() as $calendarListEntry) {
                echo $calendarListEntry->getSummary();
            }
            $pageToken = $calendarList->getNextPageToken();
            if ($pageToken) {
                $optParams = array('pageToken' => $pageToken);
                $calendarList = $service->calendarList->listCalendarList($optParams);
            } else {
                break;
            }
        }

Authentication is fine, everything seems to work, but I get back an empty array for getItems()

Not sure what i am missing. Let me know if you need more info, i am getting a response, iit is always just "itemless" the i have 4 test calendars on the account.

04 Oct
1 year ago

mfoote left a reply on Complex MSSQL Procedure Call In Laravel?

Thanks, i will try that out. and let you know.

mfoote started a new conversation Complex MSSQL Procedure Call In Laravel?

Any idea how one would go about running the following in Laravel Query Builder?

DECLARE @out_Foo_Share_Header_ID int;
DECLARE @out_Message nvarchar(500);


SET @out_Foo_Share_Header_ID = NULL;
SET @out_Message = NULL;

EXEC Curb.stage.sp_Foo_Share_Generate_Data
    @p_title = 'This is the Title',
    @p_description = 'Here the Description can be long or short and is not required',
    @p_sale_ym = 201701,
    @p_include_chittlins = 'Yes',
    @p_dsp_service_names_csv = '1, 2, 3, 4',
    @p_userid = 'Foo guy',
    @out_Foo_Share_Header_ID = @out_Foo_Share_Header_ID out,
    @out_Message = @out_Message out;
22 Sep
1 year ago

mfoote left a reply on Raw HTML Showing In Notification Email.

I discovered what the issue was, when you paste something into a blade in PHPStorm, it automatically formats it like this...

@component('mail::message')
    # Final step...

    Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below.

    @component('mail::button', ['url' => $user->email_verification_url])
        Confirm now
    @endcomponent

    Thanks,

    {{ config('app.name') }}
@endcomponent

Since it is markdown it can not have indents in it, i changed it like you see below and it corrected everything.

@component('mail::message')
# Final step...

Confirm your email address to complete your Twitter account {{ $user->username }}. It's easy — just click the button below.

@component('mail::button', ['url' => $user->email_verification_url])
Confirm now
@endcomponent

Thanks,

{{ config('app.name') }}
@endcomponent

Worry for wasting your time!

mfoote left a reply on Raw HTML Showing In Notification Email.

I think its just a bad tutorial, it refers to controllers that are non-existent, I am working through it and will let you know what I find out. You can see the code in my original question, click the HERE link.

mfoote left a reply on Raw HTML Showing In Notification Email.

The strange thing is, the top and bottom of the email of HTML and fine, just the button is broken.

alt text

mfoote started a new conversation Raw HTML Showing In Notification Email.

I have run into this before but don't remember how I resolved it, I was following a tutorial HERE. Everything works as intended except get the following in the email...

Final step...

Confirm your email address to complete your account. It's easy — just click the button below.

<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
    <td align="center">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align="center">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <a href="http://example.com/verify/email/n79ldQAFyUlGam7EatImVXuOkbqBb1adm874i54rt2NtM9ssYPrwqnpjHSkm" class="button button-blue" target="_blank">Confirm now</a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </td>
</tr>

It seems like it is the difference between {{ $var }} & {!! $var !!} but it doesnt show changing any of the cor code to make this work.