Azoraqua

Azoraqua

Member Since 1 Year Ago

Experience Points
8,160
Total
Experience

1,840 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
76
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.

Level 2
8,160 XP
Sep
16
2 days ago
Activity icon

Replied to Dynamic Views (Like Products/<slug>) Do Not Work.

@michaloravec Was it needed to be rude? Besides, what is considered 'professional' in your opinion? I might assume that if it works, it's good enough, could be improved but still the key is that it works and is somewhat maintainable.

With respect but calling someone an idiot without even explaining why isn't exactly "professional" either.

Activity icon

Replied to Dynamic Views (Like Products/<slug>) Do Not Work.

Got it working with a modification of @automica's first answer.

Activity icon

Replied to Dynamic Views (Like Products/<slug>) Do Not Work.

That does work, but I want the product to be found by 'slug' not 'id' although I want to keep the 'id' as internal index Any idea how to let it work with slugs?

Activity icon

Started a new Conversation Dynamic Views (Like Products/<slug>) Do Not Work.

Hello,

I want to have dynamic product pages (in the format of products/<slug>) that refer to their respective view in products folder.

I've attempted a bit but it doesn't seem to work as it causes a HTTP 404 Error, can someone explain why and perhaps provide a solution?

Routes:

Route::prefix('products')->group(function () {
    Route::get('/', '[email protected]')->name('products');
    Route::get('/{product}', '[email protected]')->where('product', '[a-zA-Z][a-zA-Z0-9]+')->name('products.view');
});

Controller:

public function show(string $slug) {
    if (!View::exists(`products.$slug`)) {
        return abort(404, `Product page '$slug' does not exist.`);
    }

    return view(`products.$slug`, [
        'product' => Product::where('slug', $slug)->firstOrFail()
    ]);
}

Folder structure: https://i.imgur.com/nnf06Pa.png

Sep
15
3 days ago
Activity icon

Replied to Form Request Cannot Be Sent Using POST.

Good news, I fixed it. Thanks everyone. It indeed had to do with the 'enctype' even though I have no idea why that is.

Activity icon

Replied to Form Request Cannot Be Sent Using POST.

@snapey php artisan route:clear I believe. No I didn't, but will do. Also noticed that route:cache causes an error in some of the Laravel's internal codebase.

===

The entire request is: https://i.imgur.com/82bzltB.png

The entire response is: https://i.imgur.com/NfalcNr.png

Activity icon

Replied to Form Request Cannot Be Sent Using POST.

All other (Admin) routes are:

Route::namespace('Admin')->prefix('admin')->group(function () {
    Route::get('/', '[email protected]')->name('admin.dashboard');

    Route::prefix('users')->group(function () {
        Route::get('/', '[email protected]')->name('admin.users');
        Route::post('/create', '[email protected]_user')->name('admin.users.create');
        Route::get('/{user}', '[email protected]_user')->where('user', '[0-9]+')->name('admin.users.view');
        Route::post('/{user}/edit', '[email protected]_user')->where('user', '[0-9]+')->name('admin.users.edit');
        Route::post('/{user}/delete', '[email protected]_user')->where('user', '[0-9]+')->name('admin.users.delete');
    });

    Route::prefix('products')->group(function () {
        Route::get('/', '[email protected]')->name('admin.products');
        Route::post('/create', '[email protected]_product')->name('admin.products.create');
        Route::get('/{product}', '[email protected]_product')->name('admin.products.view');
        Route::post('/{product}/edit', '[email protected]_product')->name('admin.products.edit');
        Route::post('/{product}/delete', '[email protected]_product')->name('admin.products.delete');
    });

    Route::prefix('licenses')->group(function () {
        Route::get('/', '[email protected]')->name('admin.licenses');
        Route::post('/create', '[email protected]_license')->name('admin.licenses.create');
        Route::get('/{license}', '[email protected]_license')->name('admin.licenses.view');
    });

    Route::prefix('tickets')->group(function () {
        Route::get('/', '[email protected]')->name('admin.tickets');
        Route::post('/create', '[email protected]_ticket')->name('admin.tickets.create');
        Route::get('/{ticket}', '[email protected]_ticket')->name('admin.tickets.view');
    });
});

User routes

Route::namespace('User')->prefix('user')->group(function () {
    Route::get('/', '[email protected]')->name('user.dashboard');
});

Support routes

Route::prefix('support')->group(function () {
    Route::get('/', '[email protected]')->name('support');
    Route::post('/email', '[email protected]')->name('support.email');
});

// Product routes

Route::prefix('products')->group(function () {
    Route::get('/', '[email protected]')->name('products');
    Route::get('/{id}', '[email protected]')->name('products.specific');
});

General routes

Auth::routes();
Route::get('/', '[email protected]')->name('home');
Activity icon

Replied to Form Request Cannot Be Sent Using POST.

@michaloravec May I ask what's the pro's & con's of using Resource controllers?

@manelgavalda That I wouldn't even think of! -- Edit: That doesn't seem to work at all & I even added regex that doesn't even catch 'create'.. Yet it still causes the same error.

Activity icon

Started a new Conversation Form Request Cannot Be Sent Using POST.

Cannot seem to send a form as post request.

Form in question:

<form class="form" action="{{ route('admin.users.create') }}" method="post" id="form_user_create">
    @csrf
    @method('POST')

    <div class="form-group">
        <label for="id">{{ __('ID') }}</label>
        <input id="id" name="id" type="number" class="form-control" required disabled/>
    </div>

    <div class="form-group">
        <label for="name">{{ __('Name') }}</label>
        <input id="name" name="name" type="text" class="form-control" required/>
    </div>

    <div class="form-group">
        <label for="email">{{ __('Email') }}</label>
        <input id="email" name="email" type="email" class="form-control" required/>
    </div>

    <div class="form-group">
        <label for="password">{{ __('Password') }}</label>
        <input type="password" id="password" name="password" class="form-control" required>
    </div>

    <div class="form-group">
        <label for="password">{{ __('Verify Password') }}</label>
        <input type="password" id="password" name="password" class="form-control" required>
    </div>

    <div class="form-group">
        <button class="btn btn-primary pull-right" type="submit">Create</button>
    </div>
</form>

The routes in question:

Route::prefix('users')->group(function () {
        Route::get('/', '[email protected]')->name('admin.users');
        Route::post('/create', '[email protected]_user')->name('admin.users.create');
        Route::post('/{user}/edit', '[email protected]_user')->name('admin.users.edit');
        Route::post('/{user}/delete', '[email protected]_user')->name('admin.users.delete');
        Route::get('/{user}', '[email protected]_user')->name('admin.users.view');
});

The error in question:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException:
The POST method is not supported for this route. Supported methods: GET, HEAD.

Can someone explain why this is? Perhaps the solution?