I have two tables news and images. These two tables have one-to-many relationship (one being news). I’m trying to make a factory on images, but right after I migrate with seed, the image saved to news directory but after one second it got deleted, and the path on the database returns news. I’ve read this question but laravel 8.4 (my
Tag: laravel
How to store some tags in Laravel and how can I technically store those tags using the same ID
My question is that is okay to do it ID or some integer in migrations and how to store multiple tags using the same ID in controllers? Storing like this (storing multiple tags on the same ID): ID TAG 1 LARAVEL 1 PHP Answer I’m not sure the reason why you want to save the tags with same id in
How to prevent user from modifying submitted value in the form?
I have a simple form that sends a value to controller: This value will be static and this value cannot be modified. But of course it can be easily changed in Chrome dev tools. How can I better implement this? I though of doing validation like this: But it doesn’t work: What is good way of securing this value? Answer
Adding date and time to excel export in Laravel
I am new to Laravel and I am making a new project where I am exporting my schools data to a spreadsheet with maatwebsite, I have given it a title with the following code: What I want to accomplish is to have the date next to the title so it should be Staff Report-04/05/21 I tried to use date time
Laravel patch method not supported (even on update method)
HTML PATCHING FORM {{ Form::model($model , [ ‘route’ => [‘admin.friendship.update’, $model->id] , ‘class’=>’needs-validation ajax-form’, ‘method’ => ‘post’ ]) }} @…
Laravel controller shows syntax error, unexpected variable “$user”, expecting “function” or “const”
I am creating a forgot password feature in my application and when creating my controller, I used this code: But the first line gives an syntax error, unexpected variable “$user”, expecting “function” or “const” error. Does anyone know what I am doing wrong? Answer Make Sure Your { } are correct..and the code inside a function,check ; are correct
Laravel : Upload 64base image instead of normal
I have an application using React and Laravel where I’m uploading images. I’m using Laravel Image Intervention package. When testing my API, the upload for a normal image works perfectly. Using React, the user can select an image from his pc and crop it, then he sees the preview as a generated cropped 64base image. I would want to upload
How to override Laravel default routes with my package
I have developed a package and published it to packagist. My package contains a service provider and a set of routes including default ‘/’ route which are loaded through service provider class’ boot method. However, instead of default route from package the default route from web.php gets executed whenever I visit the site. Also other routes from the package seem
How can I display data from another table only authenticate user [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I have two tables on my database named user and products. I can register by email in the user table and login. in my products table
Laravel 8 custom headers run only for home page
I want to add custom headers for every response from my Laravel project. I created a middleware using php artisan make:middleware customheaders then I used this code in customheaders middleware then I added my class to kernel Now if I run my application home page localhost:8000 I can see my custom headers but if I go to any other page