maniaquiz

maniaquiz

Member Since 3 Years Ago

Experience Points 1,285
Experience Level 1

3,715 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 0
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.

26 Feb
2 years ago
20 Jun
2 years ago

maniaquiz started a new conversation Intervention Imagecache Returning 404 In Nginx

Okay, so finally decided to move my 5.1 project to Digitalocean.

I have a Nginx server and I wanna use it's "Caching powers" so I decided to use this config from laravel-tricks.

The problem is that everything returned by Intervention Imagecache were 404. I have the same problem like this one but still can't find the right solution.

Another question, how can I block a location on my server blocks. I just wanna block requests for "images" which I set on my imagecache config.

/*
    |--------------------------------------------------------------------------
    | Name of route
    |--------------------------------------------------------------------------
    |
    | Enter the routes name to enable dynamic imagecache manipulation.
    | This handle will define the first part of the URI:
    | 
    | {route}/{template}/{filename}
    | 
    | Examples: "images", "img/cache"
    |
    */
   
    'route' => 'images',

What I wanna achieve could be ...

 # Allow all but not on /images/
    location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
            expires 365d;
    }

I'm not sure actually what I'm saying.

15 Jun
3 years ago

maniaquiz left a reply on File Upload Using Nginx And Php5-fpm

Could it be folder permissions?

19 Apr
3 years ago

maniaquiz left a reply on Cannot Allocate Memory - Is It Dead?

Thank you for your reply @christopher , which log are you referring to? when i try to connect via ssh, i get a

/etc/bashrc: fork: Cannot allocate memory

And yes, i don't think i ran out of memory. On my cpanel only the "number of processes" pumped up to 97/100, but I don't think I can see what are these processes are.

maniaquiz started a new conversation Cannot Allocate Memory - Is It Dead?

I have a GoDaddy Linux server running 512 ram. While connecting to the server via ssh, it will display -bash: fork: Cannot allocate memory On my cPanel it shows that my server has reached its "Number of Processes" limit. Now, i just wanna ask, will this refresh? like daily? is this just temporary? or I'll just forget about these and just get a better hosting?

08 Feb
3 years ago

maniaquiz left a reply on Nested Grouping

anyone?

maniaquiz left a reply on Nested Grouping

Hi @Lui14 thanks for the info but I tried this once but I think my approach is much better. One think I wanna achieve on my question is more on the grouping part.

maniaquiz started a new conversation Nested Grouping

Im having a hard time doing this nested groupBy(). I'm trying to create a notification system. I would like to use Query Builders or at-least use Eloquent on this so I don't have to create conditional statements.

My approach.

A Notification Model which will act as the Parent for Polymorphic Relationship.

Then I have these models for it's children:

  • Like
  • Comment
  • Vote
  • Reply
  • Mention
  • Follow

At the moment, I get single instances of these. And yeah, that works fine.

Ex.

  • User A like your post.
  • User B like your post.
  • User A commented on your post.

What I'm trying to achieve here is that I would like to group them by each type.

Say:

  • User A and 1 other like your post.

I'm confuse here so I'm really having a hard time explaining it also. :(

10 Jan
3 years ago

maniaquiz started a new conversation Best Relationship For "Mentions"

What's the best relationship if I try to create a "mention" feature on my app? I have a status, comment, reply model. Of course, I have a User model.

I'm using Many To Many Polymorphic Relations for this, for now. And turns out I can have outputs like these.

{"id":"1","user_id":"1","created_at":"2016-01-11 05:13:57","updated_at":"2016-01-11 05:13:57","pivot":{"mentionable_id":"10","mention_id":"1"}}

Well, basically I think this will work but I would like to ask if I'm doing it right?

09 Jan
3 years ago

maniaquiz left a reply on Where Are You All From?

We all came from our father, moved to our mother. lol

is this reply offensive or full of spam?

maniaquiz left a reply on Quick Tip? File Upload On Production

Thank you for asking but I think that's not the case because I also have another form that does the same. Except this method is post. By the way the one above uses patch and sent via ajax.

maniaquiz left a reply on Quick Tip? File Upload On Production

Either request file for avatar or cover returns null when I try to dd. I don't know what's wrong 'cuz it's working fine on my dev env.

$this->validate($request, [
            'avatar' => 'sometimes|mimes:jpeg,bmp,png',
            'cover' => 'sometimes|mimes:jpeg,bmp,png',
            ]);

            $reqAvatar = $request->file('avatar');
            $reqCover = $request->file('cover');

            if ($request->hasFile('avatar') && $reqAvatar->isValid()) {
                $avatarFileExt = $reqAvatar->getClientOriginalExtension();
                $avatar = str_random(10).'_'.time().'.'.$avatarFileExt;

                $image = Image::make($reqAvatar);
                $image->backup();

                $image->fit(100);
                $image->save('images/avatars/thumb/'.$avatar);

                $image->reset();

                $image->fit(800, 600, function ($constraint) {
                    $constraint->aspectRatio();
                    $constraint->upsize();
                });

                $image->save('images/avatars/'.$avatar);

                Auth::user()->update(['avatar' => $avatar]);

                $returnPATH = asset('images/avatars/thumb/'.Auth::user()->avatar);

                $message = 'Your avatar has been successfully changed.';

                return response()->json([
                'path' => $returnPATH,
                'message' => "<strong class='text-success'>Great!</strong> ".$message,
                ], 200);
            }

            if ($request->hasFile('cover') && $reqCover->isValid()) {
                $coverFileExt = $reqCover->getClientOriginalExtension();
                $cover = str_random(10).'_'.time().'.'.$coverFileExt;

                $image = Image::make($request->file('cover'))->encode('jpg', 50);
                $image->backup();

                $image->resize(null, 460, function ($constraint) {
                    $constraint->aspectRatio();
                    $constraint->upsize();
                });

                $image->save('images/cover/thumb/'.$cover, 50);

                $image->reset();

                $image->resize(null, 460, function ($constraint) {
                    $constraint->aspectRatio();
                    $constraint->upsize();
                });

                $image->save('images/cover/'.$cover);

                Auth::user()->update(['cover' => $cover]);

                $returnPATH = asset('images/cover/thumb/'.Auth::user()->$cover);

                $message = 'Your cover photo has been successfully changed.';

                return response()->json([
                'path' => $returnPATH,
                'message' => "<strong class='text-success'>Great!</strong> ".$message,
                ], 200);
            }

maniaquiz started a new conversation Quick Tip? File Upload On Production

So I have a form on local dev where I can upload images and it works.. but when I uploaded it on my web server. It doesn't seem to work. I mean, the form is working but It's returning null.

29 Dec
3 years ago

maniaquiz left a reply on Handling User Generated Contents

How can i display it? "{{{ ... }}}" or {!! .. !!} ? I want to avoid using {!! !!}.

maniaquiz started a new conversation Handling User Generated Contents

Let's say...

A user posted:

hello world!! <script>alert('hi');</script> www.google.com

Then, we could just securely display it using "{{{ ... }}}" . But how about if I want to still want to securely display this but will display the link as a clickable one. like this

How do you handle this? I mean, how can we secure this inputs?

04 Dec
3 years ago

maniaquiz left a reply on IE8 Yes Or No?

Pop them to upgrade/change their browser.

22 Nov
3 years ago

maniaquiz left a reply on Laracast's New Design?

I care. lol

19 Nov
3 years ago

maniaquiz left a reply on Database Design For Millions Of Posts

Just looking at it, Option 2 looks more organized. :)

maniaquiz left a reply on Laracast's New Design?

@martinbean No, because that's the Purple theme I'm talking about. What you see is what I meant. Try browsing Heroku more and you'll see Laracast looks like it.

maniaquiz left a reply on Content Duplication On Infinite Scroll

Please consider the series of event.

When User A loaded the first page. He will get this results.

    Entry 1
    Entry 2
    Entry 3
    Entry 4
    Entry 5

Then User B updated his status. ** This should then be Entry 1 ** as we are querying the ** Statuses ** by the most recent one's.

Later on, User A continues to load the second page. He should still get:

    Entry 6
    Entry 7
    Entry 8
    Entry 9
    Entry 10

But instead, User A will get this because User B's status pushed the stack with his post.

    Entry 5
    Entry 6
    Entry 7
    Entry 8
    Entry 9

maniaquiz left a reply on Front End Frameworks

You should try materialize, a modern responsive front-end framework based on Material Design.

maniaquiz left a reply on Front End Frameworks

A good alternative for Bootstrap is Bootstrap. :D lol

Probably wait for new releases from Bootstrap 4.

maniaquiz started a new conversation Content Duplication On Infinite Scroll

So, I'm trying to create an app that Users may post their status just like any social media platform.

I'm implementing my own custom made Ajax infinite scroll , which relies on the simple paginate that comes with Laravel.

The problem here is content duplication. Eg.

  • simple paginate is set to return 5 entries per page

  • User A. loaded the first page. Entry 1 Entry 2 Entry 3 Entry 4 Entry 5

  • User. B updated his status.

  • User A loaded the second page. Entry 5 Entry 6 Entry 7 ... so on

As you can see, if I'm good explaining this. There's a duplication in ** Entry 5** . How can I control this behavior?

maniaquiz left a reply on Laracast's New Design?

@jeffreyway and also based on material design right?

16 Nov
3 years ago

maniaquiz started a new conversation Markdown Editor For Client App?

What's the best package out there that's great for client app? Something that will just format line breaks and links? Something that will not expose vulnerabilities for XSS?

maniaquiz started a new conversation Laracast's New Design?

So what's Laracast's new design made of? Is this some custom theme? A new front-end framework? Any guess? It's a great inspiration.

I think it's from Heroku's purple theme which is only available to their employees.

maniaquiz left a reply on Extending Laracast/Presenter On Other Models?

Okay, alright, I'll just stick with a single presenter then. :)

maniaquiz left a reply on Extending Laracast/Presenter On Other Models?

Thanks @bobbybouwmann but I already did this and it worked. I just need to clean up my PostPresenter because It's getting little bit populated.

So how can I extend my PostPresenter then? Is this possible?

maniaquiz started a new conversation Extending Laracast/Presenter On Other Models?

Started using Laracast Presenter, I already have: *PostPresenter

  • UserPresenter It works well when I use it like this.
{{ $post->user->present()->fullName }}

Now I wanna do this on my Like Model too so I can use it something like this.

{{ $post->likes->present()->likesCount }}

On my Like Model

use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;

class Like extends Model
{
    use PresentableTrait;

    protected $presenter = 'MyFolder\Presenter\LikePresenter';
}

On my LikePresenter it will be like this.

use Laracasts\Presenter\Presenter;

class LikePresenter extends Presenter
{
    public function likesCount()
    {
        return $this->count();
    }
}

How can I achieve this? I'm having *error 500*. Is this something to do with the likes returning a collection?

23 Sep
3 years ago

maniaquiz left a reply on Response View Links Not Working?

:D sorry The like button works well when i Like other posts (not returned by ajax). The problem is when i create a new post ("newly returned post") and then like it, it will not work, instead it will follow the href attr.

@if( post == new && post.isReturnedByAjax)
    likeBtn.willNotWork();
@else
    likeBtn.willWork();
@endif

maniaquiz left a reply on Response View Links Not Working?

Not on a newly returned Post.

Object {postid: "1100", likes: 1}
wallpost.js:65 [span#1100-like, context: document, selector: "#1100-like"]0: span#1100-likecontext: documentlength: 1selector: "#1100-like"__proto__: n[0]

On a newly returned Post.

Nothing. lol haha the "like button" will just follow the href attr
``

maniaquiz left a reply on Response View Links Not Working?

Eg. I create a post on facebook then i will "like" it after it will show up.

maniaquiz left a reply on Response View Links Not Working?

I just want to make another AJAX again on the returned View by Ajax. *** It's getting confusing. hard to explain

maniaquiz left a reply on Response View Links Not Working?

@belisar Hmmm...on the returned post. yeah something like that. We're getting there.

maniaquiz left a reply on Response View Links Not Working?

@belisar yes of course. because it should behave as a button which will either increase or decrease likes count. If i remove that it will just go to the link specified by href attribute

maniaquiz left a reply on Response View Links Not Working?

oh wait. i think i find something within those anchors

maniaquiz left a reply on Response View Links Not Working?

@belisar This are the generated links

/**
* normal Like action (no post made yet). i mean this are old post
*/
<a role="button" id="1100likeBtn" href="@gwapo/wallpost/1100/like"" target="_blank">http://ia.dev/@gwapo/wallpost/1100/like" data-target="#1100" class="like-btn card-link text-muted"><i class="fa fa-heart-o" aria-hidden="true"></i> <span id="1100-like">0</span></a>
/**
* when i Like a new post. (no page load) . Just returned post displayed by ajax
*/
<a role="button" id="1084likeBtn" href="@gwapo/wallpost/1084/like"" target="_blank">http://ia.dev/@gwapo/wallpost/1084/like" data-target="#1084" class="like-btn card-link text-muted"><i class="fa fa-heart-o" aria-hidden="true"></i> <span id="1084-like">3</span></a>

maniaquiz left a reply on Response View Links Not Working?

@belisar

data['likes'] came from my controller. Im sorry i didn't add that. It just update the Likes Count.

$returnNumberOfLikes = Like::where('wallpost_id', $id)->count();
    return response()->json([ 'postid'=> $id , 'likes' => $returnNumberOfLikes]);

maniaquiz left a reply on Response View Links Not Working?

Js

$('.like-btn').click(function(e){
    ...
    var url = $( this ).attr( "href" );
    $.ajax({
        url: url,
        type: "post",
        success: function(data){
            $('#'+data['postid']+'-like').html(data['likes']);
        },
     ...
});

maniaquiz left a reply on Response View Links Not Working?

Js

$('.like-btn').click(function(e){
    ...
    var url = $( this ).attr( "href" );
    $.ajax({
        url: url,
        type: "post",
        success: function(data){
            $('#'+data['postid']+'-like').html(data['likes']);
        },
     ...
});

maniaquiz left a reply on Response View Links Not Working?

@belisar well i'm using the same view (partial) to display the post.

maniaquiz left a reply on Response View Links Not Working?

Well, my code is something like this.

in the view ...others <a id="{{ $post->id }}-edit-post-btn" value="{{ $post->id }}" class="nav-link text-muted edit-post-btn" href="{{ route('wallpostedit', ['username' => $post->user->username, 'id' => $post->id]) }}">Edit</a> ...others

maniaquiz left a reply on Response View Links Not Working?

Well, my code is something like this.
in the view
...others Edit ...others </code

maniaquiz left a reply on Response View Links Not Working?

Well, my code is something like this.

view testing

maniaquiz started a new conversation Response View Links Not Working?

A user can create a post then it will be sent using ajax and return as a View ( response()->view() ) and also be displayed using ajax. The problem, links (generated using route) on this returned View doesn't work like those of the loaded once. *** this is confusing