pramanadiputra

pramanadiputra

Member Since 1 Year Ago

Badung, Bali

Experience Points 1,210
Experience Level 1

3,790 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.

27 Apr
1 month ago

pramanadiputra started a new conversation Laravel Custom Error Pages

I want to create a custom 404 error pages that's not only showing error status, but also showing suggestion of what they might try to access.

Let say they are visiting URL: web.com/job/data-science-v2851jh, but there's no job found based on that slug. By default Laravel only showing error status code and message. What I'm trying to do is to give them a suggestion of jobs when they meet 404 error page.

Suggestion anyone?

Thank You

pramanadiputra left a reply on Querying Relations ( 1 To M , M To N)

Use hasManyThrough if

Job hasMany Sub_Jobs

Sub_Job hasMany Dispatches

To see how many Dispatches that the Job has, use hasManyThrough. So it's Job has many Dispatches through Sub_Job.

But I don't really understand what do you mean by saying "Sub_Job and Dispatch has a M to N relationship", do you mean it's polymorphic?

26 Apr
1 month ago

pramanadiputra left a reply on How Do You Do It? Share Your Preferences

@JLRDW - Hold on, I'm not a beginner. I'm just asking Laravel Developer preferences based on this scenario. The title already explained "Share your preferences" Thanks.

pramanadiputra started a new conversation How Do You Do It? Share Your Preferences

Vacancy has many Applicants, and Applicant belong to Vacancy.

Now you want to list all the applicants that applied to a vacancy, how you might do it?

You create method indexOfApplicants() in your Vacancy model to list all the applicants, or you create method let say ownedByVacancy() in your Applicant model to do so?

Please share your preferences, and why?

20 Apr
1 month ago

pramanadiputra left a reply on How To Structure Folders ?

@RANX99 - If that so, I think you should use the default project structure. As there some category that will be used by either Admin, User, and Front.

At the moment, I don't have any suggestion.

pramanadiputra left a reply on How To Structure Folders ?

@ranx99

This is how I structured my folder, it's a DDD style (just the folder structure). I'm not using Data Mapper such as Laravel Doctrine, and still utilizing the best of Eloquent ORM.

  • App
  • App\Admin
  • App\User
  • App\Vacancy
  • App\Profession

and so on.

On each App{entity} e.g

  • App\Vacancy -- Events -- Listeners -- Jobs -- Notifications -- Policies -- Http --- Controllers --- Requests --- Services -- Vacancy.php (model)

Currently the Views are still in resources/views/* but I will move them soon to its entity directory, leave resources folder for web assets like js, css, and static images.

pramanadiputra left a reply on Where Are You All From?

I'm Balinese and currently live in Bali, Indonesia. Would like to move to Germany someday :)

19 Apr
2 months ago

pramanadiputra started a new conversation Any Recommendation For Text Editor With Image Uploads?

Hi, do you have any recommendation for text editor with image upload feature that supports Amazon S3 / DigitalOcean Space?

When user upload an image, it directly saves to the server, and so does when user delete the image, it delete the image from the server.

I've looked for CKEditor and TinyMCE but still have no idea whether they support this feature (for free). I'm also looking for Lightweight text editor such as Trumbowyg, they have Image Upload plugin which save uploaded image to Imgur. I wonder if there's similar Trumbowyg Image Upload that stores image to S3/DO Space.

Thank You

16 Apr
2 months ago

pramanadiputra left a reply on 8, 9, To 12 Queries Per Index Page, Is It Acceptable?

@SHEZ1983 - I have already, I reduce by eliminating unused relationship such as user on vacancy.

pramanadiputra left a reply on 8, 9, To 12 Queries Per Index Page, Is It Acceptable?

@ERIKVERBEEK - Thank you, but I haven't found to get only specified attributes with paginate()

08 Apr
2 months ago

pramanadiputra started a new conversation 8, 9, To 12 Queries Per Index Page, Is It Acceptable?

I'm building a classified web app, and its index has 8, 9, even 10 queries per page. I'm using Laravel DebugBar and there's no duplicate query, all queries are unique.

I'm wondering if it's acceptable? or does it too much?

I have 4 index pages, index, indexOfArea, and indexOfCategory, and indexOfAreaAndCategory.

index | 5 queries https://imgur.com/hnCp3F5

indexOfArea | 8 queries https://imgur.com/0Qn3ajz

indexOfCategory | 8 queries https://imgur.com/DKM5shz

indexOfAreaAndCategory | 12 queries https://imgur.com/sJtOBX1

I'm not worry about the index, but the other three

05 Apr
2 months ago

pramanadiputra started a new conversation Send Email With Event/Listener, Or Job?

I want to send an email to unregistered user that has submitted a post, notify them about their post. Which one should I use to send the email?

When to use Event/Listener or Job for this matter?

Thank You

08 Dec
6 months ago

pramanadiputra left a reply on Help About Laravel Route

@GLOBALS - I had this in my mind too, but this approach seems is not cleaner or there's always a check when a route goes to {areaOrCategory}.

However, Now I'm using the following approach:

Route::get('{area}', '[email protected]')->name('complaint.indexByArea');
Route::get('?{category}', '[email protected]')->name('complaint.indexByCategory');
Route::get('{area}/{category}', '[email protected]')->name('complaint.indexByAll');

Note that I'm putting ? for the {category} it's work fine and it's also clean.

Thank You

pramanadiputra left a reply on Laravel Error

@HASEN39 - Anyway you could pass the csrf token by put @csrf between the ... tag

pramanadiputra left a reply on Help About Laravel Route

Thank You @globals @realrandyallen and @markotitel.

I have tried all your solution before asking, I thought there will be away to do what I was intend. And that is

example.com/moscow // showing any thing in moscow
example.com/food // showing any food
example.com/moscow/food // showing any food in moscow 

I guess, I'll define like what you all have shown as the examples. Thank You. But if any of you knows how to achieve what I was intend, help me :)

pramanadiputra started a new conversation Help About Laravel Route

Good Evening,

I need some help about Laravel Route Implicit Model Binding.

on web.php, I declare routes for {area} and {category}.

Route::get('{area}', '[email protected]')->name('complaint.indexByArea');
Route::get('{category}', '[email protected]')->name('complaint.indexByCategory');
Route::get('{area}/{category}', '[email protected]')->name('complaint.indexByAll');

I want to make Index for complaint by Area, Category, or both.

But now the routes that works just {area} and {area}/{category}

the route fail for {category}.

of course, if we switch up the {area} and {category} (put the {category} above the {area}, and the {category} will works, the {area} route will fail.

How do we overcome this situation? Thanks.

10 Oct
8 months ago

pramanadiputra started a new conversation Laravel Omnipay/Payum Detailed Tutorial

Has anyone here have Laravel Omnipay/Payum tutorial in detail with the case of supporting Payment with PayPal, Stripe and other Payment Services?

I've searched it, but only found Laravel with PayPal only (Omnipay), and the tutorial also not so in depth

I don't know how to use Omnipay/Payum with Payment Services such as PayPal/Stripe or any other

And if you ever used Omnipay and Payum, which one that you prefer ?

Thank You

pramanadiputra started a new conversation Eloquent Route To Slug That Match The ID

I have this kind of problem.

In one table of categories I have 2 similar categories

which are Electronics by Market and Electronics by LostFound

Market (ID 1)

  • Electronics -> slug: electronics

LostFound (ID 2)

  • Electronics -> slug:electronics

In one condition if I would like to access Electronics by LostFound, how can I access it through Route? We know that getRouteKeyName 'slug' will only get the first slug of "electronics", which is in this case by Market

I know the Where clause can be used, but is there more proper way of doing so?

Thanks

27 Sep
8 months ago

pramanadiputra started a new conversation Laravel Markdown Support Like Laracast

I'm wondering how can I achieve Markdown Support like Laracast does.

When we type with triple `, it will turns into code blocks with dark style and code highlight colors.

Such as

public function TestCode()
{
    echo 'hi';
}
25 Sep
8 months ago

pramanadiputra left a reply on Bugs On Has()

@Snapey

Yeah sorry too, I took it personal so seriously, the way you stated sounds underestimate somehow.

But it also true that I haven't read Laravel Collection docs, and just had in mind that has() is the only function to do what I was intended.

Anyway, Thank You

24 Sep
8 months ago

pramanadiputra left a reply on Uploading Images Scenario

@Digitalized

I mean that most people go with that scenario (using polymorphic relationship) in this case.

And I think polymorphic will be suitable for this case too, as I will have model for listing, post, etc.

Thank You ! I will think about Scenario 1 or Scenario 3 (Polymorphism)

pramanadiputra left a reply on Uploading Images Scenario

@Digitalized

Yes I understand Polymorphic Relationship, I know how to implement it, but is it that being used mostly?

1 Images table and it's being polymorphic, used by Posts, Comments, and another type/model?

pramanadiputra left a reply on Bugs On Has()

@Nash

Thank you for your clear explanation, I didn't think about array and it index starts at 0 even though I knew it. Thank you

@Snapey Thank you, I'll try it

@shez1983 I think I've already provide useful information by explaining in the way I could, but if Snapey and you didn't find it with useful info, I'll try better next time I ask a question, with another form of sentence or another way of explaining it.

Thank You all, and Sorry.

pramanadiputra left a reply on Bugs On Has()

Thats alright. A Question doesn't need to provide useful information, but Answer does, and your answer containing no useful information.

pramanadiputra left a reply on Bugs On Has()

@Nash

Yes, But in this case Lesson ID is becoming the key whether it exists in a collection (course->lectures). And I use it to check if a certain ID exists.

pramanadiputra left a reply on Bugs On Has()

@Snapey

Wow what a reply, Thank You! If Laracasts has downvote system I'd already downvoted you.

@nikos

Yes, but by using this script is pretty convenient.

$course->lessons->has($lesson->id)

Thank You for pointing out Policies

pramanadiputra started a new conversation Bugs On Has()

I think there's a bug on has()

I have these following rows.

LESSONS TABLE | ID | TITLE | .... | ..... |

(Belong to Course A)

  1. Setup Localhost
  2. Download WordPress
  3. Install WordPress
  4. WordPress Structure Directory
  5. WordPress Plugin
  6. WordPress Theme

(Belong to Course B)

  1. Setup RoR
  2. ........
  3. ........

When I'm running the following script

dd($course->lessons->has($lesson->id));

In the following URL: app.tld/course-a/lecture/{id}

When I'm accessing ID from 1 to 5, it says TRUE, however when I'm accessing ID 6, it says FALSE. It suppose to says TRUE because ID 6 is belong to Course A, but it doesn't.

Thoughts everyone?

23 Sep
8 months ago

pramanadiputra started a new conversation Uploading Images Scenario

Hi, I have a question.

Suppose I have a site such as Craiglist, where User can post an Ad, let say about Hotel? When user post their Hotel, on the Hotel detail page there are images listed in slideshow, images number could be variant, depends on how many images being uploaded by the User. what is the scenario for saving user uploaded images in this case?

Scenario 1. We have Posts table, and Post_Images table. For any uploaded images, we stored them on Post_Images table, so the Posts table hasMany() Post_Images table. When we want to display the images on the slideshow just call Post->postimages.

Scenario 2. We only have Posts table, but inside this table we defined n colums for images, let say 5. So we have column image1, image2, image3, image4, and so on. But with this scenario 2, the amount of images can be uploaded is already defined.

Scenario 3. Maybe you have Scenario 3?

Thank You

pramanadiputra left a reply on Validation And Route Model Binding More Than 2

That's what I mean, it can be accomplished by 1 line of code.

 abort_if(! $course->lessons->has($lesson->id), 404);

It Works! Thank You!

pramanadiputra left a reply on Validation And Route Model Binding More Than 2

Hi, I mean despite of the User is enrolled to that course or not, but They are accessing Lecture ID belonged to Course B while they are in Course A. This is what I mean. Thank You

pramanadiputra started a new conversation Validation And Route Model Binding More Than 2

Hi, I have a question.

As an example:

I have lectures ID [70, 74, 80] that belonged to Course A, and lectures ID [44, 48, 52] that belonged to Course B.

Right now when User/Student accessing the lectures are through URL: app.tld/course/{course-slug}/lecture/{lecture-id}.

But right now, there's no validation. User/Student that enrolled in Course A still can access lectures ID that belonged to Course B such as : app.tld/course/course-a/lecture/44. I want by all means, that this is restricted.

I could write validation inside controller, to check if the accessed ID is belong to current Course, but is there any more convenient way to do this?

Thank You

14 Sep
9 months ago

pramanadiputra started a new conversation Laravel Blade Equivalent To Twig->LoadTemplate

Hi, does anyone here ever migrate previous project from Twig to Blade?

I have current project with previous version built with Twig, it's not based on Symfony or a framework. And now I'm building this project with new code with Laravel.

In the previous version, I have someone else helped me to built up a feature, which in one of a controller there's Twig->LoadTemplate, I'm wondering what's this function is equivalent with Laravel Blade, is there any?

Thank You

13 May
1 year ago

pramanadiputra left a reply on Getting The URL After Domain In Laravel

@Snapey , I tested it on my Laravel it's not having a problem or it's working fine, or perhaps that it's illegal or will be treathen bad by the Search Engine / SEO ??

pramanadiputra started a new conversation Nginx Configuration In Laragon To Support Subdomain

Hi,

I'm developing my Laravel in my localhost using Laragon, is there anyone who uses this one too for their localhost environment ?

I was trying to build a subdomain in my Laravel Route, but subdomain.myapp.tld just doesn't work.

Anyone knows how to configure it? Apache Conf or Nginx Conf is fine, I can use both Server in my Laragon.

Thank You

08 May
1 year ago

pramanadiputra left a reply on Getting The URL After Domain In Laravel

Hi, thank you both

what if then the url is provinsi:gorontalo/market:pc and I still just want to get the provinsi:gorontalo. Does Laravel provide a nice way to do this ?

Thank You.

pramanadiputra started a new conversation Getting The URL After Domain In Laravel

Halo,

Suppose I am in : domain.tld/provinsi:gorontalo/

I want to put it on my navigation, how do I get the url provinsi:gorontalo only and echoing it out to my navigation.

Thank You

30 Apr
1 year ago

pramanadiputra left a reply on Get Area Type & Slug For Routes

Hi thanks for replying,

Can you give me an example or more detail about the Area model has a type and a slug field setup

Thank You Very Much

29 Apr
1 year ago

pramanadiputra started a new conversation Get Area Type & Slug For Routes

Hi, I'm Pram from Bali

I have this following case.

Sometimes a Province or a Regency has the same name with its sub area such as Regency: "Pangandaran", Village: "Pangandaran".

Now I want to make a route that supports /{area:type}/{area:slug}, e.g: /kab/pangandaran if the user is accessing the Pangandaran Regency, but if they are accessing Pangandaran Village, then they will access /kec/pangandaran.

How can I achieve this?

Note that, The Provinces, The Regencies, and The Villages are all under the same table: Areas

As I'm using Nestedset, so I don't have to do Provinces hasMany Regencies and so on.

Thank You!