DawgOnKing

DawgOnKing

Member Since 1 Year Ago

Ohio, USA

B767 CA at Atlas Air Worldwide

Experience Points 39,530
Experience Level 8

470 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 368
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.

02 May
1 month ago

DawgOnKing left a reply on Not Working Laravel + Vuejs In Laravel App

Please show us your Myfooter.vue file @f

DawgOnKing left a reply on Auth Middleware In Routes Vs In Controller

As others have stated, you only need to define it once but to take it one step further it's helpful to think about why you are placing it in one location or the other.

Convention in other frameworks (Rails, for example) follows placing middleware in the router as a gate to controllers.

I follow this convention because I prefer to think along the same lines... when someone sends a route request, I like to auth at the routing level and then allow them to proceed to respective controller where I query data and render view....

The above is a simplified view but you get the point. Keep things consistent and simple as possible.

01 May
1 month ago

DawgOnKing started a new conversation If Remote Img Src Exists?

I'm using clearbit API to provide logo for companies and occasionally they will change the url or simply fail to load. For such occasions I need to see if img path returns image and if 404 is received - I'll display an s3 image.

file_get_contents and getImageSize return the following 404:

PHP Warning:  getimagesize(http://logo.clearbit.com/ryanm.com): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in /home/ec2-usereval()'d code on line 1

How do I handle the above in Laravel to display alternate image?

15 Apr
2 months ago

DawgOnKing left a reply on Eager Loading, Vue And Foreach()

Hey, @kevinbui - thanks for your response.

When I eager load $comments - I'm including both root comments and their replies. Root comments have a parent_id = null and replies have parent_id = comment_id.

I can do the following to grab root comments and create Vue instance for each:

@foreach($comments[''] as $comment))
    <root-comment :comment="{{ $comment }}"></root-comment>
@endforeach

Let's say the above instance has an id of 5.....

So now I would like to include all additional comments that have a parent_id = 5 as replies to the component as well - because they have been eager loaded and are available without additional request/queries...

@foreach($comments[''] as $comment))
    <root-comment :comment="{{ $comment }}" :replies="{{ $comments->where(parent_id, $comment->id) }}"></root-comment>
@endforeach

The above fails because $comments is no longer available inside of the @foreach as the array has already been iterated to individual $comment.....

14 Apr
2 months ago

DawgOnKing left a reply on Eager Loading, Vue And Foreach()

As of now, I am simply passing all root level comments to Vue and then getting replies via mounted Axios request for each to load (Comment::where('parent_id', Comment->id)

Seems like a lot of extra API calls when I already have access to all comments via eager loading.....

DawgOnKing started a new conversation Eager Loading, Vue And Foreach()

If I eager load the following data:

$comments = Comments::all();

And then pass the data to Vue as:

<component :comments="{{ $comments }}"></component>

But instead would like the following:

@foreach($comments['root'] as $comment)

<component :comment="{{ $comment }}" :replies="{{ $comments[parent_id = $comment->id] }}"></component>

So essentially, eager load all comments but then iterate through each with a parent_id = null and include replies (comments where parent_id equals comment->id) how do I pass that data?

31 Mar
2 months ago

DawgOnKing left a reply on Model Method That Returns HasMany Relationship->attribute

Is the following possible:

// USER MODEL

protected $with = ['pilots']; 

But with a contraint that I only want the last Instance

DawgOnKing left a reply on Eager Load Vs Model->relationship

Wow, query reduced by 1 @snapey

That's awesome, man. Thanks so much!

DawgOnKing left a reply on Eager Load Vs Model->relationship

HAHA!

YOU ARE CORRECT!

and @snapey - I'm testing your latest reply now!

DawgOnKing started a new conversation Model Method That Returns HasMany Relationship->attribute

Another best practice question for the masses as I continue to refactor.

My employer publishes a new seniority (Pilot) list every month. As such, each month a pilot's domicile may change.

I'm storing that domicile as an attribute on a Pilot Instance.

From a best practice standpoint - how do I track this considering the following models/relationship

//User

has_many pilots()
{
    //every month a new Pilot instance is generated for each User
    hasMany(App\Pilot)
}

//Pilot
{
    belongsTo(App\User)
}
$user->pilots->last()->domicile;
//returns "JFK"

I have been fetching a User's domicile using the above but if I wanted to simply add a domicile() method to the User model - what is best practice for doing so?

public method domicile()
{
    return $this->pilots->last()->domicile;
}

Laravel is storing my Auth::user() for every page and I want access to $user->domicile() without hitting the DB.

DawgOnKing left a reply on Eager Load Vs Model->relationship

Hey, @snapey

Fair enough (I can swap that) - and I have spent the last 24 hours trying to develop a firm understanding of eager loading and its benefits. I think my understanding is pretty good.

I was simply left with one question - and I asked it twice. Explain the difference between utilizing the two original OPTIONS ----- is there a difference or benefit to using one or the other?

To be fair, you mentioned that the behavior is beneficial when there are 20 Posts and 1 Comment for each but didn't confirm that the OPTIONS above perform identical queries.

I was simply trying to get Laravel to demonstrate what happens when you don't use eager loading and I failed to do so initially which confused me.

As soon as I took those comments a relationship further and attempted to access comment-user - all hell broke lose and the multitude of queries was shown.

DawgOnKing left a reply on Eager Load Vs Model->relationship

If I take it a step further and reference:

$comment->user->name

The expected behavior is demonstrated

select * from `users` where `users`.`id` = ? limit 1    0.31ms  
select * from `users` where `users`.`id` = ? limit 1    0.31ms  
select * from `users` where `users`.`id` = ? limit 1    0.32ms  
select * from `users` where `users`.`id` = ? limit 1    0.32ms  
select * from `users` where `users`.`id` = ? limit 1    0.31ms  
select * from `users` where `users`.`id` = ? limit 1    0.31ms  
select * from `users` where `users`.`id` = ? limit 1    0.31ms  
select * from `users` where `users`.`id` = ? limit 1    0.32ms  
select * from `users` where `users`.`id` = ? limit 1    0.36ms  
select * from `users` where `users`.`id` = ? limit 1    0.32ms  
select * from `users` where `users`.`id` = ? limit 1    0.32ms  
select * from `users` where `users`.`id` = ? limit 1   0.32ms

But as far as $post->comments are concerned both iterations are identical. Was just wondering if I was missing something there.

That said, per @cronix - always best practice to eager load and I will

DawgOnKing left a reply on Eager Load Vs Model->relationship

@cronix

You're explanation is 100% the way I understand eager load to work.

So why then, if I don't use it:

return view('post.show', compact('post')

AND

@foreach($post->comments as $comment)
    {{  $comment->body }}
@endforeach

According to Telescope, it's not running 11 queries but exhibiting the same behavior as the eager loaded data.

TELESCOPE PAGE QUERIES

select * from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null...

ACTUAL QUERY

select
  *
from
  `comments`
where
  `comments`.`commentable_id` = 1
  and `comments`.`commentable_id` is not null
  and `comments`.`commentable_type` = "App\Airline"

DawgOnKing left a reply on Eager Load Vs Model->relationship

@snapey

Gotcha.

So in the example I have included above - are the two options essentially identical?

Again, the only difference I see is when the query is performed based on Telescope output.

If I don't eager load Post->comments in controller and simple iterate via @foreach in blade --- the query to get comments is run last which makes sense. Does this affect page loading time?

DawgOnKing left a reply on Eager Load Vs Model->relationship

@ricardo

Understood. And that factored into my thinking as well after reviewing docs for the 10th time.

Your saying that eager loading benefits are maximized more commonly on an Index page where we get 100 Posts and subsequently, the Comments for each one which could total thousands, etc....

Makes sense if I understand your point. Thanks...

DawgOnKing started a new conversation Eager Load Vs Model->relationship

Consider a Post with 10 Comments

OPTION A (EAGER LOADING)

//controller
$post->with('comments')->find($post->id);

//blade
@foreach($post->comments as $comment)
    {{ $comment->body }}
@endforeach

select
  *
from
  `comments`
where
  `comments`.`commentable_id` in (1)
  and `comments`.`commentable_type` = "App\Post"

//duration 0.41ms

OPTION B

//controller
compact('post');

//blade
@foreach($post->comments as $comment)
    {{ $comment->body }}
@endforeach

select
  *
from
  `comments`
where
  `comments`.`commentable_id` = 1
  and `comments`.`commentable_id` is not null
  and `comments`.`commentable_type` = "App\Post"

//duration 0.39ms

Both run identical query count.

Is there a significant advantage to eager loading as the application scales?

Are these examples essentially identical as they appear to be?

30 Mar
2 months ago

DawgOnKing left a reply on Unble To Group The Two Middlewares

Why not omit the grouping and just add middleware via:

Route::resource('adminindex', 'AdminindexController')->only('index', 'show', 'index')->middleware('districtlogin');

DawgOnKing left a reply on Unble To Group The Two Middlewares

I'm not able to test but you can try these: I think I've used one or the other....

Route::group(['middleware' => ['admin', 'districtlogin']], function() {});

OR

Route::group(['middleware'=>['admin' OR 'districtlogin']],function () {});
28 Mar
2 months ago

DawgOnKing left a reply on LARAVEL/PHP BEST PRACTICE: IF INSTANCE EXISTS (LOAD TIMES)

To finish up:

Model::exists()

select exists(select * from `model`) as `exists`    0.32ms

My original query

@if(App\Model::all()->count() != 0)
select * from `models`  0.38ms

So, 20% slower with a single item in the DB. Huge performance increase with your refactor, @ftiersch

Thanks again!

DawgOnKing left a reply on LARAVEL/PHP BEST PRACTICE: IF INSTANCE EXISTS (LOAD TIMES)

Understood. And thanks for the snippet, I will play around with it.

My main page is an HQ of sorts and grabs instances of all Models (albeit, only a few of them). But it loads in the following fashion:

  1. Single Instance of ModelA
  2. 5 Instances of ModelB
  3. 4 Instances of ModelC
  4. Vue api call to load ModelD

In some cases, there is no data (new or updated) and I just need to return a string to indicate so. That's the basis for my question which led to BEST PRACTICE thought process.

Thanks for chiming in!

DawgOnKing left a reply on LARAVEL/PHP BEST PRACTICE: IF INSTANCE EXISTS (LOAD TIMES)

Thanks for the recommendations @ftiersch

Yeah, once I took a look at loading times and queries in Telescope I started to spot some bad conventions. That's what ultimately got me to pose the question in broader terms of how members of the community deal with such things day to day.

I like the idea of custom class generation and hadn't thought of that. In terms of saving to a reusable variable, how is that implemented?

27 Mar
2 months ago

DawgOnKing started a new conversation LARAVEL/PHP BEST PRACTICE: IF INSTANCE EXISTS

What do you folks who make a living at this do for determining if an Instance exists? I know how to do it - I'm interested in how you do it and why?

WHY I CARE?

  1. PRIMARILY, LOADING TIMES
  2. AGAIN, LOADING TIMES - SPECIFICALLY on PAGES RUNNING LARAVEL + VUE
  3. I USE IT VERY OFTEN
  4. I WANT MY CODE TO LOOK LIKE YOURS

I use the below technique in Blade when the view or partial doesn't touch a controller:

@if(App\Model::all()->count() != 0)
    // Vue component which calls laravel endpoint to retrieve data
@else
    // NO DATA
@endif

Is this good practice? I would guess no because I'm not familiar with the behavior. If there are 1000 instances of App\Model are they being counted to satisfy the above or does that stop as soon as it returns a single Model Instance because that's all that's required to return true?

Again, just wondering what you folks to in similar situations to cut down on queries and loading. As my knowledge of Laravel increases I find myself wanting to dig in deeper....

THanks!

25 Mar
2 months ago

DawgOnKing left a reply on Passing Variables From Controller To A View

return view(‘adminhome’, [ ‘message’ => $msg])

13 Mar
3 months ago

DawgOnKing left a reply on Phpunit :: Laravel Redirect Upon Validation Failure

FWIW, my tests are passing without the custom helper, @tykus

    ->from('posts/create')
    ->post('/posts', factory(Post::class)->raw(['name' => '']))
    ->assertStatus(302)
    ->assertSessionHasErrors(['name' => 'The name field is required.'])
    ->assertRedirect('/posts/create');

.... is working in all my tests without building helper:

public function from(string $url)
{
    $this->app['session']->setPreviousUrl($url);
    return $this;
}

DawgOnKing left a reply on Phpunit :: Laravel Redirect Upon Validation Failure

Thanks, @tykus!

My tests are better today than they were yesterday (just like my NFL Team #browns)!

Appreciate it!

DawgOnKing started a new conversation Phpunit :: Laravel Redirect Upon Validation Failure

Please consider the following:

//controller
public function store()
    {
        $attributes = request()->validate([
            'name' => 'required',
            'title' => 'required',
        ]);
        
        Post::create($attributes);
        flash('POST CREATED!');
        return redirect('/posts');
    }
//test validation for name requirement
        $this->actingAs($admin)->post('/posts', factory(Post::class)->raw(['name' => '']))
            ->assertStatus(302)
            ->assertSessionHasErrors(['name' => 'The name field is required.'])
            ->assertRedirect('/posts/create');

The logic works in development but fails when testing:

1) Tests\Unit\PostTest::post_name_validations
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/posts/create'
+'http://localhost'

Any ideas?

12 Mar
3 months ago

DawgOnKing left a reply on Best Practices: Vue.js -> Laravel AJAX API Resources

I prefer to adhere to RESTful convention as much as possible, even with Axios API calls.

I have, however, also used dedicated API resource routes and route namespace for data interaction between Vue and Laravel.

php artisan make:controller API/PostsController --api
Route::namespace('Axios')->group(function () {
    // Controllers Within The "App\Http\Controllers\Axios" Namespace
});

I'd simply recommend maintaining a workflow that is consistent with the same practices you use in Laravel. I don't like "switching gears" just because I'm interacting with Vue. I just want to be consistent.

11 Mar
3 months ago
10 Mar
3 months ago

DawgOnKing started a new conversation Assert Value Is Equal To Array Value

Given the following:

$array = ['ONE', 'TWO', 'THREE'];
$value = 'TWO'

How do I assert the following:

$this->assertEquals($value, $array->value);

So, $value equals a single value in $array...

21 Feb
4 months ago

DawgOnKing left a reply on Setting Vue Data With Props Object Key, Value

Here is the component:

<template>
    <div>
        <div class="w-full">
            <transition name="fade" mode="out-in">
                <spotlight :selected="selected" :key="selected.key"></spotlight>
            </transition>
        </div>
        <div class="w-full flex">
            <div v-for="(key, value) in data" class="flex-1">
                <div class="btn" @click="selected = { key:key, value:value }">{{ value }}</div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                selected: this.data
            };
        },
        props: ['data'],
        watch: {
            selected: function(newVal){
                console.log("selection has changed!");
            }
        }
    }
</script>

The above is successfully creating child components via:

<div v-for="(key, value) in data" class="flex-1">
       <div class="btn" @click="selected = { key:key, value:value }">{{ value }}</div>
</div>

But at the same time this fails to work:

export default {
        data() {
            return {
                selected: this.data // Object (empty)
            };
        },
        props: ['data'],

Not sure how it's successfully creating children via (key,value) in data but won't populate selected with this.data

DawgOnKing left a reply on Setting Vue Data With Props Object Key, Value

Yeah, I'm actually iterating the data to produce children and they all work.

I just want to the a default with the first key,value pair

DawgOnKing left a reply on Setting Vue Data With Props Object Key, Value

I agree but all I'm getting on console.log for Object.entries(this.data) or Object.values(this.data) or Object.keys(this.data) is an empty array.

And the data:object

{"B744":36,"B748":10,"B74LCF":4,"B762":10,"B763":28}

Is copy/pasted right from Developer tools > Vue

The data is there but I can't access it????

DawgOnKing started a new conversation Setting Vue Data With Props Object Key, Value

I'm passing data between components and this is the output:

props data:object

{"B744":36,"B748":10,"B74LCF":4,"B762":10,"B763":28}

I want to set the first key, value pair as "selected":

data selected:object

mounted() {
    this.selected = Object.values(this.data)
}

When I console log:

console.log(Object.values(this.data)); // return empty array - same for Object.keys

I'm trying to set a default values when component loads carousel image + data is all. #failArmy

19 Feb
4 months ago

DawgOnKing left a reply on Refactor Inline (Nested) Vue Component To Independent Component

I have this working via watcher except for transition. How to I trigger transaction on value change?

watch: {
     spotlight: function(newVal){
            this.spotlight = newVal;
}

To trigger a transition via:

            <transition name="fade" mode="out-in">
                <spotlight :spotlight="newVal"></spotlight>
            </transition>

DawgOnKing left a reply on Refactor Inline (Nested) Vue Component To Independent Component

I can see the problem and understand that these are two different principles.

I'm assuming I need to listen for button click and then trigger reloading of component with updated props.

DawgOnKing started a new conversation Refactor Inline (Nested) Vue Component To Independent Component

The following works:

<template>
     <transition name="fade" mode="out-in">
          <component v-bind:is="jet"></component>
     </transition>
</template>

<script>
     data() {
            return {
                jet: '747'
            }
      },
      components: {
            '747': {
                template: '<div>B747</div>'
            }
</script>

And I want the above component transition as follows:

<transition name="fade" mode="out-in">
     <spotlight v-bind:is="jet"></spotlight>
</transition>

Spotlight Component

<template>
    <div>{{ spotlight }}</div>
</template>

Can't seem to refactor this basic component transition. It's a simple carousel. When you click button it populates image.

I'm getting Vue error

[Vue warn]: Unknown custom element: <B747> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
18 Feb
4 months ago
16 Feb
4 months ago

DawgOnKing started a new conversation (key,value) To Img Src In Vue

Consider the following:

<div v-for="(key, value) in active" class="flex-1 px-2">
    <img src="https://s3.us-east-2.amazonaws.com/giantpilots/fleet/the_value"></img>
    <hr>
    <div>{{ key }} ACTIVE AIRFRAMES</div>
</div>

How do I impose the value into the img src as the_value?????

15 Feb
4 months ago

DawgOnKing left a reply on Returning Eloquent Data For Chartkick

Disregard.

I was passing ":data" to component in Vue - needs to be "data"

The above now works.

DawgOnKing started a new conversation Returning Eloquent Data For Chartkick

According to Chartkick docs, it can read data in following formats:

<pie-chart :data="{'Blueberry': 44, 'Strawberry': 23}"></pie-chart>
<pie-chart :data="[['Blueberry', 44], ['Strawberry', 23]]"></pie-chart>

Using the very vanilla formats above, how can I return Eloquent data in the above formats?

The following isn't working:

$percents = collect([
      'B747 CA' => 25,
      'B767 CA' => 25,
      'B747 FO' => 25,
      'B767 FO' => 25
]);

return $percents;
11 Feb
4 months ago

DawgOnKing left a reply on Form Submit Not Working

Start with a simple call to the controller via routing to check things are working:

Route::post('/model', '[email protected]');

And then in ModelsController::store

dd('You have hit the endpoint')
10 Feb
4 months ago

DawgOnKing started a new conversation Testing Auth

Why is this failing?

public function test_a_user_registers_with_good_seniority_and_verifies_email()
    {
        //Visit Register Page
        $response = $this->get('/register')->assertStatus(200)->assertSee('REGISTER');
        
        // POST valid data which creates a user
        $user = User::create([
            'name' => $this->faker->name,
            'email' => $this->faker->unique()->safeEmail,
            'password' => 'foobar',
        ]);
        
        // User verifies email
        $user->email_verified_at = "2019-02-10 23:43:39";
        $user->save();
        
        $this->assertDatabaseHas('users', ['emp' => 999999, 'password' => $user->password]);
        
// ALL TESTS PASSING TO THIS POINT

    // this fails with a redirect to verify email
        $this->get('/hq')->assertStatus(200);
    }

How do I test that a user is verified? I'm updating email_verified_at which allows for get(/hq) access but my tests continuously fail with a redirect to verify/email.

09 Feb
4 months ago

DawgOnKing left a reply on Is This Bad Testing Convention???

Thanks @talinon - very much appreciate your logic. Exactly what I'm looking for.

DawgOnKing started a new conversation Is This Bad Testing Convention???

I just started writing tests and have zero experience. I'm literally learning and writing as Jeff puts out the videos.

Anyway, I'm having little issues producing and running tests which is good. What I'd like to know is if the following format is bad practice that could lead to bigger problems down the road.

Thanks.

public function test_notam_middleware()
    {
    // Create Admin User + Regular User
        $admin = $this->user(true);
        $user = factory(User::class)->create(['emp' => 450777]);
        
        // Test if Admin can create model
        $this->actingAs($admin)->post('/notam', $this->validParams())
            ->assertStatus(200);
        $this->assertDatabaseHas('notams', ['title' => 'A Valid Title']);
        
        // Test if Admin can update model
        $this->actingAs($admin)->patch('/notam/1', $this->validParams(['body' => 'I changed the body of this 
         NOTAM']))
            ->assertStatus(200);
        $this->assertDatabaseHas('notams', ['body' => 'I changed the body of this NOTAM']);
        
        // Test if User can NOT store, edit or delete model
        $this->actingAs($user)->post('/notam', $this->validParams())->assertStatus(302);
        $this->actingAs($user)->patch('/notam/1', $this->validParams(['body' => 'I changed the body of this 
        NOTAM']))->assertStatus(302);
        $this->actingAs($user)->delete('/notam/1')->assertStatus(302);
        
        // Test if Admin can delete model
        $this->actingAs($admin)->delete('/notam/1')->assertStatus(200);
        $this->assertDatabaseMissing('notams', ['id' => 1]);
    }

To be clear, all tests PASS and am wondering if embedding all middleware logic into single test is bad practice and why?? To me, it makes it easier to keep track of tests and not emit one that I should be testing.

Thanks again.

DawgOnKing left a reply on Validate Vue Object In Laravel Controller

What you've suggested works to create and update but I still want to to validate the entire object. It's the validate() method that throws the error.

For now, I will just send each attribute via { id: this.urgent.id, ....etc } but if someone stumbles upon this with a solution - I'll take it.

Thanks @wilk_randall

08 Feb
4 months ago

DawgOnKing left a reply on Validate Vue Object In Laravel Controller

It seems as if I'm using values instead of keys in the controller.

CONTROLLER:

request('urgent.title')// return 'A Valid Title'

DawgOnKing left a reply on Validate Vue Object In Laravel Controller

It's all there. I can update Models with the same approach but calling validate() fails when I pass the entire object instead of individual attributes????