Skip to content
Advertisement

Tag: laravel

How can I run php artisan serve using .env.production?

I have a Laravel Web Application, and it works just fine locally, using a local .env file that references the local database. I have the same Laravel Web Application deployed in production, where I find a .env, which is different from the one that I use locally. Both the scenarios work perfectly, but when I wanted to perform a test

Laravel relative paths not working as expected on localhost

I’m just using Mac OS’s native apache2 server for my localhost. In my httpd.conf file, I set DocumentRoot “/Users/user_name/Local Sites/” …that directory houses all my sites I work on locally: So, for my particular Laravel project for site_1, I set the following in .env: APP_URL=http://localhost/site_1 …and again in config/app.php: ‘url’ => env(‘APP_URL’, ‘http://localhost/site_1’), However, when I try to use one

How can I write this query with Eloquent

Let’s say I have a method like this: My question is, how can I rewrite this query with Eloquent for my Laravel project? Answer From what I understood I think this is what you are looking for, try it and tell me: You can get more information from the laravel Database documentation Query Builder here: https://laravel.com/docs/8.x/queries#raw-methods

How to create redirect links with my own url?

I am creating a website with Laravel. I will promote some products via affiliation. I have some affiliates links like http://wwww.example.com/aff.php?id=123 I would like to have links like http://www.example.com/go/nameofproduct that redirect to affiliate links Affiliates links are in a table in my database. How can I do ? Thanks Answer

Advertisement