As long as it's readable to you and you're not going against any coding styles already set by anyone you're working with then it's fine.
I generally follow PSR-2 and use a beautiy formatter for old code I work with.
You can shorten your controller by using one return
with a dynamic array
or using ternary.
Ternary
return Response::json(array('result' => $sql ? 'success' : 'fail'));
Array
$response = ['result' => 'fail'];
if ($sql)
$response = ['result' => 'success'];
return Response::json($response);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community