Coder Social home page Coder Social logo

nettuts-laravel4-and-backbone's Issues

issue installation

Hi,

I have download and run composer install but when I run it, there is 1 problem, said that mustcache it's require 2 time, by way/generators and mustcache, so I change by removing second mustache

"require": {
    "laravel/framework": "4.0.*",
    "way/generators": "dev-master",
    "twitter/bootstrap": "dev-master"
},

And it work fine.

Then I run npm install and check, but I got error that mustache it's missing....

Any suggestion?

thanks

untitled

errors on sudo composer install --dev

I get below errors when I try "sudo composer install --dev"
Please let me know any fixes. Thanks.

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for way/generators dev-master -> satisfiable by way/generators[dev-master].
- conarwelsh/mustache-l4 dev-master requires illuminate/support ~4 -> satisfiable by laravel/framework[4.0.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.11, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9], illuminate/support[4.0.x-dev, 4.1.x-dev, 4.2.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0-BETA1, v4.2.1, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
- Can only install one of: illuminate/support[5.0.x-dev, 4.0.x-dev].
- Can only install one of: illuminate/support[5.0.x-dev, 4.1.x-dev].
- Can only install one of: illuminate/support[5.0.x-dev, 4.2.x-dev].
- Can only install one of: illuminate/support[v4.0.0, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.0-BETA2, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.0-BETA3, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.0-BETA4, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.1, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.10, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.2, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.3, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.4, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.5, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.6, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.7, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.8, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.0.9, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.0, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.1, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.10, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.11, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.12, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.13, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.14, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.15, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.16, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.17, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.18, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.19, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.2, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.20, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.21, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.22, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.23, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.24, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.25, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.26, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.27, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.28, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.29, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.3, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.30, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.4, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.5, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.6, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.7, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.8, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.1.9, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.0-BETA1, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.1, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.2, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.3, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.4, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.5, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.6, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.7, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.8, 5.0.x-dev].
- Can only install one of: illuminate/support[v4.2.9, 5.0.x-dev].
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework 4.0.x-dev
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.0
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.0-BETA2
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.0-BETA3
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.0-BETA4
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.1
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.10
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.11
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.2
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.3
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.4
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.5
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.6
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.7
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.8
- don't install illuminate/support 5.0.x-dev|don't install laravel/framework v4.0.9
- way/generators dev-master requires illuminate/support ~5.0 -> satisfiable by illuminate/support[5.0.x-dev].
- Installation request for conarwelsh/mustache-l4 dev-master -> satisfiable by conarwelsh/mustache-l4[dev-master]

Conflicting requirements

mustache-l4 and way/generators both require different versions of mustache/mustache:

root@laravel:/var/www# composer install --dev
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for way/generators dev-master -> satisfiable by way/generators[dev-master].
    - way/generators dev-master requires mustache/mustache 2.4.* -> satisfiable by mustache/mustache[v2.4.0, v2.4.1].
    - Can only install one of: mustache/mustache[v2.4.0, dev-master].
    - Can only install one of: mustache/mustache[v2.4.1, dev-master].
    - conarwelsh/mustache-l4 dev-master requires mustache/mustache dev-master -> satisfiable by mustache/mustache[dev-master].
    - Installation request for conarwelsh/mustache-l4 dev-master -> satisfiable by conarwelsh/mustache-l4[dev-master].

Cannot read property 'perPage' of undefined

I am having the same problem as http://code.tutsplus.com/tutorials/combining-laravel-4-and-backbone--net-31745#comment-1107963316 except that while one of the vague solutions does prevent the error message, nothing visually change because I just end out with a top bar that says "Nettuts Tutorial Blog" and the page just has the word "on". I did seed the DB, also.

Here was the original comment for reference:

For some reason I am getting a javascript error "Cannot read property 'perPage' of undefined"

I even took the app.js source from GitHub and still have the same issue.

Any ideas?

Bind Code

Is it common practice to put the bind in the routes.php?

App::bind('PostRepositoryInterface', 'EloquentPostRepository');
App::bind('CommentRepositoryInterface', 'EloquentCommentRepository');

Or is there a better place to put them? like a service provider?

app.js

I receive this error when i try to run it.
Uncaught TypeError: Cannot read property 'perPage' of undefined.
Please provide some help, backbone newbie.
It will be so good to have a demo link.

Thanks

notification not defined

In your event handlers on the backbone side, it should be notifications.add instead of notification.add

Weird Bug related to Eloquent and Mustache at /post/{id} page

Hi I'm having trouble with generating html output at laravel server side.

With Javascript Disabled in Google Chrome, there are posts BUT without comments in /posts/{id}.

Here's my route.

Route::get('posts/{id}', function($id)
{
    $post = App::make('PostRepositoryInterface')->findById($id);
    return View::make('layouts.application')->nest('content', 'posts.show', array(
        'post' => $post,
    ));

});

I added debug code in "show.mustache" file to findout what is happening.

<pre>
    {{{post}}}
</pre>

Here is my show.mustache

<article>
    <h3>
        {{ post.title }} {{ post.id }}
        <small>{{ post.author_name }}</small>
    </h3>
    <div>
        {{ post.content }}
    </div>
</article>

<div>

    <pre>
    {{{post}}}
    </pre>

    <h2>Add A Comment</h2>
    {{> comments._form }}

    <section data-role="comments">
        {{#post.comments}}
            <div>
                {{> comments._comment }}
            </div>
        {{/post.comments}}
    </section>
</div>

JSON Output shows that there are both posts and comments included within post.

{"id":"2","title":"Test Post","content":"Lorem ipsum Reprehenderit velit est irure in enim in magna aute occaecat qui velit ad.","author_name":"Conar Welsh","created_at":"2013-06-23 16:09:45","updated_at":"2013-06-23 16:09:45","comments":[{"id":"3","content":"a","author_name":"a","post_id":"2","created_at":"2013-06-23 16:10:01","updated_at":"2013-06-23 16:10:01"},{"id":"2","content":"Lorem ipsum Nisi dolore ut incididunt mollit tempor proident eu velit cillum dolore sed","author_name":"Testy McTesterson","post_id":"2","created_at":"2013-06-23 16:09:45","updated_at":"2013-06-23 16:09:45"}]}

BUT.....
when I changed the debug code from {{{post}}} to {{{post.comments}}}

Laravel showed orange screen with this error.

Object of class Illuminate\Database\Eloquent\Relations\HasMany could not be converted to string

 if ($partial = $this->mustache->loadPartial('comments._form')) {
            $buffer .= $partial->renderInternal($context, ' ');
        }
        $buffer .= $indent . '  <pre>';
        $buffer .= "\n";
        $buffer .= $indent . '  ';
        $value = $this->resolveValue($context->findDot('post.comments'), $context, $indent);
        $buffer .= $value;
        $buffer .= "\n";
        $buffer .= $indent . '  </pre>';

How should I solve the Eloquent's error?


I tried to do some tricks to avoid the bug, and it worked.
But it seemed causing inefficiency of querying $comments twice.

(both $posts and $comments shared the same comments data, and the Laravel's ORM feature is not being utilised.)

Route::get('posts/{id}', function($id)
{
    $post = App::make('PostRepositoryInterface')->findById($id);

    $comments = App::make('CommentRepositoryInterface')->findAll($post->id);
    return View::make('layouts.application')->nest('content', 'posts.show', array(
        'post' => $post,
        'comments' => $comments,
    ));

});
<article>
    <h3>
        {{ post.title }} {{ post.id }}
        <small>{{ post.author_name }}</small>
    </h3>
    <div>
        {{ post.content }}
    </div>
</article>

<div>


    <h2>Add A Comment</h2>
    {{> comments._form }}


    <section data-role="comments">
        {{#post.comments}}
            <div>
                {{> comments._comment }}
            </div>
        {{/post.comments}}
        {{#comments}}
            <div>
                {{> comments._comment }}
            </div>
        {{/comments}}
    </section>
</div>

Thank you for your time for reading this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.