Dracool

Dracool

Member Since 3 Years Ago

Experience Points 1,530
Experience Level 1

3,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 9
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.

21 Jan
3 years ago

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@premsaurav You want only the mvc or the entire laravel folder? I don't know if I can even attach something here.

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@premsaurav The query works now, but pagination doesn't. I asked when I opened the thread should I include something somewhere that deals with pagination because I have nothing included in any of the mvc components.

Pagination doesn't put links at the bottom, it just writes the raw code. I tried with {!! $all->render() !!}, {!! $all->links() !!}, {!! $post->render() !!} and {!! $post->links() !!} but none of those work, laravel just puts that code at the end of the page.

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@premsaurav Now I just feel silly for wasting people's time. I'm still grateful for the help though.

Query works, but pagination still doesn't work.

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@premsaurav Oh, didn't see that. Thanks!

Ok, so it works like @bestmomo said, but pagination and query still don't work.

Yes I'm sure. I can send you a screenshot of the database if you want, since its a dummy base I use for learning stuff. I also tested with the dd thing - it returned a huge text. But it only picked items from the database to the 4th item. So I guess it only picked the first 4 items and then it stops.

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@bestmomo Tried what you said, but now it throws a:

ErrorException (E_ERROR) HELP Undefined variable: all (View: C:\xampp\htdocs\laravel\app\views\pages\posts.blade.php)

Controller

public function grabPosts()
    {
        /*$model = [];
        $model['all'] = Blogposts::getAllPosts();
        dd($model);*/
        $all = Blogposts::getAllPosts();
        return View::make('pages.posts', compact($all));        
    }

View

@extends('app')

@section('content')

<h1>All Posts</h1>

@foreach ($all as $post)
        <table class="table">
            <tr>
                <td>
                <tr><th><h2><kbd><font color='lime'>{{ $post->postname }}</font></kbd></h2>
                <kbd><font color='cyan'>{{ $post->postdate }}</font></kbd>
                <kbd><font color='red'>{{ $post->catname }}</font></kbd></th></tr>
                <tr><td><blockquote><font color='gray'>{{ mb_substr($post->postdesc, 0,120,'UTF-8') }}</font>
                <a href="{{ URL::to('/posts/').'/'.$post->postid }}">read more</a></blockquote>
                </td>
            </tr>
        </table>
    @endforeach
                {!! $post->links() !!}
@stop

Dracool left a reply on Pagination + Query Results (not Working As Intended)

@bestmomo Thanks for the reply. I tried what you wrote, didn't work.

I have nothing included in my controller, its just a basic plain controller. Here is the function for the blogposts though:

public function grabPosts()
    {
        $model = [];
        $model['all'] = Blogposts::getAllPosts();
        /*dd($model);*/
        return View::make('pages.posts', array('all' => $model));       
    }

Dracool started a new conversation Pagination + Query Results (not Working As Intended)

I have 15 posts in my blogposts database and I want laravel to show 5 of them on page (would take 3 pages) in total.

But both the query and pagination don't work.

For some reason, the query returns only 4 items and the pagination doesn't work at all (even though pagination cuts the items selected when I specify how many)

$data = DB::table('blogposts')
        ->select('*')
        ->join('blogcategories', 'blogposts.postid', '=', 'blogcategories.id')
        ->paginate(5);
@foreach ($all['all'] as $post)
        <table class="table">
            <tr>
                <td>
                <tr><th><h2><kbd><font color='lime'>{{ $post->postname }}</font></kbd></h2>
                <kbd><font color='cyan'>{{ $post->postdate }}</font></kbd>
                <kbd><font color='red'>{{ $post->catname }}</font></kbd></th></tr>
                <tr><td><blockquote><font color='gray'>{{ mb_substr($post->postdesc, 0,120,'UTF-8') }}</font>
                <a href="{{ URL::to('/posts/').'/'.$post->postid }}">read more</a></blockquote>
                </td>
            </tr>
        </table>
    @endforeach
                {!! $post->render() !!}
@stop

What am I doing wrong? Do I need to include something for pagination to work (though following the documentation, I see nothing like that)

18 Jan
3 years ago

Dracool left a reply on Getting Model Data (manually)

@premsaurav Awesome that did the job. Thank you!

@pmall - If there are no mistakes, there would be no learning. What's the point then.

Dracool left a reply on Getting Model Data (manually)

@premsaurav I did that with the dd thing. Awesome, it dumped the entire array into the screen. There is a ton of data there so I will skip copy-paste because its too much.

EDIT: After inspecting it, it says its an object of stdclass. I will copy the first entry of the array:

array(1) { ["all"]=> array(10) { [0]=> object(stdClass)#143 (5) { ["postid"]=> int(1) ["postname"]=> string(21) "Assassins Creed Unity" ["postdate"]=> string(10) "2015-11-06" ["postdesc"]=> string(3) "aaa." ["postcatid"]=> int(1) }

Dracool left a reply on Getting Model Data (manually)

@premsaurav haha, no this is just for testing. I'm trying to brute force laravel knowledge with the best way I know how: trying and testing stuff out.

I tried what you said, changed it to $all['all'] but now it throws a Cannot use object of type stdClass as array exception.

Dracool left a reply on Getting Model Data (manually)

@pmall I tried what you said, changed {{ $post['postname'] }} but now I get a Undefined index: postname (View: C:\xampp\htdocs\laravel\app\views\pages\posts.blade.php) exception.

Dracool left a reply on Getting Model Data (manually)

@cawex I get a Trying to get property of non-object (View: C:\xampp\htdocs\laravel\app\views\pages\posts.blade.php) exception. In my table its "postname" so I tried what you said only changed name to postname no luck though.

Dracool started a new conversation Getting Model Data (manually)

I'm trying to recreate a blog website of mine in Laravel. I want to try output data from a db but I'm getting a Array to string conversion (View: C:\xampp\htdocs\laravel\app\views\pages\posts.blade.php)

Note: I'm not using Eloquent, I wanted to try manual MVC.

Controller

public function grabPosts()
    {
        $model = [];
        $model['all'] = Blogposts::getAllPosts();
        return View::make('pages.posts', array('all' => $model));       
    }

Model

class Blogposts {

    public static function getAllPosts()
    {
        $data = DB::table('blogposts')->get();
        /*$data = DB::select('SELECT * FROM blogposts');*/
        return $data;
    }
}

View

@extends('app')

@section('content')

<h1>All Posts</h1>

@foreach ($all as $post)
        <table class="table">
            <tr>
                <td>
                    {{ $post }}
                </td>
            </tr>
        </table>
    @endforeach

@stop

What am I doing wrong?

Dracool left a reply on I'm Starting To Hate Laravel

Wow so many cool replies. Thanks guys. I took a week and half off Laravel and thought about it. I like CI because I haven't worked on a big project, or even a medium project and it feels like I'm in control. The biggest projects I've done are a blog and a mini-warehouse application for a small business.

Laravel is too awesome for me at this point. This is what I've come to realize. Its not the language, community or the documentation. Its just that it forces me to learn too many new things because of my lack of skills / understanding in PHP. I just learned MVC in CI a couple of months ago and I came into laravel thinking "I already learned MVC, so this should be piece of cake". Like I said, I made wrong assumptions coming here and thinking I'm so hot.

I'll start again from scratch. Also @skliche thank you for that "composer install laravel 5.0". I got angry primarily because the files in my laravel were so different and got into so many problems right from the start. I will definitely try this again!

11 Jan
3 years ago

Dracool left a reply on I'm Starting To Hate Laravel

@bashy Thanks, will give that a go then. Is it from previous version though? Because I've had enough of "can't find the file" problems with the fundamentals tutorial so far.

@ZetecVan Thank you :) Good feedback. I will stick with it, either now or learn it at later date. In any case, I intend to learn Laravel at some point. Maybe I need some grunt work before I do though

Dracool left a reply on I'm Starting To Hate Laravel

Thanks for the feedback guys. All of you

I made a wrong assumption. I thought that everyone is like Jeffrey and feeling frustrated because I'm not getting it.

I'll definitely check that flyer tutorial, thanks @christopher

Can anyone suggest some simpler tutorials than the Laravel Fundamentals? Maybe I've been doing this wrong, instead of going for the hard tutorials I should literally start from the simplest ones. Maybe that will make it click for me

Dracool left a reply on I'm Starting To Hate Laravel

@bashy Almost a month.

Sure, I agree to your year statement. But I'm learning laravel now, not actively using it. I just expect to know more than I do now.

Maybe I'm too stupid or inexperienced to learn Laravel at this point of time.

Dracool left a reply on I'm Starting To Hate Laravel

@christopher Here are my main reasons of why I find laravel so far difficult:

  • Its dependent on many things you need to learn. Composer, Artisan, Tinker, Eloquent, Vagrant, Homestead...
  • You can't just jump in and start coding. Before you even do that you have to at least have some vague understanding of the above. I don't want to learn any of these above, but the tutorials I try and follow enforce all of the above and market them "so simple, so effective". For me, they are just unnecessary and a drag
  • The code is hard to understand because Laravel is so structured, so automated...
  • People say documentation is great. I don't see this. In my opinion, CI has a much better documentation than Laravel

@Ruffles I am openly stating a problem I have with this framework. I'm serious enough.

No I don't expect to stay the same all the time. I also don't expect development to rapidly change. To me, Laravel is a rapid new change from the frameworks I feel comfortable with.

Note that I find this difficult, I'm not saying this is innately difficult for everyone.

Dracool started a new conversation I'm Starting To Hate Laravel

I don't know about other beginners with Laravel like myself but so far the only thing I've discovered is how frustrating it is to depend on sooo many things that I don't understand. It feels like I need to change 720 degrees in order to just "keep the modern trend"

The video tutorials SHOULD be making it easier, but they aren't. I keep re-listening Jeffrey Way and its only making me pissed for not understanding most of it.

I should say that I like Code Igniter. Its a framework that I learned MVC on and that is stuck with me. But maybe I need to learn other frameworks and do some projects with them before I come back to laravel because -> I may just lack appreciation for Laravel's "simplicity". I haven't seen that simplicity anywhere, it just made PHP more complex for no reason and introduced so many 3rd party tools it made me puke.

Anyone want to share some tips with me on what should I do?

08 Jan
3 years ago

Dracool started a new conversation Local Database Test Without Homestead

Hi. I'm using laravel with xampp on windows 7. I want to go along with the Laravel Fundamentals tutorials but I'm having difficult time figuring out how to set the database up.

Previously with Codeigniter, I just made a function to connect to it. But now since Laravel is so automatic and comes pre-packaged I'm confused. I know that App/Database.php file holds all information about connecting to a database, but how do I do it with a local database?

I'm using port 127.0.0.1 at http://localhost/phpmyadmin/ to connect to my database. What do I change in the file?

05 Jan
3 years ago

Dracool left a reply on Artisan Commands Confusion

@ChristopherRaymond - Thank you, I did try the help command but like I said it confused me. I watch the tutorials and the version he uses is 4.0 laravel so I got the same version to follow the tutorials because version 5.0 seemed quite different in folder structure and controller/views. Like I said, in the tutorial he uses different commands than mine.

I don't know why that is so. I just hope that when I get to the latter tutorials, I have all the commands as he does because I will get stuck otherwise.

30 Dec
3 years ago

Dracool started a new conversation Artisan Commands Confusion

Hello everyone. I'm new to laravel I've just started learning.

I'm following the: Laravel 5 Fundamentals tutorial and so far I'm at lesson 4. But there is a big problem: the commands for artisan shown in the tutorial and in the laravel documentation don't work for me. Instead I have some other commands that work for me like:

make:controller throws an error "There are no commands defined in the make namespace" while controller:make works for me.

I am worried because this is only the start of the tutorial lessons and already I have major conflicts artisan. I'm afraid that later on I won't be able to perform some major things and get stuck. So please give me advice on why this is so?

I should say that I don't have homestead installed. I am working through XAMPP and cmd on windows.