noleafclover614

noleafclover614

Member Since 4 Years Ago

Experience Points 12,380
Experience Level 3

2,620 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 129
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.

28 Feb
1 year ago

noleafclover614 left a reply on Overriding Values In Model Factories

@Maurice_ I had to log in just to up-vote you. Thank you! I was having this same problem and your solution fixed it.

08 Feb
1 year ago

noleafclover614 left a reply on Eloquent And Doctrine Combined

For anyone following this thread, I posed this issue on the laravel-doctrine/orm repo. It looks like this can be solved by changing the doctrine_presence_verifier parameter to false in config/doctrine.php:

    /*
     |--------------------------------------------------------------------------
     | Validation
     |--------------------------------------------------------------------------
     |
     |  Enables the Doctrine Presence Verifier for Validation
     |
     */
    'doctrine_presence_verifier' => false,

Issue is below:

https://github.com/laravel-doctrine/orm/issues/304

noleafclover614 left a reply on Eloquent And Doctrine Combined

I can successfully connect to our db2 instance using Doctrine. Here's a scenario that is failing:

  • Set up a new instance of Laravel 5.5 with scaffolded auth views/routes
  • Registered a user, saves to MySQL database with no issues
  • Add the laravel-doctrine package.
  • Add a simple Entity to App/Entities and map it to our db2 database.
  • Try to register another user.
  • Error: ReflectionException (-1) Class users does not exist

I think this is happening because the doctrine package is somehow hijacking the database connection after it's installed, causing it to clobber to existing mysql/eloquent setup out of the box.

I hope that made it clearer...not sure what to do at this point.

07 Feb
1 year ago

noleafclover614 left a reply on Eloquent And Doctrine Combined

@jlrdw The Laravel docs or the Laravel-Doctrine docs? In any case, my specific use case requires 1 connection to a MySQL database using Eloquent, and 1 connection to a DB2 database using Doctrine.

As I mentioned in my post, I can't get the secondary connection working properly.

noleafclover614 started a new conversation Eloquent And Doctrine Combined

Hi all,

I'm attempting to implement a system that uses Doctrine (via laravel-doctrine/orm) for querying / reading data from a db2 database, and Eloquent for everything else.

I'm running into an issue after installing the Doctrine package - Laravel now tries to use Doctrine for everything. For example, in the Auth/[email protected] method:

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

Even though the above is an Eloquent model, I get a Doctrine error:

ReflectionException (-1)
Class users does not exist

I've tried a few things like adding a protected $connection = 'mysql'; property directly to the User model, but Laravel does not seem to respect this setting.

Any thoughts?

21 Dec
1 year ago

noleafclover614 started a new conversation Database / Model Design For One To Many, But Only 1 Active.

Hi all,

I wanted to get some feedback on how to approach the design of a database / models for the given scenario:

Let's say we have an organization that can have one or more contracts. These contracts are not considered ready to be viewed unless they are published/finalized. At the same time, the organization only wants to have one contract "active" at a time so that users who are viewing them are providing their consent to a specific, active, published version. The organization would also like the ability to activate both older and newer versions of their contracts on demand.

What say you?

18 Sep
1 year ago

noleafclover614 started a new conversation Webpack Async Interceptors

Is it possible to hook into the request/response of webpack when making asynchronous import calls, similar to axios? I'd like to be able to show a loading bar each time this happens.

noleafclover614 left a reply on "It Is Unsafe To Run Dusk In Production." Error When Trying To Deploy

To add to this a bit, I fixed this by adding in a missing .env file to my project root, which was absent after a git clone of my repo on a new machine. This file specified APP_DEBUG=true, effectively telling Dusk that we aren't in the production environment.

04 Jun
2 years ago

noleafclover614 left a reply on Testing A Route Behind Auth:api Passport Middleware

Assuming you need an authorized user to make your calls, I think you might be able to simply do $this->actingAs($user, 'api')

as indicated here: https://laracasts.com/discuss/channels/testing/testing-passport-protected-api

03 Jun
2 years ago

noleafclover614 left a reply on PHPUnit And A View Composer

Alright...I'm pretty sure the error I was getting trying to get property of non-object was also being caused because I forgot to eager load a relationship I was also trying to use. For now I'll mark this as solved...

02 Jun
2 years ago

noleafclover614 left a reply on Passing A Variable To The Page Url In Dusk

This is great, thanks. How did you go about getting Dusk to respect your $user variable that I'm guessing you also passed to the view you are serving up? I'm running into issues with "non-object" exceptions.

31 May
2 years ago

noleafclover614 left a reply on Load View Composer For A Single Test Method

@addorange - I'd be interested in this as well as I'm running into the same issue:

https://laracasts.com/discuss/channels/testing/phpunit-and-a-view-composer

Also as an FYI - Dusk tests seem to run into the same issue in my case.

noleafclover614 started a new conversation PHPUnit And A View Composer

I'm following along with the Let's build A Forum with Laravel series, and I'm at the point where we are creating a profile for a User: https://www.laracasts.com/series/lets-build-a-forum-with-laravel/episodes/22

My problem is that I have a view composer in my AppServiceProvider class that shares a $currentUser variable with all views:

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {

        view()->composer('*', function ($view) {
            return $view->with('currentUser', auth()->user());
        });
    }

//
}

So now when I run my tests, I get an error stating that the $currentUser variable is not defined. How can I make sure my tests are picking up the shared variable?

    /** @test */
    function a_user_has_a_profile()
    {
        $user = create('App\User');
        $this->signIn($user);
        $this->get("/profiles/{$user->name}")
            ->assertSee($user->name); //throws error
    }
30 May
2 years ago

noleafclover614 left a reply on User Global Scope - Ambiguous Column 'id'

Looks like there may not be a way to do this with BelongsToMany:

https://github.com/laravel/framework/pull/17707#issuecomment-304985417

I think I may have solved this by doing a few things - hopefully this isn't too messy:

  1. Creating a global scope on my User model:
    public static function boot()
    {
        parent::boot();

        static::addGlobalScope('primaryOrg', function (Builder $builder) {
            $builder->with('primaryOrganization');
        });

    }
  1. Updating the $appends array:
protected $appends = ['primary_org_name', 'primary_org_id'];
  1. Added custom getters for each of the $appends array keys:
    /**
     * Get the Primary Organization Name attribute.
     * @param $value
     * @return mixed
     */
    protected function getPrimaryOrgNameAttribute($value)
    {
        return $this->primaryOrganization->first()->name;
    }

    /**
     * Get the Primary Organization Id attribute.
     * @param $value
     * @return mixed
     */
    protected function getPrimaryOrgIdAttribute($value)
    {
        return $this->primaryOrganization->first()->id;
    }

noleafclover614 left a reply on User Global Scope - Ambiguous Column 'id'

Thanks... I'll have to try to figure out how to make this work with a BelongsToMany relationship.

noleafclover614 left a reply on User Global Scope - Ambiguous Column 'id'

@Snapey I was moving in this direction! I eventually got to here, which does in fact still return a Collection:

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */

    public function primaryOrganization()
    {
        return $this->organizations()->wherePivot('is_primary', '=', 1);
    }

Can you point me towards some resources (Eloquent macros?) where I might learn how to grab just the first model from the collection?

noleafclover614 started a new conversation User Global Scope - Ambiguous Column 'id'

For some reason, I can't figure out how to retrieve what I want from my database using Eloquent. I have a User model and an Organization model, each connected by a belongsToMany relationship. The pivot table user_orgs that connects them has an additional column, indicating if the organization is the "primary" organization (is_primary) for the user.

Every time I query users, including the logged in user, I would like their primary organization name and ID to be accessible via attributes.

//User Model

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

//... 
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */

    public function organizations()
    {
        return $this->belongsToMany(Organization::class, 'user_orgs', 'user_id', 'organization_id')->withTimestamps()->withPivot('is_primary');
    }

//...

//Organization Model

class Organization extends Model
{
  
//... 

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */

    public function members()
    {
        return $this->belongsToMany(User::class, 'user_orgs', 'organization_id', 'user_id')
            ->withTimestamps();
    }

//...

My first thought was global scoping, which fails due to the following error:

//User Model

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

//... 

    public static function boot()
    {
        parent::boot();
        
        static::addGlobalScope('primaryOrg', function (Builder $builder) {
            $builder->join('user_orgs', 'users.id', '=', 'user_orgs.user_id')
                    ->join('organizations', 'organizations.id', '=', 'user_orgs.organization_id')
                    ->where('user_orgs.is_primary', '=', 1);
        });
        
    }

//...

Error:

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select * from `users` inner join `user_orgs` on `users`.`id` = `user_orgs`.`user_id` inner join `organizations` on `organizations`.`id` = `user_orgs`.`organization_id` where `id` = 100 and `user_orgs`.`is_primary` = 1 limit 1)
23 Feb
2 years ago

noleafclover614 left a reply on API Auth

Coming back after a long while to note that Laravel Passport solves this problem flawlessly:

https://laravel.com/docs/5.4/passport#consuming-your-api-with-javascript

28 Mar
3 years ago

noleafclover614 left a reply on Switching To Route Model Binding With GUID

How are you storing the Guid column in your database? Are you using a package to generate the GUID's?

noleafclover614 started a new conversation HasMany Relation Using Binary(16) Column

I have an eloquent model with a HasMany relationship to another. In the past I've always used an auto incrementing id to form relationships - in this case, I am using UUIDs stored in my database as BINARY(16) columns.

When the models are created, I'm listening to the event via an Observer and using the use Ramsey\Uuid package to create the UUID as necessary. This is working fine:

// class BucketObserver implements ModelObserverInterface
//
    public function creating($bucket)
    {
        $bucket['uuid'] = str_replace('-', '', Uuid::uuid4()->toString());
    }
//

Using my models, I can successfully do things like the following, which creates entries in my database as needed:

        $bucket->addAttachment(new BucketAttachment([
            'file_name' => 'test',
            'amazon_s3_path' => 'path/to/s3'
        ]));

The problem is, calling $bucket->attachments()->get() always returns an empty collection!

Below is the code for the Bucket and Attachment models with the relationships.

class Bucket extends Model
{
    protected $with = ['attachments'];
   
    public function attachments()
    {
        return $this->hasMany('App\Buckets\BucketAttachment', 'bucket_uuid', 'uuid');
    }
    public function setUuidAttribute($value)
    {
        $this->attributes['uuid'] = hex2bin($value);
    }

    public function getUuidAttribute($value)
    {
        return bin2hex($value);
    }

    public function addAttachment(BucketAttachment $attachment)
    {
        return $this->attachments()->save($attachment);
    }
}

class BucketAttachment extends Model
{
    protected $table = 'bucket_attachments';

    public function bucket()
    {
        return $this->belongsTo('App\Buckets\Bucket', 'bucket_uuid', 'uuid');
    }

    public function setUuidAttribute($value)
    {
        $this->attributes['uuid'] = hex2bin($value);
    }

    public function getUuidAttribute($value)
    {
        return bin2hex($value);
    }

    public function setBucketUuidAttribute($value)
    {
        $this->attributes['bucket_uuid'] = hex2bin($value);
    }

    public function getBucketUuidAttribute($value)
    {
        return bin2hex($value);
    }
}

For the record, I've done some simple testing and the query below works fine - so I am stuck on how to get the relationship to return what I need.

$bucket = factory(Bucket::class)->create();
$query = BucketAttachment::where(DB::raw('LCASE(HEX(bucket_attachments.bucket_uuid))'), '=', $bucket->uuid);

noleafclover614 left a reply on Binary UUIDs, Mutators & Relationships

@Nemesis02 I have the same issue. Did you ever figure it out?

22 Feb
3 years ago

noleafclover614 left a reply on URL Generated In A Queue - Localhost Returned Instead Of Production Server

I set up an environment variable for this so that when deployed via Forge, it uses the server specified there.

// /config/app.php
 'url' => env('APP_URL', 'http://localhost'),
//.env
APP_URL=[domain]
13 Feb
3 years ago

noleafclover614 left a reply on How Would One Use JWT (JSON Web Tokens) With Laravel Socialite?

@isaackearl - I have a similar setup and I'm really curious as to how you set this up. After your socialite "OAuth" user is returned and you generate your token, how do you manage subsequent requests from the client side? Typically you'd include the token in the header for AJAX requests. Something I've struggled with is how to maintain the token for the lifetime of the session for the authenticated user.

noleafclover614 started a new conversation PHPUnit, SQLite, And Cascading Deletes

Hi all,

I'm using cascading deletes on a pivot table in my database. Using a tool like MySQL Workbench to delete records manually, this works as expected (both records disappear).

In my tests (which use an SQLite database) I can't seem to get the related records to delete. Is there a limitation with this type of thing with SQLite? Any type of setup I am overlooking?

31 Jan
3 years ago

noleafclover614 left a reply on Extending The Same Layout In Two Partials

A work around (solution?) seems to be to use @overwrite instead of using @endsection for these partials.

noleafclover614 started a new conversation Extending The Same Layout In Two Partials

I have a "modal" layout that looks like the following. I can easily extend this layout in another blade partial to get a working modal with a header, body, and footer which I can embed using @include('teams.partials.edit-modal').

//modal layout
<div class="modal fade" tabindex="-1" role="dialog" id="{{ isset($uuid) ? $uuid : '' }}">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                @yield('title')
            </div>

            <div class="modal-body">
                @yield('body')
            </div>
            <div class="modal-footer">

                @yield('footer')

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
//edit-modal
@extends('layouts.modal')

@section('title')
    <h4 class="modal-title">Edit Team</h4>
@endsection

@section('body')
    edit
@endsection

@section('footer')
    edit
@endsection

My problem is that when I try to use two includes that both extend the modal layout, I only get the yielded content for the first one in both rendered modals.

//invite-modal
@extends('layouts.modal')

@section('title')
    <h4 class="modal-title">Send Invite</h4>
@endsection

@section('body')
    invite
@endsection

@section('footer')
    invite
@endsection

//some blade file where I want these rendered
            @include('teams.partials.edit-modal')
            @include('teams.partials.invite-modal')

The result of the above is two modals rendered on the screen, but BOTH of them have the content for the "edit" partial.

27 Jan
3 years ago

noleafclover614 left a reply on Permissions On User Model

One thing I tried (Which works!) is the following:

    public function permissions()
    {
        $permissions = collect([]);

        foreach( Permission::with('roles')->get() as $perm)
        {
            if ($this->hasRole($perm->roles)){
                $permissions->push($perm->name);
            }
        }

        return $permissions;
    }

noleafclover614 started a new conversation Permissions On User Model

I went through the Roles and Permissions video and implemented it in my application. (https://laracasts.com/series/whats-new-in-laravel-5-1/episodes/16)

Now, I'd like to easily get a list of all permissions for a given user, and I'm finding it harder to query that than I originally thought. Basically I just want to get a list of permissions for the logged in user (e.g., Auth::user()->permissions()).

class User extends Authenticatable{
//
    public function roles()
    {
        return $this->belongsToMany('App\Users\Role', 'role_user', 'user_id', 'role_id');
    }

    public function permissions()
    {
        // ??
    }
//
}
24 Jan
3 years ago

noleafclover614 left a reply on API Auth

Maybe I am just misunderstanding the security architecture here. The multi auth capabilities sound cool, but the scenario described in that link simply assigns each user a 60 character token that, once obtained, grants access to your API as long as it's supplied in the request. Is this considered a secure method of authentication?

noleafclover614 left a reply on Dynamic Modal Component

You could try using the event system to $broadcast and $dispatch as needed to achieve what you want. I created a simple demo on JSBin to illustrate:

https://jsbin.com/zuleqipufe/1/edit?html,js,console,output

noleafclover614 left a reply on API Auth

Thank you for taking the time to reply with your examples. What if my Users are not logging in using AJAX requests and instead logging in via standard session based auth? In those cases I cannot send JSON back to them because I am routing them to my home page.

EDIT: I suppose I could just create or utilize some middleware that does the following when users request API routes... (does the jwt.auth middleware already do this?)

$user = Auth::user();  //since they are already authenticated in the session

$token = JWTAuth::fromUser($user);

$request['token'] = $token;

return $next($request);

noleafclover614 left a reply on API Auth

I did consider localStorage, but how do you store something on the client side without making another AJAX call after the user authenicates? For example, let's say the user authenticates normally (username /password or via a third party) and then the homepage loads. As far as I know the only way to then store data in localStorage is to do it via JavaScript. Where do I get the token from? Do I send it back in the HTTP headers after they authenticate the first time, then store it on the client? Something else?

Unless I am missing something, using JWT generally fits nicely if you are building an API that you plan on opening up to the public or third parties, where you need another way of authenticating and authorizing users before they interact with it. If you have an existing web application with a handful of RESTful API routes for your scattered JavaScript components (for example, Vue) to talk to, I don't know the best way to utilize the JWT flow.

23 Jan
3 years ago

noleafclover614 started a new conversation PHPStorm And *.vue Files

Has anyone gotten PHPStorm (v10) to recognize *.vue files? Mine compile down just fine, but I get pretty bad syntax errors littered all over the IDE...

noleafclover614 left a reply on API Auth

At this point the only consumer of my API will be my application itself. I offer normal Laravel registration/login for users as well as Social authentication (Socialite). I looked into JWT for this but it seemed like overkill. Even if I did want to explore JWT for my scenario, I don't know where I'd store the token for users after they authenticate themselves.

noleafclover614 started a new conversation API Auth

If I am building a standard MVC app with an API that I only plan on using for some simple Vue AJAX calls, do I need to worry about authentication? That is, can I simply rely on the normal Laravel authentication scheme and protect the API routes with the normal auth middleware?

22 Jan
3 years ago
17 Jan
3 years ago

noleafclover614 started a new conversation Vue Components With A "traditional" Server Based App

Is anyone using Vue to just add a little bit of functionality to their traditional server side apps? I have a basic MVC app, using Blade views. On some areas of the app I want to add some Vue interactivity, but I am struggling with how to structure things. Basically, I just want to attach Vue to some of the existing elements the app serves up already.

Thoughts?

10 Jan
3 years ago

noleafclover614 left a reply on Registration Route - Page Not Found

I am pretty sure I followed all of that, but perhaps I should try again. Thanks for your assistance. I should note that while I think I followed the instructions, but I had a 5.X version prior to 5.1 so maybe I missed something...

Maybe I can try a fresh install of 5.2 and migrate my site over.

noleafclover614 left a reply on Registration Route - Page Not Found

@Qlic thanks for the reply.

If I Try a "GET" I see the following:

MethodNotAllowedHttpException in RouteCollection.php line 219:

noleafclover614 left a reply on Registration Route - Page Not Found

@Qlic OK, so it looks like I had some outdated info in my Kernel.php file. I was missing the web middleware group, and that middleware group was not in my routes.php file.

I added all of this in, and tucked all of my routes inside of this new group, but I get the same exact result (Page Not Found) after posting.

routes.php

Route::group(['middleware' => ['web']], function () {

 ...
});

noleafclover614 left a reply on Registration Route - Page Not Found

@Qlic can you elaborate? Where can I check for this?

noleafclover614 left a reply on Registration Route - Page Not Found

@Qlic I forgot to mention that I already did this (using the route name) but I get the same result.

noleafclover614 started a new conversation Registration Route - Page Not Found

I am using Homestead on my development machine. I have had a site working for a while using two custom registration routes. Each route accepts a different Form Request via POST and registers a user. The reason the routes are split is because there are two types of users that can register and they need to be handled differently.

After updating to Laravel 5.2, every time I try to submit a POST request, I get a "Page Not Found" error.

Routes:

Route::post('register/editor', [
    'as' => 'editor_signup',
    'uses' => 'Auth\AuthController@postEditorRegister'
]);

Route::post('register/admin', [
    'as' => 'admin_signup',
    'uses' => 'Auth\AuthController@postAdminRegister'
]);

Forms:

<form class="form-horizontal" role="form" method="POST" action="{{ route('admin_signup') }}"> ...

<form class="form-horizontal" role="form" method="POST" action="{{ route('editor_signup') }}"> ...

AuthController.php

    public function postEditorRegister(EditorSignUpRequest $request)
    {
        //code
    }

    public function postAdminRegister(AdminSignUpRequest $request)
    {
        //code
    }

Been stumped on this one for a while. I've tried the typical composer dump-autoload and various php artisan [command] commands to no avail.

06 Jan
3 years ago

noleafclover614 started a new conversation "loading" Animation After Login To Laracasts

I was just wondering - how did @JeffreyWay implement the loading animation after logging in? I am pretty sure it's part of the Sweet Alert package. Is it possible to use this animation (with the three dots bouncing) outside of a popup window?

01 Jun
4 years ago

noleafclover614 left a reply on Laravel 5 Password Reset Not Working

@esseremmerik - I was having this exact same problem, and your response helped me solve it. Thank you!

30 May
4 years ago

noleafclover614 left a reply on User Interface - Javascript, AJAX, And "waiting" For A Response

@johanobergman - interesting idea. It kind of sounds like you'd be setting a temporary "updating" state on the model as you wait for the server to respond. Even if you did this, (using the "todo" example) it still seems like you'd have to decide whether to show the newTodo model in the list right away or after the server responds. The other option would be, using a modified version of @Ruffles approach, add some kind of "updating" class to the object after adding it while you wait.

Another intriguing implementation of updates that don't wait for a server response is the Facebook App - e.g. "you can still post while offline."

noleafclover614 left a reply on User Interface - Javascript, AJAX, And "waiting" For A Response

Not a bad idea, and I've done similar things in my backbone flavored apps. But the question remains - how is Trello able to do this so quickly, circumventing the need for a loading animation?