mvnobrega

Member Since 1 Year Ago

Experience Points
4,870
Total
Experience

130 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 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 1
4,870 XP
Apr
26
3 weeks ago
Activity icon

Replied to How To Save Image To Folder In Public

it worked out. Thanks :))))

Activity icon

Replied to How To Save Image To Folder In Public

Thanks for the suggestion but the way I tried does not work, I get the following error:

Symfony\Component\HttpFoundation\File\Exception\FileException
Could not move the file "/tmp/phpolYMGb" to "storage/app/storage/en/2021/04/fdfdf.png" (move_uploaded_file(): Unable to move '/tmp/phpolYMGb' to 'storage/app/storage/en/2021/04/fdfdf.png').

My code:

	$file->storeAs('storage/'.$request->lang.'/'.$year.'/'.$month, $filename);
    	
    	$file->move('storage/app/storage/'.$request->lang.'/'.$year.'/'.$month .'/'. $filename, '../');

Activity icon

Replied to How To Save Image To Folder In Public

I forgot to mention that. My hosting is not VPS, so I can't run artisan inside the "Laravel" folder.

so I need to do this manually.

Activity icon

Started a new Conversation How To Save Image To Folder In Public

My website is organized as follows in the root folder:

  • public_html
  • laravel

Inside "public_html" I have the files in the laravel "public" folder. In the "laravel" folder, I have all the laravel files.

I need to save my images inside "public_html" in the "images" folder, but I can't get them to work.

My controller looks like this:

$file->storeAs('storage/'.$request->lang.'/'.$year.'/'.$month, $filename);

My filesystem:

'public' => [
            'driver' => 'local',
            'root' => public_path() . '/images',
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

But as you can imagine, it doesn't work, because the public is outside. I tried to put the full path of the server, but it also doesn't work.

Can anyone tell me how to do this?

Apr
10
1 month ago
Activity icon

Replied to Www Does Not Work At All Urls

Thanksss :)))

Apr
09
1 month ago
Activity icon

Started a new Conversation Www Does Not Work At All Urls

I need to ensure that all routes are https://www

https already works on all, but only the home page redirects to www

I've tried all kinds of code on the internet and it doesn't work.

The laravel public folder is inside public_html and the laravel files are inside the "laravel" folder at the same level as public_html.

So in the htaccess of public_html I have this:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

# Redirect to WWW
RewriteCond %{HTTP_HOST} !^www\.meempi\.com
RewriteRule (.*) http://www.meempi.com/ [L,R=301]

And "Laravel folder":

<IfModule mime_module> 
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml 
</IfModule>

# Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]  
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ /../public_html/public/ [L]



# php -- BEGIN cPanel-generated handler, do not edit
# Defina o pacote “ea-php73” como a linguagem padrão de programação “PHP”.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit


As I understand it, the following code should force www on all routes:

RewriteCond %{HTTP_HOST} !^www\.meempi\.com
RewriteRule (.*) http://www.meempi.com/ [L,R=301]

But it only works on the homepage, all other routes can be accessed as https://site.com

It already includes the same code in the .htaccess of the laravel folder, but it has no effect.

Can anyone help me solve this?

Mar
25
1 month ago
Activity icon

Replied to How To Block Access To Url With "public"

Thank you very much for the suggestions. I managed to solve. Hug :))

Activity icon

Replied to How To Block Access To Url With "public"

I am not that experienced friend. The files on my laravel website are inside "public_html"

and laravel's "public" folder is inside it. So should I move the "public" folder to be on the same level as the "public_html"?

Or should I put the "public" files inside "public_html". And what remains of the laravel files to be placed in another folder?

Activity icon

Started a new Conversation How To Block Access To Url With "public"

My website is accessible in both ways:

www.site.com/public/pt-br www.site.com/pt-br

But this is making google index my site and all pages in both ways.

I need to return error 404 for urls with "public" or redirect with 301 to the page without "public".

But all the information I find on the internet does not help me solve this. I really don't know how to get htaccess to solve this as I'm planning.

The htaccess of the laravel root looks like this:

<IfModule mime_module> 
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml 
</IfModule>

# Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]  
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ public/ [L]



# php -- BEGIN cPanel-generated handler, do not edit
# Defina o pacote “ea-php73” como a linguagem padrão de programação “PHP”.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit


and in the public folder like this:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

How do I solve this?

Mar
24
1 month ago
Activity icon

Replied to When I Add "/" Url Is Redirected To Public

I found this code that seems to work well:

# Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

However, I need urls indexed with "public" to return 404 error

Activity icon

Started a new Conversation When I Add "/" Url Is Redirected To Public

All url of my already hosted site redirect to public when I put a slashes for example:

so it works well: www.site.com/dreams/snake

but if I add "/" at the end: www.site.com/dreams/snake/

return it: www.site.com/public/dreams/snake

For some reason google is indexing many pages with "public". I need to solve this but I can't do it at all.

My htaccess looks like this:

<IfModule mime_module> 
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml 
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]  
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ public/ [L]



# php -- BEGIN cPanel-generated handler, do not edit
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit


Can someone help me ?

Feb
05
3 months ago
Activity icon

Replied to Laravel Trailing Slashes Redirect To Url With Public

You can't solve this with some code snippet in .htaccess file ?

Activity icon

Replied to Laravel Trailing Slashes Redirect To Url With Public

But what is this ? I did not understand. I don't understand much about

Activity icon

Started a new Conversation Laravel Trailing Slashes Redirect To Url With Public

When I access my website it works like this: www.meempi.com/pt-br

However, if I insert a slash at the end: www.meempi.com/pt-br/

It adds a "public" at the beginning of the URL, looking like this: www.meempi.com/public/pt-br

My .htaccess looks like this:

<IfModule mime_module> 
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml 
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]  
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ public/ [L]

# php -- BEGIN cPanel-generated handler, do not edit
# Defina o pacote “ea-php73” como a linguagem padrão de programação “PHP”.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit


Jan
08
4 months ago
Activity icon

Started a new Conversation How To Redirect Multi-language Site To Preferred Route

Let's assume that users arrive at my site through organic search in Brazil, then it will be taken to the page www.site.com/pt-br

However, in future accesses I need him to be taken to the en-route if he accesses the site via www.site.com

At the same time, if he chooses another language, I need to set it as the current one to prevent the user from falling into the wrong languages.

What is the best way to do this?

Nov
19
5 months ago
Activity icon

Replied to Search For Accented Words

'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
Activity icon

Started a new Conversation Search For Accented Words

I have the following code to search:

$resultContato = Contato::where(function ($q) use ($terms) {
                
          foreach ($terms as $key) {
                $q->orWhere('nome', 'like', "{$key} %"); 
                $q->orWhere('nome', 'like', "{$key}: %");  
                $q->orWhere('nome', 'like', "% {$key} %");
                $q->orWhere('nome', 'like', "% {$key}");
                $q->orWhere('nome', 'like', "%{$key}");
          }
        })->get();

It works well if the search is done with mixed or capitalized words. However it does not work with accented words.

Even if I remove the accent when searching, still no results are returned.

How can I solve this?