N3OGeorgy

Project Manager at Mediapost HitMail

Member Since 3 Years Ago

Bucharest

Experience Points
19,410
Total
Experience

590 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
183
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 4
19,410 XP
Nov
27
1 month ago
Activity icon

Replied to Add To New Collection From Each Loop

With the ->flatten(1); i get something like :

[
  {
    "x": 74
  },
  {
    "y": 172
  },
  {
    "x": 10
  },
  {
    "y": 49
  }
]

And with ->flatMap i get something like :

{
  "2020-11-25": {
    "y": 172
  },
  "2020-11-26": {
    "y": 49
  }
}

( only the last values from each date ).

Activity icon

Started a new Conversation Add To New Collection From Each Loop

I have the following piece of code :

    $callReport = array();
    $callResult->each(function ($item) use (&$callReport) {
         $callReport[$item->date][$item->callStatus] = $item->count;
    });

The $callReport result is :

{
  "2020-11-25": {
    "x": 74,
    "y": 172,
  },
  "2020-11-26": {
    "x": 10,
    "y": 49,
  }
}

But when i try with the collect methods :

        $callReport = collect();
        $callResult->each(function ($item) use (&$callReport ) {
            $callReport->push($item->date, collect([$item->callStatus => $item->count]));
        });

I can't reach the same result :

[
  "2020-11-25",
  {
    "x": 74
  },
  "2020-11-25",
  {
    "y": 172
  },
  "2020-11-26",
  {
    "x": 10
  },
  "2020-11-26",
  {
    "y": 49
  }
]

How i can get the same result as the first one with the array using the collect methods?

Sep
30
3 months ago
Activity icon

Started a new Conversation Same API Top Level Meta In JsonResource Single & Collection

Hello,

I have the following controller :


    public function index()
    {
        $products = Product::where('idp', '=', '1958213')->get();
        return ClientProductResource::collection($products)->additional(['something' => [
            'key' => 'value',
        ]]);
    }

    public function show(Product $product)
    {
        return new ClientProductResource($product);
    }

And the following Resource :

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ClientProductResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'idp' => $this->idp,
            'description' => $this->description
        ];
    }

    public function with($request)
    {
        return [
            'something' => [
                'key' => 'value',
            ],
        ];
    }
}

The issue is that i need to put the "something" twice to get it in the json response, once for index method in additional, and once for "show" in public function with method.

If i remove public function with method, i can't see it in public function show response. If i remove it from ->additional([]) , i can't see it in public function index response.

How or where i can put the "something" only once, so i can see it in both controller methods?

Thank you

Aug
17
4 months ago
Activity icon

Replied to Controller Constructors And The Artisan Route:list Command

Hello,

I have the same issue, when running php artisan route:list

I have one Controller with this constructor:

    public function __construct(Request $request)
    {
        $this->middleware('connectorGroup');
        $this->authGroup = AuthGroups::findOrFail($request->route('authGroup'));
        $this->authCategory = $this->authGroup->category;
    }

Even if i check in the middleware connectorGroup :

    public function handle($request, Closure $next)
    {
        if($request->route('authGroup')){
            return $next($request);
        }
    }

I get this error :

Illuminate\Database\Eloquent\ModelNotFoundException 
No query results for model [App\AuthGroups].

If i change only to find method, the next row fails :

ErrorException 
Trying to get property 'category' of non-object

The real question is, there is a nice workaround to fix this issue?

Aug
13
5 months ago
Activity icon

Started a new Conversation Handle/Render Response In Custom Exceptions

Hello,

I make a new exception : php artisan make:exception GuzzleGeneralException

I have a simple Guzzle Request :

try {
    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle123456');
} catch (RequestException $ex) {
    throw new GuzzleGeneralException($ex);
} catch (ConnectException $ex) {
    throw new GuzzleGeneralException($ex);
}

How i can do something like extending the Handler with my GuzzleGeneralException, passing the exceptions to it and write inside all the logic that usually you write in Handler ?

Something like this :

class GuzzleGeneralException extends Exception
{
	public function render(Throwable $exception)
	{
		if ($exception instanceof RequestException) {
			return response()->json();
		}else if ($exception instanceof ConnectException) {
			return response()->json(
		}
	}
}