Is it possible to return all columns from a table, but if a string (value) contains a specific word, remove that word?
For example, I have a table like this:
------------------------------------------------- | id | article_desc | article_link | active | |----|------------------|----------------|--------| | 1 | Hello, world! | http://test.co | 0 | | 2 | ReplaceWord Test | http://null.org| 1 | -------------------------------------------------
"ReplaceWord" should be replaced to "" (nothing). So article_desc of ID 2 should return "Test".
Is there any way to do this in Laravel (Eloquent) without using a foreach or something? Is there any built-in function?
This is my controller where I am getting this data.
return Article::where('active', 1)->orderBy('create_date', 'desc')->get();
Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire