public function table(WorkOrder $workOrder)
    {
        $attachments = $workOrder->attachments();

        return $this->table->of('work-orders.attachments', function (TableGrid $table) use ($workOrder, $attachments) {
            $table->with($attachments)->paginate($this->perPage);

            $table->column('type', function (Column $column) {
                $column->value = function (Attachment $attachment) {
                    return $attachment->icon;
                };
            });

            $table->column('name', function (Column $column) use ($workOrder) {
                $column->value = function (Attachment $attachment) use ($workOrder) {
                    $route = 'maintenance.work-orders.attachments.show';

                    $params = [$workOrder->getKey(), $attachment->getKey()];

                    return link_to_route($route, $attachment->name, $params);
                };
            });

            $table->column('uploaded_by', function (Column $column) {
               $column->value = function (Attachment $attachment) {
                    if ($attachment->user instanceof User) {
                        return $attachment->user->getRecipientName();
                    }
               };
            });

            $table->column('Uploaded On', 'created_at');
        });
    }
public function table(WorkOrder $workOrder)
    {
        $attachments = $workOrder->attachments();

        return $this->table->of('work-orders.attachments', function (TableGrid $table) use ($workOrder, $attachments) {
            $table->with($attachments)->paginate($this->perPage);

            $table->column('type', function (Column $column) {
                $column->value = function (Attachment $attachment) {
                    return $attachment->icon;
                };
            });

            $table->column('name', function (Column $column) use ($workOrder) {
                $column->value = function (Attachment $attachment) use ($workOrder) {
                    $route = 'maintenance.work-orders.attachments.show';

                    $params = [$workOrder->getKey(), $attachment->getKey()];

                    return link_to_route($route, $attachment->name, $params);
                };
            });

            $table->column('uploaded_by', function (Column $column) {
               $column->value = function (Attachment $attachment) {
                    if ($attachment->user instanceof User) {
                        return $attachment->user->getRecipientName();
                    }
               };
            });

            $table->column('Uploaded On', 'created_at');
        });
    }
public function table ( WorkOrder $ workOrder ) { $ attachments = $ workOrder -> attachments ( ) ; return $ this -> table -> of ( 'work-orders.attachments' , function ( TableGrid $ table ) use ( $ workOrder , $ attachments ) { $ table -> with ( $ attachments ) -> paginate ( $ this -> perPage ) ; $ table -> column ( 'type' , function ( Column $ column ) { $ column -> value = function ( Attachment $ attachment ) { return $ attachment -> icon ; } ; } ) ; $ table -> column ( 'name' , function ( Column $ column ) use ( $ workOrder ) { $ column -> value = function ( Attachment $ attachment ) use ( $ workOrder ) { $ route = 'maintenance.work-orders.attachments.show' ; $ params = [ $ workOrder -> getKey ( ) , $ attachment -> getKey ( ) ] ; return link_to_route ( $ route , $ attachment -> name , $ params ) ; } ; } ) ; $ table -> column ( 'uploaded_by' , function ( Column $ column ) { $ column -> value = function ( Attachment $ attachment ) { if ( $ attachment -> user instanceof User ) { return $ attachment -> user -> getRecipientName ( ) ; } } ; } ) ; $ table -> column ( 'Uploaded On' , 'created_at' ) ; } ) ; }
Returns a new table of all the specified work orders attachments.

@param WorkOrder $workOrder

@return \Orchestra\Contracts\Html\Builder
Returns a new table of all the specified work orders attachments .