salebab

salebab

Member Since 5 Years Ago

Belgrade

Experience Points
1,100
Total
Experience

3,900 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
61
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.

Level 1
1,100 XP
28 Nov
4 years ago

salebab left a reply on Laravel And Fractal

Hi all, I've just updated library to work with Laravel 5, the code is on brench L5. https://github.com/salebab/larasponse/tree/L5

Any suggestions are welcome :)

06 Oct
4 years ago

salebab left a reply on Laravel And Fractal

@mabasic like it! I'll put a link in readme file :)

01 Oct
4 years ago

salebab left a reply on Laravel And Fractal

@mabasic I choose to use ArraySerializer, but if you want to use other, just bind it:

App::bind('League\Fractal\Serializer\SerializerAbstract', 'League\Fractal\Serializer\DataArraySerializer');

So, you will define a serializer and then it will be used globally for all responses.

For the second example, your application outputs JSON object, but Fractal itself returns php array. You can dd($this->fractal->collection($arrangements, new ArrangementTransformer())); in your controller and you will see array.

salebab left a reply on Laravel And Fractal

You do not need to create a service provider, you can use larasponse or mentioned laravel-fractal. Only you need is to register a service provider in your app.php.

Btw, laravel-fractal lib seems more complete, there is a facade, and probably more options, but personally, I don't like the architecture.

On the other hand, with larasponse you will write less and more readable code, especially when you need to output paginated collection. Also, there is a default transformer that can output object as it is, include key is configurable on runtime, etc.

If you have a trouble to setup, please be more specific, it should be really straightforward, I've used on few projects and it works like a charm.

19 Sep
5 years ago

salebab left a reply on Laravel And Fractal

Hi @jgravois thanks for the comment.

You can read more about transformers here - http://fractal.thephpleague.com/transformers/ scroll down for "Classes for Transformers". Also, scroll more and see how to nest and transform related objects.

I'll try to update a library with more examples, but it's crucial for you to know how Fractal works.

15 Sep
5 years ago

salebab started a new conversation Laravel And Fractal

Hi all,

As you probably heard in casts, @JeffreyWay mentioned Fractal, a library for APIs. The implementation is not so hard, but I've tried to abstract more, so I've created a library called larasponse.

If you are interested in, please take a look and I'll be very pleased to hear some comments and reviews :)

08 Sep
5 years ago

salebab left a reply on Command In Show/update Methods

@Kemito it's not bad, you must reference to the resource you want to change. So, if admin wants to change some data for an user, there must be a reference to the user. The only reason why is it bad is when an user changing data for himself.

@Devon Sending ID as parameter in POST to /route/:id or in the case of GET to use /route/:id?id=something is ugly, sorry :)

07 Sep
5 years ago

salebab left a reply on Command In Show/update Methods

Thanks @Devon

Sure, I'm using a decorator for authorization, that's fine :)

I'm not sure about using Route in handlers, mixing routes with business logic is not option for me, and discovering id in handler is too late, I need it in decorators.

Also, I don't like idea about merging inputs, but it seems there is no better way...

salebab started a new conversation Command In Show/update Methods

It's clear how to use a command with controller store method, but what is approach and how to use command with show and update methods? Now, there is $id parameter that needs to be reached in the handler?

Do you merge Input:all() and $id, and then pass to execute as second argument, or maybe find model by id and merge it with input and pass to execute?

Is there any other approach?

Thanks.

03 Sep
5 years ago

salebab left a reply on Command Bus Stuff In Laravel 4.3

Note that controller methods are command (request) handlers now, and there is a method injection also, so probably you don't need a separate class to execute a command.

But if you want to, you can just simple call new ScheduleTaskHandler($task), right? Or better, to use IoC.

Maybe it's just me, but I tried to use you commander and now I have a lot of commands, handlers and decorators, and it is to hard to follow the code. For example, in PhpStorm, I can not jump (cmd+click) to the handler, I must read a command name and then to cmd+o and type the name (or copy) plus to type 'Handler' at the end. So, for now, I think it's not the best way :(

01 Sep
5 years ago

salebab left a reply on Laravel 4.3 Form Request Validation

The goal with Request is to validate the request itself, not the model. If you want to keep rules with the model, you can use static $rules, and then return MySuperModel::$rules.

26 Aug
5 years ago

salebab started a new conversation Commander And Decorators Good Practice

Currently I'm playing with Commander library and maybe I'm wrong, but I want to build multiple decorators for some checks, for example, I have to have decorator that need to check if model exists, and next decorator should use the same model to check if user has permissions to manage it, probably before that I will use a decorator that validates command and so on. Finally I might want to use that model in the handler.

So, is there any good approach to reuse the same model? Is it a good practice to cache it inside Command class or maybe in Repository? Any thoughts?

salebab left a reply on Music While Coding

This one is also good - https://www.coffitivity.com/ :)