Laravel how to set a checkbox value to checked based on models value

In this post I’ll show how to set a Laravel checkbox value to checked based on the value stored on the model. In this example I’ll be using the Laravel Collective Form checkbox {{ Form::checkbox(‘collected’ /* name */, “yes” /*value*/, old(‘collected’, $gas_cert->collected==”yes”?true:false ) /* true sets checked */ ) }} In the code example above … Read more