Update CompaniesController.php (#6900)

fixed companies destroy error
This commit is contained in:
vicleos 2019-05-06 08:57:28 +08:00 committed by snipe
parent ded1a59914
commit ab8792a13d

View file

@ -134,12 +134,12 @@ final class CompaniesController extends Controller
*/
public function destroy($companyId)
{
$this->authorize('delete', $company);
if (is_null($company = Company::find($companyId))) {
return redirect()->route('companies.index')
->with('error', trans('admin/companies/message.not_found'));
}
$this->authorize('delete', $company);
try {