in a Laravel project I am incrementing views based on session I am using it like this: $post = Post::whereSlug($slug)->firstOrFail(); $postKey = ‘post_’.$post->id; if (!Session::has($postKey)) …
Tag: laravel
Undefined variable $services
I have this error. I did this a couple of times on a different pages with different subjects , but with the same method. It always worked. But for some reason now I’m getting this error. Undefined …
How to cache BLOB type in Laravel
Hi everyone, Is there a way to cache BLOB types temporarily in Laravel ? Scenario: I’m gonna cache some data MEDIUMBLOB with the size of 2048KB temporarily. These data are actually parts of a large single file 16MB. After caching all parts, they will be combined together into a single file, then will be removed from cache. The content of
PHP Laravel : $request->hasFile() is not working
I have a form where i get the title,content … and an image. When i dd($requests->all());, It returns the following which is correct. Here is my code for image processing: But the img DB table field gets null. The if($request->hasFile(‘imagePost’)) is not getting the field. What have i done wrong? Answer You are modifying file object before you check it
How to write file to desktop in laravel?
I am trying to write a backup for my database, I want If a button is clicked the application will export the database to the desktop. The app exports the file on my database directory if I use laravel database directory path but if I change the path to desktop location nothing appears on the desktop. It will display DB
upload image to server modifying name
I am building a form with laravel 5.6 and where I save a name and a user photo, but i need the photo to be stored with the username. I show the code of my store I can get the username with $request->nombre; but I don’t know how to assign that name to the photo Answer There is a ->storeAs()
how to get all user based on where condition and compare this result with another condition in laravel eloquent
I have a user table column referred_by: I have a view for step 1 user like where referred_by=auth::user()->id In here whoever registered by this user referal link will be shown in this table: I …
inserting user in database from regitration form laravel 8
i am working on a e-commerce website using laravel 8 for the first time i created a login and registration views, when i try registering first it flashed iccorrect email adresse in session error that is displayed in register.blade.php after fixing that it redirected me to an error page with this text : my route is acctually set to POST
How can I select one item of an array with laravel http request?
If i run this controller in laravel: I’ll get this result: But I only want to return the title, upc and brand and save them as three seperated variables to store them in my database. How can i do that? If I do this: I’ll get NULL; Does anybody know how to do this in laravel? Answer Laravel converts the
Laravel DB Query WHERE date greater than not working with JOIN
Background I have written a SQL query that works perfectly for my needs, and I am trying to add it to a queued job in Laravel. Instead of using Eloquent models I wanted to go with DB Query to ensure better performance as there will ultimately be many joins and conditions. I am having a problem with the where clause