Gadeoli

Gadeoli

Member Since 1 Year Ago

Experience Points 150
Experience Level 1

4,850 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.

17 Jun
20 hours ago

Gadeoli left a reply on ModelResource Could Not Be Converted To String

@nakov,

I usually use: return response()->json([], status) on my api. For me is not a big problem chain the response for resource. Could not be the right way, but works on my case.

I dont think is a problem with the resource classes because i generate them with artisan commands and on i just return a array like the docs says.

I thankful for your attention.

Gadeoli left a reply on ModelResource Could Not Be Converted To String

@nakov

I also return a lot of my functions with: return response()->json() on my api, so its not a big problem use: return (new resourceCollection(Model::query()))->response();

//this cause the error (on dd function all class is returned not only the resource data from toArray function) return new AdminResourceCollection(Admin::paginate(20))

//this works for me return (new AdminResourceCollection(Admin::paginate(20))) ->additional(['message' => 'testing']) ->response();

I used the artisan command to create the resource. I think is not a problem with the resource class, because i just return an array like the docs.

this is the resource classes:

[RESOURCE] namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class AdminResource extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array */ public function toArray($request) { return [ 'id' => $this->id, 'name'=> $this->name, 'links'=> [ 'edit'=> '...', 'delete'=> '...' ] ]; } }

[RESOURCE COLLECTION] namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\ResourceCollection;

class AdminResourceCollection extends ResourceCollection { /** * Transform the resource collection into an array. * * @param \Illuminate\Http\Request $request * @return array */ public function toArray($request) { return parent::toArray($request); } }

Gadeoli left a reply on ModelResource Could Not Be Converted To String

@nakov.

thats my code now (i just testing the resource feature to use in a api with jwt).

I dont know how to post code here to 'see' like code so for now i'll use ctrl+c / ctrl+v

AdminResource

Gadeoli left a reply on ModelResource Could Not Be Converted To String

Yes, i fallowed the docs (Get frustated because that). But i don't ready everything, thats my mistake.

My app espects a application/json but when i return a new Resource class i had the converted error.

I just had to use the Resource Responses

the code looks like:

return (new AdminResource(Admin::find(1)))->response();

https://laravel.com/docs/5.8/eloquent-resources#resource-responses

Gadeoli started a new conversation ModelResource Could Not Be Converted To String

Hi,

I'm try to using the resource feature in my API. But always get this error. If i cast to array the return works fine, but i think is not the right way.

Any help?

[Laravel] 5.8

[API] jwt 1.0.*

[Resource] public function toArray($request) { return [ 'id' => $this->id, 'name'=> $this->name, 'email'=>$this->email, 'email_verified_at'->$this->email_verified_at, 'username'=>$this->username, 'password'=>$this->password, 'created_at'=>$this->created_at, 'updated_at'=>$this->updated_at ]; }

[Controller] public function index() { //cast works //return (array)(new AdminResource(Admin::find(1)));

//I expected the toArray function from the resource class, 
//but return a object class and throw could not be converted to string
    return new AdminResource(Admin::find(1));
}

Gadeoli left a reply on Suggestion - Plan Package

I already saw it.

But i think is to much for the project, i dont need payments/billing for now.

I just wanted something to control/features, like disk space, number of register. I saw some packeges that do that, but seems like not mantened anymore.

I'll try to create something simple for the project.

12 Jun
5 days ago

Gadeoli started a new conversation Suggestion - Plan Package

Hi

I want to control plans/features within a system (like disk space), without payments gateways for now. There is something to start with that I didnt need to build the wheel again?

I founded this packege: gerardojbaez / laraplans to control user plan. But seems like not mantened anymore. last commit (sep 2018).

29 May
2 weeks ago

Gadeoli left a reply on Guide For FrontEnd Multitenant Application?

Tks for the reply. I'll study the case and look for the best option.

Gadeoli started a new conversation Guide For FrontEnd Multitenant Application?

Hello,

Some days ago i take a propose to do some kind a SaaS web application, with dedicated-database-clients. That webapp will need do support a mobile app in the future. I sad that i could try.

In this cenario i builded a api using tymon/jwt for auth and the hyn/tenant for multitenancy. I already did routes for authentication and tenant control. They're working on postman.

But now i kind lost myself on how do to the frontEnd capable to access the api.

Someone has some tip with vuejs or reactjs that can help with?