So I have table called paint with data like below
id name allow_on
------------------------------------------
1 Avian Wall|Roof|Wood
2 Avitex Wall|Roof|Iron
3 Nippon Floor|Iron
4 Some Plastic|Cloth|other
And how to get field based on allow_on
column, like "I want paint which can be used on wall" , so far my code look like this
$paints = Paint::get();
foreach($paints as $paint)
{
$exp = explode("|", $paint->allow_on);
foreach($exp as $pnt)
{
if(in_array($request->paint_name,$pnt))
{
var_dump($pnt)
}
}
}
I'm using Laravel 5.4 but i can't make it working, any solution? Thanks in advance.
via Rizal Fakhri