I have 2 fields status and releaseYear and productionYear. I have to put the validation that : $request-> ‘productionYear’ => ‘nullable|digits:4’, ‘releaseYear’ => ‘required|…
Tag: laravel
How to use “If else” condition with date in blade template
Hi guys so I have post and comment system, So I want to show comment section if the day of the post +7 days. if they see the post on day 8 of the post created they can’t comment. Here is my code that I try but I still dont get it : I know it’s totally a dumb code,
Spatie/Newsletter: MailChimp Invalid MailChimp API key “ supplied in Laravel 5.6
Good morning all of you, I’m currently working on using spatie/newsletter in my laravel 5.6 Blog to work with MailChimp to create a newsletter where users can subscribe. When I try to subscribe, I get this response: My Controller Env File newsletter.php (after running php artisan vendor:publish -provide…
Limit Comment in Post Laravel
So this is the problem, I have application with post and comment. But I want to limit the comment per user, So if there is 1 post only 1 comment per user. Is it possible ? Here is my store function in CommentController: What query can I add in this store function to limit the user to only comment once
Change item of a session array in Laravel
I’m using Laravel 5.6, using session array to store the user details after login. user_date = array:19 [ “userEmail” => “user@user.com” “username” => “userwebtest” “role” => “user” “…
PHP Laravel Check if Array is empty
I am struggling with displaying some content depending on if an array does have a value or not.Every time the code in the else part is executed. What’s wrong here? Is there any syntax error with this code? I’m using php laravel. Answer
Sort By highest ID in Laravel?
I need to sort posts by highest id :/. Currently, the code sorts them by the lowest ID. How can I do that? Answer Source: Laravel Collections
Upload file using Curl and receive them in Laravel method
I have been trying to upload file to using curl using laravel app end point. Below code is on separate server. And receiving end in laravel app hosted on different server. It returns me empty response. I am able to verify curl request using headers. Any suggestion will be helpful. Thanks. Answer You can try s…
Laravel array_only with dot notation
Laravel has a helper that allows you to get only the keys you want like so: https://laravel.com/docs/5.6/helpers#method-array-only $array = [‘name’ => ‘Desk’, ‘price’ => 100, ‘orders’ => 10]…
How to get messages sent with the `array` mail driver?
Starting from version 5.7 Laravel suggests to use the array driver for Mail during testing: Unfortunately, the documentation tells nothing about this driver. According to the source code, the driver …