marcosdipaolo

marcosdipaolo

Member Since 1 Year Ago

Experience Points
15,680
Total
Experience

4,320 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
146
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 4
15,680 XP
Jan
18
5 days ago
Activity icon

Replied to FormRequest Not Generating Error Messages

@nakov you were right, everything came to normal after the session driver was set to file, thanks!

Activity icon

Replied to FormRequest Not Generating Error Messages

I rolled back the migrations, migrated again, seeded the database again (importing data from a wordpress database) and now the behavior changed, it's actually worst, the form request HANGS if anything is not passing the rules. This isn't the first time that happens.

This sort of random behaviour is confusing me plenty.

yess @snapey , all good dd'ing the prepareForValidation and rules methods. Anyway, at the moment since the behaviour changed i have to test further, i'll log back whenever i have (or not) any news.

@nakov goot to know, I'm running "laravel/framework": "^6.2", and it looks like it hasn't changed:

'driver' => env('SESSION_DRIVER', 'cookie'),
Activity icon

Replied to FormRequest Not Generating Error Messages

Hi @snapey Nop, middleware web is listed normally, this happens only with the update method, not with the store method.

Activity icon

Replied to FormRequest Not Generating Error Messages

from the docs:

use Illuminate\Support\Str;

/**
 * Prepare the data for validation.
 *
 * @return void
 */
protected function prepareForValidation()
{
    $this->merge([
        'slug' => Str::slug($this->slug),
    ]);
}

https://laravel.com/docs/6.x/validation#prepare-input-for-validation

Jan
17
6 days ago
Activity icon

Replied to FormRequest Not Generating Error Messages

An important note is that the create view it's the same for edition. When it "creates" a post, hits the store method which uses the parent request PostRequest and it all works perfectly, the $errors variable gets populated.

Activity icon

Replied to FormRequest Not Generating Error Messages

hi there @roborobok it looks like it, i just dd'ed it dd(session()->all()) and it showed me the usual.

Activity icon

Started a new Conversation FormRequest Not Generating Error Messages

When the validation fails i get nothing at the $errors variable, it used to work, but now it stopped and i have no idea why. I've tried several things, change the fields that are failing, dd'ing the request inside the different methods at the request, i've commented the different methods at the request and nothing. I'ver excluded the method from the middlewares I'm using (View compser miidlewares) and nothing. any idea what si going on?

An important note is that the create view it's the same for edition. When it "creates" a post, hits the store method which uses the parent request PostRequest and it all works perfectly, the $errors variable gets populated.

Some code. My posts route file:

<?php

Route::resource('posts', 'PostController');

RouteServiceProvider method where i clearly include the web middleware:

protected function mapPostsRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/posts.php'));
    }

Where i use my custom form request at my update method, PostController:


 /**
     * @param PostUpdateRequest $request
     * @param Post $post
     * @return Factory|RedirectResponse|View
     */
    public function update(PostUpdateRequest $request, Post $post)
    {
        try {
    // and so on 

My child PostUpdateRequest form request for updating purposes:

<?php

namespace App\Http\Requests;

use Illuminate\Validation\Rule;

class PostUpdateRequest extends PostRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return array_merge(
            parent::rules(), [
               'slug' => [
                   'required', 'string',
                   Rule::unique('posts', 'slug')->ignore($this->slug, 'slug')
               ],
        ]);
    }
}

Its father PostRequest

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;

class PostRequest extends FormRequest
{
    protected function prepareForValidation()
    {
        $this->merge([
            'slug' => Str::slug($this->title),
        ]);
    }

    /**
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|string',
            'content' => 'string|required|',
            'status' => 'required|string',
            'attachmentvalue' => 'string',
            'slug' => [
                'required',
                'string',
                'min:2',
                Rule::unique('posts', 'slug')
            ],
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return array_merge(
            parent::messages(),
            [
                'title.required' => __('El título es obligatorio'),
                'content.required' => __('El artículo debe poseer un contenido'),
                'slug.string' => __('Ya hay un artículo con ese título'),
                'attachmentvalue.string' => __('El artículo debe contener una imagen estacada'),
            ]
        );
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'title' => __('Título'),
            'content' => __('Contenido'),
            'attachmentvalue' => __('Adjunto')
        ];
    }
}
Nov
18
2 months ago
Activity icon

Replied to Laravel Project In A Docker Container, Cannot Access My Images - 403 Forbidden

@sinnbeck thanks a lot for your help, you pointed me in the solution's direction, the storage:link must be, of course, created logged into the docker container, i created it outside the it was redirecting to the outsider direction (/home/user/....., not /var/www/html/storage......

Activity icon

Replied to Laravel Project In A Docker Container, Cannot Access My Images - 403 Forbidden

[email protected]:/var/www/html/public# ls -l
lrwxrwxrwx 1 1000 1000       62 Nov 17 22:53 storage -> /home/marcos/Documents/dev/estudio-de-canto/storage/app/public
Activity icon

Replied to Laravel Project In A Docker Container, Cannot Access My Images - 403 Forbidden

[email protected]:/var/www/html/public# cd storage
bash: cd: storage: No such file or directory

are you sure you can access a directory through an hyperlink at the terminal?

Activity icon

Replied to Laravel Project In A Docker Container, Cannot Access My Images - 403 Forbidden

First of all I have this app running either in production as local in another computer without any problem whatsoever.

The tipical link looks like this: /storage/img/blog/my-image.png

I can't think of a route interfiering, since everything works ok in other systems.

Nov
17
2 months ago
Activity icon

Started a new Conversation Laravel Project In A Docker Container, Cannot Access My Images - 403 Forbidden

tried already setting the storage folder ownership to www-data and also my user, i tried chmod -R 7777 storage as well. I also tried setting to www-data the whole /var/www.

I don't know what to try anymore, I don't have this problem in another computer where I have the project. Just cloned this one from gitlab.

A brief extract of the browser's console

Image of Yaktocat

Sep
11
4 months ago
Activity icon

Commented on Make A Router

If you are dockerized create an .htaccess and code in it the following:

<IfModule mod_rewrite.c>

   RewriteEngine On

   RewriteCond %{REQUEST_FILENAME}  -f [OR]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php [L,QSA]

</IfModule>

don't forget to add the following to the Dockerfile:

RUN a2enmod rewrite
RUN service apache2 restart
Aug
22
5 months ago
Activity icon

Replied to File Not Found On Resource_path()

SOLVED I was using Storage instead of File, or just the native copy

Edit: Exactly @petrit !!!! thanks!

Activity icon

Started a new Conversation File Not Found On Resource_path()

The line resource_path('email-attachments/' . $filename) is throwing a "File not found" error when the file actually exists. I checked it with file_exists which returns true. I'm working with docker but the problem persist inside and outside the container. I'm working in an quite old app with Laravel 5.4.

file_exists(resource_path('email-attachments/' . $filename))
true
\Storage::copy(
    resource_path('email-attachments/' . $filename),
    storage_path('app/email-attachments/' . $filename)
);
In Filesystem.php line 388:
File not found at path: var/www/html/resources/email-attachments/filename.pdf

thanks in advance