marcogmonteiro

Member

Last active 3 years ago

  1. 3 years ago
    15 Oct 2013, 8:45pm GMT+0000
    marcogmonteiro posted in Get the next and previous post.

    In case someone needs this:

    PostController.php

    	public function getShow($slug)
    	{
    		$post = $this->posts->findBySlug($slug);
    		$prev = DB::table('posts')->orderBy('id', 'asc')->where('id', '>', $post->id)->where('active', '1')->first();
    		$next = DB::table('posts')->orderBy('id', 'desc')->where('id', '<', $post->id)->where('active', '1')->first();
    		if ( ! $post)
    		{
    			return App::abort(404, 'Page not found');
    		}
    
    		return View::make('themes.'.$this->theme.'.post', compact('post', 'next', 'prev'));
    	}

    and you can see this result here:

    http://blog.marcomonteiro.net/post/taking-over-a-big-job

  2. 14 Oct 2013, 2:49pm GMT+0000
    marcogmonteiro posted in Get the next and previous post.

    Solved, I should've been using first() and not get. And I should obviously use a order by statement too.

  3. 14 Oct 2013, 12:32pm GMT+0000
    marcogmonteiro started the conversation Get the next and previous post.

    Hi there,

    how would I go about getting the next and previous post having in mind that I'm on the post detail page.

    I know the logic would be to pick the current post id from here:

    $post = $this->posts->findBySlug($slug);

    and then get the next and previous one using something like:

    $next = DB::table('posts')->where('id', '>', $post->id)->get();
    $previous = DB::table('posts')->where('id', '<', $post->id)->get();

    but somehow this is not working. :-(

  4. 9 Oct 2013, 3:29pm GMT+0000

    That is indeed the correct order of things to install. However I think in your case would be easier to just install mamp, then composer and be done with it.

  5. 4 years ago
    11 Sep 2013, 8:11am GMT+0000
    marcogmonteiro posted in My Wardrobe Base Theme.

    Nice =)

  6. 8 Sep 2013, 11:13am GMT+0000
    marcogmonteiro posted in TindrLabs.com.

    Cool beens man! =)

  7. 6 Sep 2013, 1:49pm GMT+0000

    Like I said, there was not much to it. All the changes where mostly on the default template and not on the wardrobe code per say.

    Actually I just made a pull request with a few of my changes to the default template. So in a next version of wardrobe you can expect a responsive design.

  8. 6 Sep 2013, 12:23pm GMT+0000
    marcogmonteiro started the conversation My first wardrobe app: blog.marcomonteiro.net.

    Here's the only wardrobe app I'm running at the moment. http://blog.marcomonteiro.net/

    I use it as my main app, I made some modifications to the default layout. I made it responsive, added read more capability and font-awesome so I could use some icons every now and again.

    I also integrated disqus.

  9. 6 Sep 2013, 12:19pm GMT+0000
    marcogmonteiro posted in integrating wardrobe in laravel app.

    I would be easier to do the exact opposite I guess. Have wardrobe has your main app and build around it if you want more functionality than your basic blog app. At least that's what I'm planing to do on a future project.

  10. 6 Sep 2013, 11:42am GMT+0000
    marcogmonteiro joined the forum.