jgravois

jgravois

Technical Manager at Universal Asset Management

Member Since 5 Years Ago

Memphis

Experience Points
117,395
Total
Experience

2,605 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
1224
Lessons
Completed
Best Reply Awards
2
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 24
117,395 XP
Sep
09
1 month ago
Activity icon

Started a new Conversation Using Eloquent's Cursor To Populate Vuex

I have read what I could find about using the new cursor() function in eloquent to load huge datasets and it sounds like something I desperately need.

What I can't seem to find is how to use these to load the vuex store in vue.js. Does anyone have a resource to point me to?

Thanks

Activity icon

Replied to Laravel 6 And Nuwave/Lighthouse

I have the database seeded with 12 users, hooked up in the .env file.

The graphiql interface isn't even loading at https://l6lh.test/graphql

Instead I get a huge json dump

/ 20190909061121
// https://l6lh.test/graphql

{
  "message": "Return value of Nuwave\Lighthouse\Execution\BaseRequest::query() must be of the type string, null returned",
  "exception": "Symfony\Component\Debug\Exception\FatalThrowableError",
  "file": "/Users/jgravois/code/l6lh/vendor/nuwave/lighthouse/src/Execution/BaseRequest.php",
  "line": 50,
  "trace": [
    {
      "file": "/Users/jgravois/code/l6lh/vendor/nuwave/lighthouse/src/GraphQL.php",
      "line": 110,
      "function": "query",
      "class": "Nuwave\Lighthouse\Execution\BaseRequest",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php",
      "line": 92,
      "function": "executeRequest",
      "class": "Nuwave\Lighthouse\GraphQL",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php",
      "line": 69,
      "function": "executeBatched",
      "class": "Nuwave\Lighthouse\Support\Http\Controllers\GraphQLController",
      "type": "->"
    },
    {
      "function": "query",
      "class": "Nuwave\Lighthouse\Support\Http\Controllers\GraphQLController",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
      "line": 54,
      "function": "call_user_func_array"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
      "line": 45,
      "function": "callAction",
      "class": "Illuminate\Routing\Controller",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
      "line": 219,
      "function": "dispatch",
      "class": "Illuminate\Routing\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
      "line": 176,
      "function": "runController",
      "class": "Illuminate\Routing\Route",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 680,
      "function": "run",
      "class": "Illuminate\Routing\Route",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 130,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/nuwave/lighthouse/src/Support/Http/Middleware/AcceptJson.php",
      "line": 30,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Nuwave\Lighthouse\Support\Http\Middleware\AcceptJson",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 105,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 682,
      "function": "then",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 657,
      "function": "runRouteWithinStack",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 623,
      "function": "runRoute",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 612,
      "function": "dispatchToRoute",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 176,
      "function": "dispatch",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 130,
      "function": "Illuminate\Foundation\Http\{closure}",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
      "line": 27,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
      "line": 62,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/fideloper/proxy/src/TrustProxies.php",
      "line": 57,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 171,
      "function": "handle",
      "class": "Fideloper\Proxy\TrustProxies",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 105,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 151,
      "function": "then",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 116,
      "function": "sendRequestThroughRouter",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/code/l6lh/public/index.php",
      "line": 55,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/jgravois/.composer/vendor/laravel/valet/server.php",
      "line": 147,
      "function": "require"
    }
  ]
}
Activity icon

Started a new Conversation Laravel 6 And Nuwave/Lighthouse

Hi. I use the Laravel Lighthouse package to implement GraphQL in Laravel. I just installed a fresh version of Laravel 6 and followed this tutorial (https://www.toptal.com/graphql/laravel-graphql-server-tutorial). When I try to test the first query, I get this

Return value of Nuwave\Lighthouse\Execution\BaseRequest::query() must be of the type string, null returned",

In phpStorm, if I hover over user in code below, phpStorm reports "tried to use an undeclared directive @find"

type Query {
    user(id: ID! @eq): User @find
    users: [User!]! @all
}
Sep
02
1 month ago
Activity icon

Replied to Model Observer Strips Out Required Fields

you are right in the the Staff doesn't need to know about the other stuff. Would probably cause an S-Storm down the road.

I will go with a StaffService as you suggested.

Thanks for your guidance.

Activity icon

Started a new Conversation Model Observer Strips Out Required Fields

I have a Users table and a Staff table wherein a User can be on staff. The Sales Director is authorized to create new external users and I am limiting their exposure to only their company's portal. Since the Users table controls authentication, staff members must also be Users and I don't expect our Human Resources team to remember to create a user FIRST and then a staff member so I added an Observer to automatically create the User for a new Staff. However, the Observer seems to be stripping out the fields needed by the User table (I am using $fillable on the Staff table to ignore the posted values not saved in the Staff table).

Here's my test

/** @test */
    function StaffCreatedWillGenerateUser () {
        $this->withoutExceptionHandling();

        $user = factory(User::class)->states('staff')->create();

        $attributes = [
            'user_id' => $user->id,
            'badge' => $user->badge,
            'firstName' => $user->firstName,
            'lastName' => $user->lastName,
            'email' => $user->email,
            'title' => 'Title',
            'department' => 'Department, Department',
            'can_drive' => true,
            'can_manage' => true,
            'is_management' => true,
            'is_leadership' => true,
            'is_developer' => $this->faker->boolean,
            'is_active' => $this->faker->boolean,
            'is_online' => $this->faker->boolean,
            'is_ontask' => $this->faker->boolean,
            'is_paused' => $this->faker->boolean,
            'status' => 'available',
            'avatar' => $this->faker->word,
            'manager_id' => 1,
            'location_id' => 1,
            'extension' => 100,
            'direct_line' => '901.867.5309'',
            'cellphone' => '901.867.5309',
            'skype' => $user->firstName . '.' . $user->lastName,
            'dob' => $this->faker->date(),
            'anniversary' => $this->faker->date(),
        ];

        $this->post('/api/staff', $attributes);

        $this->assertDatabaseHas('staff', $attributes);
        $this->assertDatabaseHas('users', $attributes['email']);
    } // end test

This is my Observer:

<?php

namespace App\Observers;

use App\Models\Staff;
use App\User;

class StaffObserver
{
    public function creating(Staff $staff)
    {
        $xtant = User::whereEmail($staff->email)->first();

        if(!$xtant) {
            $user = User::create([
                'firstName' => $staff->firstName,
                'lastName' => $staff->lastName,
                'email' => $staff->email,
                'badge' => $staff->badge,
                'email_verified_at' => now(),
                'password' => bcrypt('!' . $staff->lastName . '@comp'),
                'company_id' => 1
            ]);

            $staff->user_id = $user->id;
        } else {
            return true;
        } // end if

    } // end function
}

And my StaffController:

<?php

namespace App\Http\Controllers;

use App\Models\Staff;
use Illuminate\Http\Request;

class StaffController extends Controller
{
    public function store()
    {
        return Staff::create(request()->all());
    } // end function
}

ANY suggestions are welcome!

Jul
01
3 months ago
Activity icon

Replied to Upload To DigitalOcean Spaces - Strange Destination

$upload_success = Storage::disk('spaces')->putFileAs("RMA/{$id}/", $file, $fileName, 'public');

(red faced)

Activity icon

Replied to Upload To DigitalOcean Spaces - Strange Destination

My expected outcome is for the file to be at

650 shop_report.pdf

so, I need to manipulate $file to achieve that?

Activity icon

Started a new Conversation Upload To DigitalOcean Spaces - Strange Destination

I am uploading a file to DO Spaces using this code with the data-points of (id: 650, doc: 'shop_report')

public function doc_upload(Request $request)
    {
        $file = $request->file('file');
        $id = $request->id;
        $doc = $request->doc;
        $ext = $file->getClientOriginalExtension();

        $fileName = $doc . '.' . $ext;
        $upload_success = Storage::disk('spaces')
            ->putFileAs("RMA/{$id}/$file", $file, $fileName, 'public');

        if ($upload_success) {
            $rma = ReturnsRequest::whereId($id)->first();
            $rma[$doc] = $fileName;
            $rma->save();

            return $rma;
        } else {
            return response()->json('error', 419);
        } // end if
    } // end function

On Spaces, I get the following structure:

650
    private
        var
            tmp
                phpUaKP8q
                    shop_report.pdf

Any insight is welcome.

May
12
5 months ago
Activity icon

Started a new Conversation Zipping DO Spaces Files To Download

I need to zip all the files in a directory on DigitalOcean Spaces and force the download.

I found the ZIPPER package and locally it works very easily.

$files = glob(public_path('images/aircraft/*'));
Zipper::make(public_path('test.zip'))->add($files)->close();
return response()->download(public_path('test.zip'));

I set up a Spaces Disk in filesytem.php but can't figure out how to make it work the same way.

$docs = Storage::disk('spaces')->files($path);

gives me a list of files but that is paths to files not something to glob.

I've tried and tried with no luck and was hoping for a bit of assistance.

Thanks in advance.