mabdullahsari

Member Since 1 Year Ago

Experience Points
46,530
Total
Experience

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
78
Lessons
Completed
Best Reply Awards
62
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 10
46,530 XP
Mar
05
1 month ago
Activity icon

Replied to Can I Simply Write To Laravel.log In My Script?

Yeah, you can do Log::debug() which will write to your log file. However, there are better options:

Mar
03
1 month ago
Activity icon

Replied to Composer Remove

Another package is relying on that dependency most likely then. Remove all dependencies that depend on that package if you really want to get rid of it.

Run this command to get more information:

composer why {package} {version}
Mar
01
1 month ago
Activity icon

Replied to Strips Out Password Field

Without showing us any code, nobody can help you. Why would Eloquent remove fields from the result set unless you ask it to do so..?

Feb
27
1 month ago
Activity icon

Awarded Best Reply on Are Singleton Bindings In The Service Container Persisted Between Jobs In The Queue?

Yes, you are correct. If the static field is null initially, you should make sure it is null again after the job has run.

This is why job idempotence is very important. Static properties are bound to cause headaches in long-running processes. Mohamed Said's book "Laravel Queues in Action" touches on this topic very nicely.

Activity icon

Replied to Are Singleton Bindings In The Service Container Persisted Between Jobs In The Queue?

Yes, you are correct. If the static field is null initially, you should make sure it is null again after the job has run.

This is why job idempotence is very important. Static properties are bound to cause headaches in long-running processes. Mohamed Said's book "Laravel Queues in Action" touches on this topic very nicely.

Activity icon

Replied to Are Singleton Bindings In The Service Container Persisted Between Jobs In The Queue?

Application instances are not shared between workers. Each worker has its own app instance. If a singleton binding is resolved in a worker, and that same worker needs access to that same binding later on, then the old binding will be re-used. The answer to your question in the title is "yes".

Reset your application to its initial state and you should be fine. That means, resetting those static properties after the job has either failed or succeeded.

Activity icon

Replied to How To Select Only Specific Attributes With Nested Eager Loading

Order::with(['orderFoodItems:id,order_id,image,name', 'orderFoodItems.price:food_item_id,original_price']);

I don't know how your FKs are called, but they must be included in the selections.

Feb
26
1 month ago
Activity icon

Replied to What's Your Take On This Pkg Development Issue?

For those who might stumble upon this post:

For more details: https://github.com/dive-be/laravel-feature-flags/tree/8856bee84a25978ceea6ba012d05202f31b63121

I created a config where you can change the model being used. The package already provides a translatable counterpart, but it is up to you if you want to use it.

return [
    'feature_model' => Dive\FeatureFlags\Models\Feature::class,
];

Added a suggest in composer.json

"suggest": {
    "spatie/laravel-translatable": "Required for defining messages for multiple locales"
},

Bind the correct "concrete" implementation of the model (defined a Feature contract which both the normal and translatable one implement)

$this->app->singleton(Feature::class, static function (Application $app) {
    return new ($app->make('config')->get('feature-flags.feature_model'))();
});
Activity icon

Replied to Some Stuff For Local Residents

Cool stuff.

Welcome.

Feb
24
1 month ago
Activity icon

Awarded Best Reply on Api.php And Web.php In A Single Project

Yes, it is.

Feb
22
1 month ago
Activity icon

Replied to Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' Not Found

Laravel won't support Flysystem v2 in version 8. You must explicitly require version 1.

Activity icon

Replied to "datatables" Slowness Problem

KardeลŸ, you are literally fetching all of the records in your database which is not a wise thing to do. You should be paginating those results server-side as well using the built-in LengthAwarePaginator.

https://laravel.com/docs/8.x/pagination

If you REALLY need to send the complete table in one go (which I highly doubt), then use the QueryBuilder directly instead of going through Eloquent because the hydration of those models is going to waste a lot of CPU cycles which is probably one of the main causes of your issue. Either way, before doing that, consider paginating your result set.

Activity icon

Awarded Best Reply on What's Your Take On This Pkg Development Issue?

@jlrdw That's right, but in this case I really felt like it'd be possible to not force it.

I think I've come up with a solution either way, just needed to get some sleep. As soon as I woke up, the light bulb appeared above my head ๐Ÿ˜‚

Marking as solved. Will post solution once implemented.

Activity icon

Replied to What's Your Take On This Pkg Development Issue?

@jlrdw That's right, but in this case I really felt like it'd be possible to not force it.

I think I've come up with a solution either way, just needed to get some sleep. As soon as I woke up, the light bulb appeared above my head ๐Ÿ˜‚

Marking as solved. Will post solution once implemented.

Feb
21
1 month ago
Activity icon

Started a new Conversation What's Your Take On This Pkg Development Issue?

So, I'm currently developing this package to enable/disable features thoughout an app.

(Please don't suggest other packages, I examined other alternatives and concluded that none of them fit my exact needs or were total overkill with too many features [pun intended]).

I ran into an interesting problem for which I don't really have a clear answer, so valuable suggestions are welcome:

Currently, the package includes spatie/laravel-translatable for the Feature model's message field. This way, if the app is served with multiple localizations, the multilocale aspect of it is automatically covered. However, what I also realized is the fact that not every app is using multiple locales (obviously). So, this package will force an additional dependency down your throat even if you don't want to use it. It will keep working without a hiccup, but you'll have to live with that unsolicited dependency.

Somehow, I'd like to make this opt-in, but at the same provide first-class support without making the consuming app adjust the published migration and extend the Eloquent model and manually use the trait. I kinda feel like there must be a proper solution to this, but then again I don't really know how you'd want to tackle such a thing (properly).

Activity icon

Replied to Change Php Versions Using Valet

This is a must-have if using Valet:

https://github.com/nicoverbruggen/phpmon

Makes switching PHP versions so easy.

Activity icon

Commented on Dedicated Query String Filtering

Pipelines are the best approach to this problem, imo.

Feb
20
1 month ago
Activity icon

Awarded Best Reply on Target Class [translator] Does Not Exist.

You are extending the wrong TestCase which doesn't do any application bootstrapping. Extend the one in your root "tests" folder, not PHPUnit.

Activity icon

Replied to Target Class [translator] Does Not Exist.

You are extending the wrong TestCase which doesn't do any application bootstrapping. Extend the one in your root "tests" folder, not PHPUnit.

Feb
19
1 month ago
Activity icon

Replied to Using 'Auth' For Multiple Models

You're reaching for the wrong tool here, tbh. What you need is Multi-Table Inheritance. You can read the README of this repo and if you have more questions, feel free to ask.

Activity icon

Replied to My Defined Facade Does Not Work

You don't get how facades work behind the scenes. Can you show your service's class signature?

Feb
18
1 month ago
Activity icon

Awarded Best Reply on Passing Conditional Classes To Anonymous Components

If you are on the latest Laravel version (or are able to upgrade):

<input {{ $attributes
    ->class(['default-classes', 'border-red-500' => $errors->has($attributes->get('name'))])
    ->merge(['disabled' => false])
}} />

Notice I also got rid of @props. disabled is a native HTML attribute, so no need to exclude it from the default bag.

(Didn't test, but should work like this)

Activity icon

Replied to List Ticket Types Foreach Logic Issue

Uhmm, where are you initializing the $ticketTypes public property? I think you are expecting too much magic from Livewire. Livewire can't just read your mind and know what exactly you'd like to do.

Activity icon

Replied to Some Help Here With An Array Conversion Thanks

You don't show how you're calling that method in your code. Cannot help until you provide more info.

Activity icon

Replied to Passing Conditional Classes To Anonymous Components

If you are on the latest Laravel version (or are able to upgrade):

<input {{ $attributes
    ->class(['default-classes', 'border-red-500' => $errors->has($attributes->get('name'))])
    ->merge(['disabled' => false])
}} />

Notice I also got rid of @props. disabled is a native HTML attribute, so no need to exclude it from the default bag.

(Didn't test, but should work like this)

Activity icon

Replied to My Redis Queues Gets Slower Over Time. I Have To Restart Services To Speed It Up, Why?

@hillcow There is a high probability of a memory leak somewhere in your jobs. You can restart the workers every x hours to temporarily mitigate the issue until you've ironed it out.

Activity icon

Awarded Best Reply on Model Factory In Custom Dir

You must override newFactory in your model as Laravel cannot correctly guess the factory's namespace.

https://github.com/laravel/framework/blob/8.x/src/Illuminate/Database/Eloquent/Factories/HasFactory.php#L27

Activity icon

Replied to Model Factory In Custom Dir

You must override newFactory in your model as Laravel cannot correctly guess the factory's namespace.

https://github.com/laravel/framework/blob/8.x/src/Illuminate/Database/Eloquent/Factories/HasFactory.php#L27

Activity icon

Replied to Laravel 7 Php Artisan Optimize Is Not Working

Did you even read the error? It tells exactly what's wrong.

Activity icon

Replied to Problem With Slug Translate

How is it not working with translations? Spatie's Sluggable package has first-class support voor translatable slugs when combined with their laravel-translatable package:

https://github.com/spatie/laravel-sluggable/blob/master/src/HasTranslatableSlug.php

What you are doing here is nothing but hacking.

Activity icon

Replied to Multi Language Validation

This is a solid package to handle multiple locales within your application:

https://github.com/codezero-be/laravel-localized-routes

Feb
17
1 month ago
Activity icon

Replied to Change Position Of Items In Collection

In that case I'd just use reverse.

Activity icon

Replied to Is There A Complete Laravel And Dropzone Js Tutorial?

Then I do not know of any other, sorry. You could try Spatie's Media Library Pro.

Activity icon

Replied to CSRF Token Mismatch On Server

Doesn't matter in that case. I'd still prepend a period personally.

Activity icon

Replied to CSRF Token Mismatch On Server

That explains the 419 errors. Set it up and you should be good to go.

If your URL is let's say app.imaginary.com, then the session domain should be .imaginary.com.

Activity icon

Replied to Get All Products That Belong To A Vendor

I'd recommend this package from staudenmeir for such deep relationships: https://github.com/staudenmeir/eloquent-has-many-deep

Activity icon

Replied to CSRF Token Mismatch On Server

Make sure SESSION_DOMAIN is properly set up in your .env

Feb
16
1 month ago
Activity icon

Awarded Best Reply on Livewire Not Updating Database As Expected

Are those values available in the fillable property of your User model?

Activity icon

Replied to How To Use Multiple Arrow When Calling A Class Methods

Your current class design will not allow that no. The phrase you are looking for is "Fluent API" BTW.

I don't really know what your intentions are with this class, but judging by its cover the static properties can probably become instance properties. Then, setParams can function as a named constructor allowing the call chaining you'd like to carry out.

Activity icon

Replied to Laravel Get Id Before Store

Have you tried my suggestion? Yours is going to blow up 100%. insert by itself returns a bool.

What you want in that case is this:

$post = Post::create([ 
    'title'=> $title,
    'category'=> $category,
]);

Photo::create([ 
    'post_id'=> $post->getKey(),
    'photo'=> $photo,
]);
Activity icon

Replied to Laravel With Liveware Or Vuejs Or Reactjs

There is no definitive answer.

  • If you want something as "back-end-developer-friendly" as possible while having interactive user interfaces, then go for Livewire.
  • If you need all of the bells and whistles you receive from your typical SPA application, then go for Inertia + JS framework of choice.
  • If you need an SPA, but there is also a mobile application backing it up, then your only choice is an API + completely separate SPA with its own client-side routing.
Activity icon

Replied to Laravel Get Id Before Store

$post = Post::insertGetId([ 
    'title'=> $title,
    'category'=> $category,
]);

Photo::insert([ 
    'post_id'=> $post,
    'photo'=> $photo,
]);
Activity icon

Replied to Livewire Not Updating Database As Expected

Are those values available in the fillable property of your User model?

Activity icon

Replied to Larastan / ORM

Calling query yourself first does not make it more complex. Under the hood, when you directly call where, newQuery is called anyways so I don't see a problem there.

If it really bothers you however, you can ignore it https://phpstan.org/user-guide/ignoring-errors#ignoring-in-configuration-file

Activity icon

Replied to Larastan / ORM

Flight::where has to go through 2 or 3 magic methods before actually calling where on the QueryBuilder. That's why it has a hard time in that case. We can help Larastan by explicitly instantiating a new QueryBuilder instance.

Flight::query()->where('active', true); // ::query() tells we have a QueryBuilder at our disposal