Skip to content
Advertisement

Tag: laravel

Replace all non printable characters except newline characters

I want to replace all non printable characters, especially emojis from a text but want to retain the newline characters like n and r I currently have this for escaping the non printable characters but it escapes n and r also: Answer [:print:] is a POSIX character class for printable chars. If you use it in a negated character class,

Laravel update model’s one-to-many relation’s items

I have two Eloquent models: Item’s columns are id, userId and name. When I want to update the user (PUT /users/<id>) I also want to update the items in the same request, meaning: Skip existing items Add new items Remove extra items Afterwards both DB and the relation should have up-to-date items. Example of the request data: I tried to

Laravel Filemanager Base url for Images is wrong

I need help configuring the site url being generated by Laravel File manager. I am developing my application locally on http://127.0.0.1:8000/. The name of the application is security. But whenever I upload images, its giving them a url of: http://security.test/storage/photos/1/logo-small.jpeg How can I change this incorrect url to: http://127.0.0.1:8000/storage/photos/1/logo-small.jpeg Answer Make the following change in .env file: After making change

How do I create a eloquent Polymorphic relation

I have a two eloquent models model User and Retailer. I want to create a new model “Task” where there there should be a field “added_by” which can denote either a user or a retailer. How can I create the migration for Task so that there is a field that can denote either user or retailer? How can I create

how could I link my HTML project to laravel? [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’m trying to create a webpage using laravel but there’s not a lot of info online on how to actually set up everything together. I already

Advertisement