hippo

Member Since 1 Year Ago

fresburg

engineer at home

Experience Points 11,300
Experience Level 3

3,700 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 108
Lessons
Completed
Best Reply Awards 0
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.

12 May
2 months ago

hippo left a reply on Nova Integrity Constraint Violation: Actionable Id Cannot Be Null

This problem was solved by not extending Pivot, but instead sticking with extending Model

class DatasheetJob extends Model

//...

hippo left a reply on Nova Integrity Constraint Violation: Actionable Id Cannot Be Null

Well heres an update: I realize now that the belongsto field is a relationship so it's apparently not returning a field for the sql - So here's my updated code so that I can send it correctly to backend

    public function fields(Request $request)
    {
        $jobs = Job::all()->sortBy('name')->pluck('name', 'id');
        $datasheets = Datasheet::all()->sortBy('model_number')->pluck('model_number', 'id');

        return [ 
            ID::make()->sortable(),
            
            BelongsTo::make('Job')->searchable()
                ->hideWhenCreating()
                ->hideWhenUpdating(),
            
            Select::make('Job Id')->options( $jobs )->onlyOnForms(),
            
            BelongsTo::make('Datasheet')->searchable()
                ->hideWhenCreating()
                ->hideWhenUpdating(),
            
            Select::make('Datasheet Id')->options( $datasheets )->onlyOnForms(),
            
            Number::make('Quantity')->min(1)
        ];
    }

but I get the same integrity constraint violation: actionable_id must not be null error.

I have the actionable trait on both Job and Datasheet classes.. if that helps.. ugh.

11 May
2 months ago

hippo started a new conversation Nova Integrity Constraint Violation: Actionable Id Cannot Be Null

I'm not too sure what I'm doing wrong here and I'm desperately stuck: I am making a nova resource for a pivot table (datasheetjobs) and I have no issues when I edit an existing resource, but when I try to create a new one I get an integrity constraint violation actionable_id cannot be null.

I am guessing it is not creating the model because of the relationship field.. can someone clarify what I should be doing?

Let me know if you need more code- thanks in advance!

class DatasheetJob extends Pivot
{

    protected $fillable = [
        'job_id',
        'datasheet_id',
    'quantity'
    ];
    
    function job() {
        return $this->belongsTo(Job::class);
    }

    function datasheet() {
        return $this->belongsTo(Datasheet::class);
    }
    
    public $timestamps = false;

}


class DatasheetJob extends Resource
{

    // ...

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
            BelongsTo::make('Job')->searchable(),
            BelongsTo::make('Datasheet')->searchable(),
            Number::make('Quantity')->min(1)
        ];
    }
}



21 Apr
3 months ago
14 Apr
3 months ago

hippo left a reply on Issues With Serialization Of Uploaded File

The issue here was in the nova documentation: The issue was mainly in using queuable with file uploading. I also changed the storage code to function better. Hope this helps someone!

class ProvideMoreInformationFor extends Action
{
    use SerializesModels;

   /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
        foreach($models as $job) {
            $fields->file->storeAs('jobs/'.$job->folder, $fields->file->getClientOriginalName(), 'local');
        }
    }

    /**
     * Get the fields available on the action.
     *
     * @return array
     */
    public function fields()
    {
        return [
            File::make('File')->disk('local')->rules('required')
        ];
    }
}

hippo started a new conversation Issues With Serialization Of Uploaded File

Hey guys, I'm confused- I'm trying to use a App\Nova\Action to upload a file.. Can someone help me understand the best practice for this? As is, I get error Serialization of UploadedFile is not allowed.

Thanks in advance!

class ProvideMoreInformationFor extends Action implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;

   /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
        if($models->count() > 1) {
            return Action::danger('You can only do this for one job at a time.');
        }
        
        foreach($models as $job) {
            $file = Storage::get($fields->file);
            Storage::move($fields->file, "/app/jobs/" . $job->folder . "/" . $file->getClientOriginalName());
            Action::message('Added file to Job!');
        }
    }

    /**
     * Get the fields available on the action.
     *
     * @return array
     */
    public function fields()
    {
        return [
            File::make('File')->rules('required')
        ];
    }
}
29 Mar
3 months ago

hippo started a new conversation Nova Issue W/ Modals

Hey guys, I wrapped the initial nova template w my layout, but I guess I removed something important in the process. Apparently it's the delete confirmation modal for nova resources.

Does anyone know what line might be missing in my template for these modals to appear?

@extends('layouts.master')

<head>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <!-- Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,800,800i,900,900i" rel="stylesheet">

    <!-- Styles -->
    <link rel="stylesheet" href="{{ mix('app.css', 'vendor/nova') }}">

    <!-- Tool Styles -->
    @foreach(Nova::availableStyles(request()) as $name => $path)
        <link rel="stylesheet" href="/nova-api/styles/{{ $name }}">
    @endforeach
</head>

@section('side-bar')
<div class="se-padding">
    @if (count(Nova::globallySearchableResources(request())) > 0)
        <global-search style="z-index:5"></global-search>
    @endif
    <br>
    @foreach (Nova::availableTools(request()) as $tool)
        {!! $tool->renderNavigation() !!}
    @endforeach
</div>
@stop

@section('nova-content')
<div class='se-padding-sides-32 w3-margin-bottom'>
    @yield('content')
</div>
@stop

@section('post-scripts')
    <script>
        window.config = @json(Nova::jsonVariables(request()));
    </script>

    <!-- Scripts -->
    <script src="{{ mix('manifest.js', 'vendor/nova') }}"></script>
    <script src="{{ mix('vendor.js', 'vendor/nova') }}"></script>
    <script src="{{ mix('app.js', 'vendor/nova') }}"></script>

    <!-- Build Nova Instance -->
    <script>
        window.Nova = new CreateNova(config)
    </script>

    <!-- Tool Scripts -->
    @foreach (Nova::availableScripts(request()) as $name => $path)
        @if (starts_with($path, ['http://', 'https://']))
            <script src="{!! $path !!}"></script>
        @else
            <script src="/nova-api/scripts/{{ $name }}"></script>
        @endif
    @endforeach

    <!-- Start Nova -->
    <script>
        Nova.liftOff()
    </script>
@stop

This is what appears when I select delete on any resource

https://drive.google.com/file/d/1NrIBkdS-fWjDIok2ivtp2mXrtz-OtKPo/view?usp=sharing

25 Mar
3 months ago

hippo left a reply on Nova Issue With `use Actionable;`

Also, these are my fields on the DatasheetJob resource

/** * Get the fields displayed by the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function fields(Request $request) { return [ BelongsTo::make('Job')->searchable(), BelongsTo::make('Datasheet')->searchable(), Number::make('Quantity')->min(1) ]; }

hippo started a new conversation Nova Issue With `use Actionable;`

So inside nova, I've got the resources, relationships, and models setup. But I am getting actionable_id cannot be null error when trying to create a new pivot (DatasheetJob) model for the Job model that contains the use Laravel\Nova\Actions\Actionable; trait.

Am I missing something simple here? Is there anything additional I should be doing for the actionable trait? Many Thanks for putting your eyes on my bug!

https://drive.google.com/file/d/1saS2y0PIi-upcHRBc4aWDN7OUrhNatth/view?usp=sharing

07 Mar
4 months ago

hippo left a reply on Distant Eloquent Relations Q&A

Seems like thats what was missing! Thanks ill give that a try

06 Mar
4 months ago

hippo started a new conversation Distant Eloquent Relations Q&A

So I've got a few models and I'm having trouble accessing a distant relation which seemingly needs a hasOneThrough relation, which apparently doesnt exist now?? ( I thought I read some older api docs that said it was a method..?) Anyway, I've User, Contractor, and Job models. I can't just use a hasOne relationship with the contractor and job

User::class
//...
    public function contractor() {
        return $this->hasOne(Contractor::class);
    }

    public function jobs() {
        return $this->hasMany(Job::class)->latest('created_at');
    }
//...

Contractor::class
//...
    public function user() {
        return $this->belongsTo(User::class);
    }

    public function jobs() {
        return $this->hasManyThrough(Job::class, ContractorJob::class);
    }
//...

Job::class
//...

    public function owner() {
        return $this->belongsTo(User::class);
    }

/**
 * HERE IS MY ISSUE: I can't just use hasOne as my relation only exists if the user model
 * chooses to include their contractor model on a job model.
 *
 * What am I missing? Thanks in advance!
 */
    public function contractor() {
        return $this->hasOneThrough(Contractor::class, ContractorJob::class, 'id', 'job_id');
    }
//...

ContractorJob::class (pivot)
//...
    function job() {
        return $this->belongsTo(Job::class);
    }

    function contractor() {
        return $this->belongsTo(Contractor::class);
    }
//...
28 Feb
4 months ago

hippo left a reply on PHPUnit Issues On Example Feature Test

config:clear helped me with my issues for anyone with similar problem.

27 Feb
4 months ago

hippo started a new conversation PHPUnit Issues On Example Feature Test

    /** @test */
    public function anyone_can_see_our_home_page()
    {
        //wtf
        $response = $this->get('/');
        $response->assertStatus(200);
    }

//gives me

There was 1 failure:

1) Tests\Feature\ServicesTest::anyone_can_see_our_home_page
Expected status code 200 but received 500.
Failed asserting that false is true.

I've obviously got a homepage. I don't know why this example test is not passing. I can view it in the browser with zero errors. Can I please get some help with where to go from here? I feel like these tests should be making this process easier, however I see literally no benefit yet. My php_errors.log has nothing new in it. I've used

php artisan cache:clear
composer dump-autoload

in hopes it'd help, but still nothing..

Thanks in advance for any pointers!

20 Feb
5 months ago

hippo left a reply on B-tabs Not Refreshing Bound Disabled Attribute In Time To Change Bound TabIndex

I worked out a solution for myself, even though this wasn't ideal.

For anyone with similar issues with bootstrap-vue tabs:

I customized the tab/tabs components to include a 'muted' prop, which only disables selecting the tab via mouse.

//bootstrap-vue/../tabs.js

methods: { handleClick: function handleClick(evt) { function stop() { evt.preventDefault(); evt.stopPropagation(); } if (this.disabled || this.muted) { //don't allow tab to be selected stop(); return; } if (evt.type === 'click' || evt.keyCode === KeyCodes.ENTER || evt.keyCode === KeyCodes.SPACE) { stop(); this.$emit('click', evt); } } }

// sass

[muted=muted]{ cursor: not-allowed; margin: 0px 0px 0px 0px; border: 0px !important; } [muted=muted]:focus, [muted=muted]:hover { border: 0px !important; }

hippo started a new conversation B-tabs Not Refreshing Bound Disabled Attribute In Time To Change Bound TabIndex

I've got a services form which uses bootstrap vue tabs to display the logic process. I've bound the disabled attributes for the tabs so that it can progress only after each tab page has been satisfied. I've also bound the tabIndex to the b-tabs vue so that I can logically control which page we're on.. My problem is that when I try to alter both datas source of truth, they wont sync right. The disabled attribute apparently needs to be refreshed in the dom prior to changing the tabIndex property. I did some research and would expect vm.$forceUpdate() to help me, but it doesnt.

Any ideas? Thanks in advance!!!

//....

        <b-tabs small card v-model="tabIndex">

<!--STEP ONE, PROVIDE BASIC INFO-->
            <b-tab title='Jobsite'>
                <form method="POST" action="jobs/new" @submit.prevent="begin" @keydown="initial_form.errors.clear($event.target.name)">
                    @csrf

////other input fields Next </b-tab>

//...other tabs

//

   methods: {
        
        /*step one*/
        begin() {
            this.disableProgress = true;
            this.initial_form.post('jobs/new', false)
                .then(response => {
                    this.folder = response.folder;
                    this.disableContractorForm = false; //doesn't refresh dom in time to allow tabindex to change
                    //service.$forceUpdate(); doesn't help my issue
                    this.tabIndex = 1;          //wont update til next call to begin(), then tab will change
                    notify('Job Started');
                }).catch(err => {
                    error(err.message);
                });
            this.disableProgress = false;
        },
        

Lastly, I tried wrapping the vue instance with <keep-alive> but that didn't help me either..

Thanks for any helps!

27 Mar
1 year ago

hippo left a reply on Issues With Undefined Window.App.user & Window.App.signedIn

That's what I was missing when refactoring. Thanks a million

hippo started a new conversation Issues With Undefined Window.App.user & Window.App.signedIn

I am currently following the 'build-a-forum' tutorial with Jeffrey and I am stuck getting the Component.vues to display correctly because both window.App.user & window.App.signedIn are undefined. In the bootstrap.js and authorizations.js files, it's trying to access "window.App.user" and "window.App.signedIn". I searched the entire project for initialization on these values and nothing, only accessing inside these js files. Where/when do these values get initialized/stored? What am I misunderstanding guys? Thanks for your support!

<bootstrap.js, jeffreys code> let authorizations = require('./authorizations');

Vue.prototype.authorize = function (...params) { if (! window.App.signedIn) return false;

if (typeof params[0] === 'string') {
    return authorizations[params[0]](params[1]);
}

return params[0](window.App.user);

};

Vue.prototype.signedIn = window.App.signedIn;

<authorizations.js, jeffreys code> let user = window.App.user;

module.exports = { owns (model, prop = 'user_id') { return model[prop] === user.id; },

isAdmin () {
    return ['JohnDoe', 'JaneDoe'].includes(user.name);
}

};

19 Mar
1 year ago

hippo left a reply on Why Use Redis For Websocket Communication?

Bump. Still nothing :(