Laravel orderBy with column value

Viewed 9835

This is the code that I currently have:

$programmefundings = Programmefunding::where('status', '!=', 'draft')->orderByRaw("FIELD(status , 'open', 'announced', 'delayed', 'closed') ASC")->orderBy('date_start', 'desc')->get();

So it gets all of my programmefundings except the ones with the status 'draft', reorders them from 'open' to 'closed' and arranges them by 'date_start'.

I need to reorder the programmefundings which have the status 'announced' by another column 'announcement_date' in 'asc' order without disturbing the 'open' to 'closed' structure it currently has and without effecting any other programmefindings which do not have the status value 'announced'.

Is this possible and does anyone know how to do this?

Thank you!

2 Answers
Related