public function getRequestAsset($assetId = null)
 {
     $user = Auth::user();
     // Check if the asset exists and is requestable
     if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
         // Redirect to the asset management page
         return redirect()->route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
     } elseif (!Company::isCurrentUserHasAccess($asset)) {
         return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
     } else {
         $logaction = new Actionlog();
         $logaction->asset_id = $data['asset_id'] = $asset->id;
         $logaction->asset_type = $data['asset_type'] = 'hardware';
         $logaction->created_at = $data['requested_date'] = date("Y-m-d h:i:s");
         if ($user->location_id) {
             $logaction->location_id = $user->location_id;
         }
         $logaction->user_id = $data['user_id'] = Auth::user()->id;
         $log = $logaction->logaction('requested');
         $data['requested_by'] = $user->fullName();
         $data['asset_name'] = $asset->showAssetName();
         $settings = Setting::getSettings();
         if ($settings->alert_email != '' && $settings->alerts_enabled == '1' && !config('app.lock_passwords')) {
             Mail::send('emails.asset-requested', $data, function ($m) use($user, $settings) {
                 $m->to(explode(',', $settings->alert_email), $settings->site_name);
                 $m->subject('Asset Requested');
             });
         }
         if ($settings->slack_endpoint) {
             $slack_settings = ['username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true];
             $client = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
             try {
                 $client->attach(['color' => 'good', 'fields' => [['title' => 'REQUESTED:', 'value' => strtoupper($logaction->asset_type) . ' asset <' . config('app.url') . '/hardware/' . $asset->id . '/view' . '|' . $asset->showAssetName() . '> requested by <' . config('app.url') . '/hardware/' . $asset->id . '/view' . '|' . Auth::user()->fullName() . '>.']]])->send('Asset Requested');
             } catch (Exception $e) {
             }
         }
         return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
     }
 }